diff options
author | Alexander Harkness <bearbin@gmail.com> | 2013-11-24 15:21:13 +0100 |
---|---|---|
committer | Alexander Harkness <bearbin@gmail.com> | 2013-11-24 15:21:13 +0100 |
commit | 3438e5d3ddf8444f0e31009ffbe8237ef3752c22 (patch) | |
tree | 7c2f76d5e9281c130e60fb932c4dda89a49863b6 /CryptoPP/emsa2.cpp | |
parent | Moved source to src (diff) | |
download | cuberite-3438e5d3ddf8444f0e31009ffbe8237ef3752c22.tar cuberite-3438e5d3ddf8444f0e31009ffbe8237ef3752c22.tar.gz cuberite-3438e5d3ddf8444f0e31009ffbe8237ef3752c22.tar.bz2 cuberite-3438e5d3ddf8444f0e31009ffbe8237ef3752c22.tar.lz cuberite-3438e5d3ddf8444f0e31009ffbe8237ef3752c22.tar.xz cuberite-3438e5d3ddf8444f0e31009ffbe8237ef3752c22.tar.zst cuberite-3438e5d3ddf8444f0e31009ffbe8237ef3752c22.zip |
Diffstat (limited to 'CryptoPP/emsa2.cpp')
-rw-r--r-- | CryptoPP/emsa2.cpp | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/CryptoPP/emsa2.cpp b/CryptoPP/emsa2.cpp deleted file mode 100644 index 3dbb7e8c0..000000000 --- a/CryptoPP/emsa2.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// emsa2.cpp - written and placed in the public domain by Wei Dai - -#include "pch.h" -#include "emsa2.h" - -#ifndef CRYPTOPP_IMPORTS - -NAMESPACE_BEGIN(CryptoPP) - -void EMSA2Pad::ComputeMessageRepresentative(RandomNumberGenerator &rng, - const byte *recoverableMessage, size_t recoverableMessageLength, - HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty, - byte *representative, size_t representativeBitLength) const -{ - assert(representativeBitLength >= MinRepresentativeBitLength(hashIdentifier.second, hash.DigestSize())); - - if (representativeBitLength % 8 != 7) - throw PK_SignatureScheme::InvalidKeyLength("EMSA2: EMSA2 requires a key length that is a multiple of 8"); - - size_t digestSize = hash.DigestSize(); - size_t representativeByteLength = BitsToBytes(representativeBitLength); - - representative[0] = messageEmpty ? 0x4b : 0x6b; - memset(representative+1, 0xbb, representativeByteLength-digestSize-4); // pad with 0xbb - byte *afterP2 = representative+representativeByteLength-digestSize-3; - afterP2[0] = 0xba; - hash.Final(afterP2+1); - representative[representativeByteLength-2] = *hashIdentifier.first; - representative[representativeByteLength-1] = 0xcc; -} - -NAMESPACE_END - -#endif |