summaryrefslogtreecommitdiff
path: root/pkcspad.cpp
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2005-01-20 04:19:35 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2005-01-20 04:19:35 +0000
commit242d67fb17619670d9b757c442dcf2e26d8478a1 (patch)
tree1f61e8bf59450a028415e5a3f08565a6ceb86afe /pkcspad.cpp
parent4b85e6cac0d84aaf65d0695adb137ae956e4e241 (diff)
downloadcryptopp-242d67fb17619670d9b757c442dcf2e26d8478a1.tar.gz
changes done for FIPS-140 lab code drop
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@195 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'pkcspad.cpp')
-rw-r--r--pkcspad.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/pkcspad.cpp b/pkcspad.cpp
index a51858c..78232fd 100644
--- a/pkcspad.cpp
+++ b/pkcspad.cpp
@@ -88,9 +88,7 @@ void PKCS1v15_SignatureMessageEncodingMethod::ComputeMessageRepresentative(Rando
HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty,
byte *representative, unsigned int representativeBitLength) const
{
- unsigned int digestSize = hash.DigestSize();
- if (digestSize + hashIdentifier.second + 10 > representativeBitLength/8)
- throw PK_Signer::KeyTooShort();
+ assert(representativeBitLength >= MinRepresentativeBitLength(hashIdentifier.second, hash.DigestSize()));
unsigned int pkcsBlockLen = representativeBitLength;
// convert from bit length to byte length
@@ -103,6 +101,7 @@ void PKCS1v15_SignatureMessageEncodingMethod::ComputeMessageRepresentative(Rando
representative[0] = 1; // block type 1
+ unsigned int digestSize = hash.DigestSize();
byte *pPadding = representative + 1;
byte *pDigest = representative + pkcsBlockLen - digestSize;
byte *pHashId = pDigest - hashIdentifier.second;