Skip to content

Commit 228c892

Browse files
author
Aaron Hadley
committed
Merged PR 10870809: Add openssl hmac implementations for performance testing
## Description: Add OpenSSL HMAC implementations to Symcrypt unit tests
1 parent 93c7161 commit 228c892

File tree

8 files changed

+783
-611
lines changed

8 files changed

+783
-611
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ x64/*
2525
*.a
2626
*.bin
2727
SourcesCop*
28-
build/obj/
29-
build/bin/
28+
build/*
3029

3130
# Generated files
3231
inc/*.dat.h

unittest/inc/openssl_implementations.h

Lines changed: 1 addition & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -4,117 +4,14 @@
44
// Copyright (c) Microsoft Corporation. Licensed under the MIT license.
55
//
66

7-
#include <openssl/evp.h>
8-
#include <openssl/rand.h>
9-
#include <openssl/sha.h>
107
#include <symcrypt.h>
118
#include <stdint.h>
129
#include <vector>
10+
1311
class ImpOpenssl {
1412
public:
1513
static constexpr const char * name = "OpenSSL";
1614
};
1715

18-
template<>
19-
class XtsImpState<ImpOpenssl, AlgXtsAes> {
20-
public:
21-
EVP_CIPHER_CTX* encCtx;
22-
EVP_CIPHER_CTX* decCtx;
23-
};
24-
25-
template<>
26-
class AuthEncImpState<ImpOpenssl, AlgAes, ModeGcm> {
27-
public:
28-
EVP_CIPHER_CTX* encCtx;
29-
EVP_CIPHER_CTX* decCtx;
30-
BOOLEAN inComputation;
31-
};
32-
33-
template<>
34-
class RsaSignImpState<ImpOpenssl, AlgRsaSignPss> {
35-
public:
36-
EVP_PKEY *pkey;
37-
EVP_PKEY_CTX *pkey_ctx;
38-
};
39-
40-
template<>
41-
class HashImpState<ImpOpenssl, AlgSha256> {
42-
public:
43-
BOOLEAN isReset;
44-
EVP_MD *md;
45-
EVP_MD_CTX *mdCtx;
46-
struct constants_t {
47-
static constexpr SIZE_T inputBlockLen = SYMCRYPT_SHA256_INPUT_BLOCK_SIZE;
48-
static constexpr SIZE_T resultLen = SYMCRYPT_SHA256_RESULT_SIZE;
49-
static constexpr const char *const algorithm = "SHA2-256";
50-
} constants;
51-
};
52-
53-
template<>
54-
class HashImpState<ImpOpenssl, AlgSha384> {
55-
public:
56-
BOOLEAN isReset;
57-
EVP_MD *md;
58-
EVP_MD_CTX *mdCtx;
59-
struct constants_t {
60-
static constexpr SIZE_T inputBlockLen = SYMCRYPT_SHA384_INPUT_BLOCK_SIZE;
61-
static constexpr SIZE_T resultLen = SYMCRYPT_SHA384_RESULT_SIZE;
62-
static constexpr const char *const algorithm = "SHA2-384";
63-
} constants;
64-
};
65-
66-
template<>
67-
class HashImpState<ImpOpenssl, AlgSha512> {
68-
public:
69-
BOOLEAN isReset;
70-
EVP_MD *md;
71-
EVP_MD_CTX *mdCtx;
72-
struct constants_t {
73-
static constexpr SIZE_T inputBlockLen = SYMCRYPT_SHA512_INPUT_BLOCK_SIZE;
74-
static constexpr SIZE_T resultLen = SYMCRYPT_SHA512_RESULT_SIZE;
75-
static constexpr const char *const algorithm = "SHA2-512";
76-
} constants;
77-
};
78-
79-
template<>
80-
class HashImpState<ImpOpenssl, AlgSha3_256> {
81-
public:
82-
BOOLEAN isReset;
83-
EVP_MD *md;
84-
EVP_MD_CTX *mdCtx;
85-
struct constants_t {
86-
static constexpr SIZE_T inputBlockLen = SYMCRYPT_SHA3_256_INPUT_BLOCK_SIZE;
87-
static constexpr SIZE_T resultLen = SYMCRYPT_SHA3_256_RESULT_SIZE;
88-
static constexpr const char *const algorithm = "SHA3-256";
89-
} constants;
90-
};
91-
92-
template<>
93-
class HashImpState<ImpOpenssl, AlgSha3_384> {
94-
public:
95-
BOOLEAN isReset;
96-
EVP_MD *md;
97-
EVP_MD_CTX *mdCtx;
98-
struct constants_t {
99-
static constexpr SIZE_T inputBlockLen = SYMCRYPT_SHA3_384_INPUT_BLOCK_SIZE;
100-
static constexpr SIZE_T resultLen = SYMCRYPT_SHA3_384_RESULT_SIZE;
101-
static constexpr const char *const algorithm = "SHA3-384";
102-
} constants;
103-
};
104-
105-
template<>
106-
class HashImpState<ImpOpenssl, AlgSha3_512> {
107-
public:
108-
BOOLEAN isReset;
109-
EVP_MD *md;
110-
EVP_MD_CTX *mdCtx;
111-
struct constants_t {
112-
static constexpr SIZE_T inputBlockLen = SYMCRYPT_SHA3_512_INPUT_BLOCK_SIZE;
113-
static constexpr SIZE_T resultLen = SYMCRYPT_SHA3_512_RESULT_SIZE;
114-
static constexpr const char *const algorithm = "SHA3-512";
115-
} constants;
116-
};
117-
118-
11916
VOID
12017
addOpensslAlgs();

0 commit comments

Comments
 (0)