// // OpenSSL implementation classes // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include #include #include #include #include #include class ImpOpenssl { public: static constexpr const char * name = "OpenSSL"; }; template<> class XtsImpState { public: EVP_CIPHER_CTX* encCtx; EVP_CIPHER_CTX* decCtx; }; template<> class AuthEncImpState { public: EVP_CIPHER_CTX* encCtx; EVP_CIPHER_CTX* decCtx; BOOLEAN inComputation; }; template<> class RsaSignImpState { public: EVP_PKEY *pkey; EVP_PKEY_CTX *pkey_ctx; }; template<> class HashImpState { public: BOOLEAN isReset; EVP_MD *md; EVP_MD_CTX *mdCtx; struct constants_t { static constexpr SIZE_T inputBlockLen = SYMCRYPT_SHA256_INPUT_BLOCK_SIZE; static constexpr SIZE_T resultLen = SYMCRYPT_SHA256_RESULT_SIZE; static constexpr const char *const algorithm = "SHA2-256"; } constants; }; template<> class HashImpState { public: BOOLEAN isReset; EVP_MD *md; EVP_MD_CTX *mdCtx; struct constants_t { static constexpr SIZE_T inputBlockLen = SYMCRYPT_SHA384_INPUT_BLOCK_SIZE; static constexpr SIZE_T resultLen = SYMCRYPT_SHA384_RESULT_SIZE; static constexpr const char *const algorithm = "SHA2-384"; } constants; }; template<> class HashImpState { public: BOOLEAN isReset; EVP_MD *md; EVP_MD_CTX *mdCtx; struct constants_t { static constexpr SIZE_T inputBlockLen = SYMCRYPT_SHA512_INPUT_BLOCK_SIZE; static constexpr SIZE_T resultLen = SYMCRYPT_SHA512_RESULT_SIZE; static constexpr const char *const algorithm = "SHA2-512"; } constants; }; template<> class HashImpState { public: BOOLEAN isReset; EVP_MD *md; EVP_MD_CTX *mdCtx; struct constants_t { static constexpr SIZE_T inputBlockLen = SYMCRYPT_SHA3_256_INPUT_BLOCK_SIZE; static constexpr SIZE_T resultLen = SYMCRYPT_SHA3_256_RESULT_SIZE; static constexpr const char *const algorithm = "SHA3-256"; } constants; }; template<> class HashImpState { public: BOOLEAN isReset; EVP_MD *md; EVP_MD_CTX *mdCtx; struct constants_t { static constexpr SIZE_T inputBlockLen = SYMCRYPT_SHA3_384_INPUT_BLOCK_SIZE; static constexpr SIZE_T resultLen = SYMCRYPT_SHA3_384_RESULT_SIZE; static constexpr const char *const algorithm = "SHA3-384"; } constants; }; template<> class HashImpState { public: BOOLEAN isReset; EVP_MD *md; EVP_MD_CTX *mdCtx; struct constants_t { static constexpr SIZE_T inputBlockLen = SYMCRYPT_SHA3_512_INPUT_BLOCK_SIZE; static constexpr SIZE_T resultLen = SYMCRYPT_SHA3_512_RESULT_SIZE; static constexpr const char *const algorithm = "SHA3-512"; } constants; }; VOID addOpensslAlgs();