[libsecret] mock: Pad the common secret with zero bytes to make it exactly 128 bytes long
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsecret] mock: Pad the common secret with zero bytes to make it exactly 128 bytes long
- Date: Tue, 7 Nov 2017 14:44:19 +0000 (UTC)
commit d3ac1c183465bed5ce906062215734a76ac310c6
Author: Dmitry Shachnev <mitya57 gmail com>
Date: Mon Oct 9 01:25:08 2017 +0700
mock: Pad the common secret with zero bytes to make it exactly 128 bytes long
This is what the C code does, see egg/egg-dh.c:340.
https://bugzilla.gnome.org/show_bug.cgi?id=768112
libsecret/mock/service.py | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/libsecret/mock/service.py b/libsecret/mock/service.py
index 5fe6706..99f2cff 100644
--- a/libsecret/mock/service.py
+++ b/libsecret/mock/service.py
@@ -84,6 +84,8 @@ class AesAlgorithm():
# print "mock publi: ", hex(publi)
# print " mock peer: ", hex(peer)
ikm = dh.derive_key(privat, peer)
+ # Pad the secret with zero bytes to match length of prime in bytes.
+ ikm = b'\x00' * (128 - len(ikm)) + ikm
# print " mock ikm: ", hex_encode(ikm)
key = hkdf.hkdf(ikm, 16)
# print " mock key: ", hex_encode(key)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]