diff options
author | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2005-01-20 04:19:35 +0000 |
---|---|---|
committer | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2005-01-20 04:19:35 +0000 |
commit | 242d67fb17619670d9b757c442dcf2e26d8478a1 (patch) | |
tree | 1f61e8bf59450a028415e5a3f08565a6ceb86afe /pssr.h | |
parent | 4b85e6cac0d84aaf65d0695adb137ae956e4e241 (diff) | |
download | cryptopp-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 'pssr.h')
-rw-r--r-- | pssr.h | 44 |
1 files changed, 3 insertions, 41 deletions
@@ -2,7 +2,7 @@ #define CRYPTOPP_PSSR_H #include "pubkey.h" -#include <functional> +#include "emsa2.h" #ifdef CRYPTOPP_IS_DLL #include "sha.h" @@ -18,6 +18,7 @@ class CRYPTOPP_DLL PSSR_MEM_Base : public PK_RecoverableSignatureMessageEncoding virtual const MaskGeneratingFunction & GetMGF() const =0; public: + unsigned int MinRepresentativeBitLength(unsigned int hashIdentifierLength, unsigned int digestLength) const; unsigned int MaxRecoverableLength(unsigned int representativeBitLength, unsigned int hashIdentifierLength, unsigned int digestLength) const; bool IsProbabilistic() const; bool AllowNonrecoverablePart() const; @@ -32,45 +33,6 @@ public: byte *recoverableMessage) const; }; -template <class H> class EMSA2HashId -{ -public: - static const byte id; -}; - -// EMSA2HashId can be instantiated with the following classes. -class SHA; -class RIPEMD160; -class RIPEMD128; -class SHA256; -class SHA384; -class SHA512; -class Whirlpool; -// end of list - -#ifdef CRYPTOPP_IS_DLL -CRYPTOPP_DLL_TEMPLATE_CLASS EMSA2HashId<SHA>; -CRYPTOPP_DLL_TEMPLATE_CLASS EMSA2HashId<SHA256>; -CRYPTOPP_DLL_TEMPLATE_CLASS EMSA2HashId<SHA384>; -CRYPTOPP_DLL_TEMPLATE_CLASS EMSA2HashId<SHA512>; -#endif - -template <class BASE> -class EMSA2HashIdLookup : public BASE -{ -public: - struct HashIdentifierLookup - { - template <class H> struct HashIdentifierLookup2 - { - static HashIdentifier Lookup() - { - return HashIdentifier(&EMSA2HashId<H>::id, 1); - } - }; - }; -}; - template <bool USE_HASH_ID> class PSSR_MEM_BaseWithHashId; template<> class PSSR_MEM_BaseWithHashId<true> : public EMSA2HashIdLookup<PSSR_MEM_Base> {}; template<> class PSSR_MEM_BaseWithHashId<false> : public PSSR_MEM_Base {}; @@ -84,7 +46,7 @@ class PSSR_MEM : public PSSR_MEM_BaseWithHashId<USE_HASH_ID> virtual const MaskGeneratingFunction & GetMGF() const {static MGF mgf; return mgf;} public: - static std::string StaticAlgorithmName() {return std::string(ALLOW_RECOVERY ? "PSSR-" : "PSS-") + MGF::StaticAlgorithmName();} + static std::string CRYPTOPP_API StaticAlgorithmName() {return std::string(ALLOW_RECOVERY ? "PSSR-" : "PSS-") + MGF::StaticAlgorithmName();} }; //! <a href="http://www.weidai.com/scan-mirror/sig.html#sem_PSSR-MGF1">PSSR-MGF1</a> |