From 39f72341e45cac6b8404d7f1b18f76599eca6194 Mon Sep 17 00:00:00 2001 From: Mouse Date: Mon, 4 Jul 2016 13:08:13 -0400 Subject: [PATCH 1/2] Make ECIES default compatible with BouncyCastle --- eccrypto.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eccrypto.h b/eccrypto.h index a3d15e95..41dcd94c 100644 --- a/eccrypto.h +++ b/eccrypto.h @@ -283,10 +283,10 @@ struct ECNR : public DL_SS, DL_Algorithm_ECNR, DL_SignatureMe }; //! Elliptic Curve Integrated Encryption Scheme, AKA ECIES -/*! Default to (NoCofactorMultiplication and DHAES_MODE = false) for compatibilty with SEC1 and Crypto++ 4.2. +/*! Choose NoCofactorMultiplication and DHAES_MODE = false for compatibilty with SEC1 and Crypto++ 4.2. The combination of (IncompatibleCofactorMultiplication and DHAES_MODE = true) is recommended for best efficiency and security. */ -template +template struct ECIES : public DL_ES< DL_Keys_EC, From 48c0f900c7ae705f119781ee8bf129cfd5703712 Mon Sep 17 00:00:00 2001 From: Mouse Date: Wed, 6 Jul 2016 11:51:46 -0400 Subject: [PATCH 2/2] Corrected for better BC compatibility --- gfpcrypt.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gfpcrypt.h b/gfpcrypt.h index 114fe8da..bf103039 100644 --- a/gfpcrypt.h +++ b/gfpcrypt.h @@ -532,8 +532,8 @@ public: mac.Update(encodingParameters.begin(), encodingParameters.size()); if (DHAES_MODE) { - byte L[8] = {0,0,0,0}; - PutWord(false, BIG_ENDIAN_ORDER, L+4, word32(encodingParameters.size())); + byte L[8] = {0,0,0,0, 0,0,0,0}; + PutWord(false, BIG_ENDIAN_ORDER, L, word64(encodingParameters.size())); mac.Update(L, 8); } mac.Final(ciphertext + plaintextLength); @@ -561,8 +561,8 @@ public: mac.Update(encodingParameters.begin(), encodingParameters.size()); if (DHAES_MODE) { - byte L[8] = {0,0,0,0}; - PutWord(false, BIG_ENDIAN_ORDER, L+4, word32(encodingParameters.size())); + byte L[8] = {0,0,0,0, 0,0,0,0}; + PutWord(false, BIG_ENDIAN_ORDER, L, word64(encodingParameters.size())); mac.Update(L, 8); } if (!mac.Verify(ciphertext + plaintextLength))