summaryrefslogtreecommitdiff
path: root/pkcspad.cpp
diff options
context:
space:
mode:
authorweidai <weidai11@users.noreply.github.com>2005-01-20 04:19:35 +0000
committerweidai <weidai11@users.noreply.github.com>2005-01-20 04:19:35 +0000
commitb3924f2108c0b0825060e91f6fde8202ce35624d (patch)
tree1f61e8bf59450a028415e5a3f08565a6ceb86afe /pkcspad.cpp
parent79e29d0de49969af44474cc890cffd7b1d6b1a4b (diff)
downloadcryptopp-git-b3924f2108c0b0825060e91f6fde8202ce35624d.tar.gz
changes done for FIPS-140 lab code drop
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 a51858cc..78232fdb 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;