summaryrefslogtreecommitdiffstats
path: root/cryptopp562/pssr.h
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2024-10-24 06:44:24 -0400
committerMalfurious <m@lfurio.us>2024-10-24 06:44:24 -0400
commit512aa4c77b3dc0d72db713a9215ff65a98a99ec3 (patch)
tree6db82e0109dc987b5b021f81d4e8a0926eb75ff7 /cryptopp562/pssr.h
parent428471d39fb8c205a9fad899c88c30a2cb7df685 (diff)
parent10affea371406c0ae4c080e5a19390a8e9bd154b (diff)
downloadcompass-512aa4c77b3dc0d72db713a9215ff65a98a99ec3.tar.gz
compass-512aa4c77b3dc0d72db713a9215ff65a98a99ec3.zip
Merge branch 'mbedtls'
Replace Crypto++ 5.6.2 with Mbed TLS 3.6.0 Newer compilers are starting to show the age of the crypto library we've been using, as it is sometimes a pain to recompile compass lately. So, the tracked version of Crypto++ was at least due for an upgrade. However, I plan to soon begin reimplementing compass in C. So, I'm taking this opportunity to first just migrate the cryptography library to a newer C alternative. This branch does so, and integrates its use into the current C++ version of compass. * mbedtls: Remove unnecessary exception handler catch block Refactor random password generation to use mbedtls entropy source Refactor SHA256 function to use mbedtls Refactor AES functions to use mbedtls Add Mbedtls library Remove Crypto++ library
Diffstat (limited to 'cryptopp562/pssr.h')
-rw-r--r--cryptopp562/pssr.h66
1 files changed, 0 insertions, 66 deletions
diff --git a/cryptopp562/pssr.h b/cryptopp562/pssr.h
deleted file mode 100644
index 6ec6936..0000000
--- a/cryptopp562/pssr.h
+++ /dev/null
@@ -1,66 +0,0 @@
-#ifndef CRYPTOPP_PSSR_H
-#define CRYPTOPP_PSSR_H
-
-#include "pubkey.h"
-#include "emsa2.h"
-
-#ifdef CRYPTOPP_IS_DLL
-#include "sha.h"
-#endif
-
-NAMESPACE_BEGIN(CryptoPP)
-
-class CRYPTOPP_DLL PSSR_MEM_Base : public PK_RecoverableSignatureMessageEncodingMethod
-{
- virtual bool AllowRecovery() const =0;
- virtual size_t SaltLen(size_t hashLen) const =0;
- virtual size_t MinPadLen(size_t hashLen) const =0;
- virtual const MaskGeneratingFunction & GetMGF() const =0;
-
-public:
- size_t MinRepresentativeBitLength(size_t hashIdentifierLength, size_t digestLength) const;
- size_t MaxRecoverableLength(size_t representativeBitLength, size_t hashIdentifierLength, size_t digestLength) const;
- bool IsProbabilistic() const;
- bool AllowNonrecoverablePart() const;
- bool RecoverablePartFirst() const;
- void ComputeMessageRepresentative(RandomNumberGenerator &rng,
- const byte *recoverableMessage, size_t recoverableMessageLength,
- HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty,
- byte *representative, size_t representativeBitLength) const;
- DecodingResult RecoverMessageFromRepresentative(
- HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty,
- byte *representative, size_t representativeBitLength,
- byte *recoverableMessage) const;
-};
-
-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 {};
-
-template <bool ALLOW_RECOVERY, class MGF=P1363_MGF1, int SALT_LEN=-1, int MIN_PAD_LEN=0, bool USE_HASH_ID=false>
-class PSSR_MEM : public PSSR_MEM_BaseWithHashId<USE_HASH_ID>
-{
- virtual bool AllowRecovery() const {return ALLOW_RECOVERY;}
- virtual size_t SaltLen(size_t hashLen) const {return SALT_LEN < 0 ? hashLen : SALT_LEN;}
- virtual size_t MinPadLen(size_t hashLen) const {return MIN_PAD_LEN < 0 ? hashLen : MIN_PAD_LEN;}
- virtual const MaskGeneratingFunction & GetMGF() const {static MGF mgf; return mgf;}
-
-public:
- 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>
-struct PSSR : public SignatureStandard
-{
- typedef PSSR_MEM<true> SignatureMessageEncodingMethod;
-};
-
-//! <a href="http://www.weidai.com/scan-mirror/sig.html#sem_PSS-MGF1">PSS-MGF1</a>
-struct PSS : public SignatureStandard
-{
- typedef PSSR_MEM<false> SignatureMessageEncodingMethod;
-};
-
-NAMESPACE_END
-
-#endif