45 #include "../../../../crypto/fipsmodule/ec/internal.h"
46 #include "../../../../crypto/fipsmodule/rand/internal.h"
47 #include "../../../../crypto/fipsmodule/tls/internal.h"
54 #if defined(OPENSSL_TRUSTY)
55 #include <trusty_log.h>
56 #define LOG_ERROR(...) TLOGE(__VA_ARGS__)
57 #define TLOG_TAG "modulewrapper"
59 #define LOG_ERROR(...) fprintf(stderr, __VA_ARGS__)
60 #endif // OPENSSL_TRUSTY
70 std::vector<uint8_t>
buf;
79 static bool ReadAll(
int fd,
void *in_data,
size_t data_len) {
83 while (
done < data_len) {
87 }
while (
r == -1 && errno == EINTR);
109 const size_t num_args = nums[0];
111 LOG_ERROR(
"Invalid, zero-argument operation requested.\n");
114 LOG_ERROR(
"Operation requested with %zu args, but %zu is the limit.\n",
125 for (
size_t i = 0;
i < num_args;
i++) {
126 const size_t arg_length = nums[
i + 1];
128 LOG_ERROR(
"Operation with name of length %zu exceeded limit of %zu.\n",
133 "Operation with argument of length %zu exceeded limit of %zu.\n",
141 "Argument limits permit excessive messages");
145 if (need >
buffer->buf.size()) {
146 size_t alloced = need + (need >> 1);
147 if (alloced < need) {
150 buffer->buf.resize(alloced);
158 for (
size_t i = 0;
i < num_args;
i++) {
167 if (spans.empty() || spans.size() >
kMaxArgs) {
173 nums[0] = spans.size();
178 for (
size_t i = 0;
i < spans.size();
i++) {
179 const auto &span = spans[
i];
180 nums[
i + 1] = span.size();
186 iovs[num_iov].
iov_len = span.size();
191 while (iov_done < num_iov) {
194 r =
writev(fd, &iovs[iov_done], num_iov - iov_done);
195 }
while (
r == -1 && errno == EINTR);
202 for (
size_t i = iov_done; i < num_iov && written > 0;
i++) {
205 size_t done = written;
214 if (
iov.iov_len == 0) {
219 assert(written == 0);
226 static constexpr
char kConfig[] =
229 "algorithm": "SHA2-224",
232 "min": 0, "max": 65528, "increment": 8
236 "algorithm": "SHA2-256",
239 "min": 0, "max": 65528, "increment": 8
243 "algorithm": "SHA2-384",
246 "min": 0, "max": 65528, "increment": 8
250 "algorithm": "SHA2-512",
253 "min": 0, "max": 65528, "increment": 8
257 "algorithm": "SHA2-512/256",
260 "min": 0, "max": 65528, "increment": 8
264 "algorithm": "SHA-1",
267 "min": 0, "max": 65528, "increment": 8
271 "algorithm": "ACVP-AES-ECB",
273 "direction": ["encrypt", "decrypt"],
274 "keyLen": [128, 192, 256]
277 "algorithm": "ACVP-AES-CTR",
279 "direction": ["encrypt", "decrypt"],
280 "keyLen": [128, 192, 256],
282 "min": 8, "max": 128, "increment": 8
284 "incrementalCounter": true,
285 "overflowCounter": true,
286 "performCounterTests": true
289 "algorithm": "ACVP-AES-CBC",
291 "direction": ["encrypt", "decrypt"],
292 "keyLen": [128, 192, 256]
295 "algorithm": "ACVP-AES-GCM",
297 "direction": ["encrypt", "decrypt"],
298 "keyLen": [128, 192, 256],
300 "min": 0, "max": 256, "increment": 8
303 "min": 0, "max": 320, "increment": 8
305 "tagLen": [32, 64, 96, 104, 112, 120, 128],
310 "algorithm": "ACVP-AES-GMAC",
312 "direction": ["encrypt", "decrypt"],
313 "keyLen": [128, 192, 256],
315 "min": 0, "max": 256, "increment": 8
318 "min": 0, "max": 320, "increment": 8
320 "tagLen": [32, 64, 96, 104, 112, 120, 128],
325 "algorithm": "ACVP-AES-KW",
337 "payloadLen": [{"min": 128, "max": 1024, "increment": 64}]
340 "algorithm": "ACVP-AES-KWP",
352 "payloadLen": [{"min": 8, "max": 4096, "increment": 8}]
355 "algorithm": "ACVP-AES-CCM",
364 "payloadLen": [{"min": 0, "max": 256, "increment": 8}],
367 "aadLen": [{"min": 0, "max": 1024, "increment": 8}]
370 "algorithm": "ACVP-TDES-ECB",
372 "direction": ["encrypt", "decrypt"],
377 "algorithm": "ACVP-TDES-CBC",
379 "direction": ["encrypt", "decrypt"],
384 "algorithm": "HMAC-SHA-1",
387 "min": 8, "max": 2048, "increment": 8
390 "min": 32, "max": 160, "increment": 8
394 "algorithm": "HMAC-SHA2-224",
397 "min": 8, "max": 2048, "increment": 8
400 "min": 32, "max": 224, "increment": 8
404 "algorithm": "HMAC-SHA2-256",
407 "min": 8, "max": 2048, "increment": 8
410 "min": 32, "max": 256, "increment": 8
414 "algorithm": "HMAC-SHA2-384",
417 "min": 8, "max": 2048, "increment": 8
420 "min": 32, "max": 384, "increment": 8
424 "algorithm": "HMAC-SHA2-512",
427 "min": 8, "max": 2048, "increment": 8
430 "min": 32, "max": 512, "increment": 8
434 "algorithm": "ctrDRBG",
436 "predResistanceEnabled": [false],
437 "reseedImplemented": false,
440 "derFuncEnabled": false,
441 "entropyInputLen": [384],
443 "persoStringLen": [{"min": 0, "max": 384, "increment": 16}],
444 "additionalInputLen": [
445 {"min": 0, "max": 384, "increment": 16}
447 "returnedBitsLen": 2048
451 "algorithm": "ECDSA",
460 "secretGenerationMode": [
465 "algorithm": "ECDSA",
476 "algorithm": "ECDSA",
495 "algorithm": "ECDSA",
517 "revision": "FIPS186-4",
518 "infoGeneratedByServer": true,
519 "pubExpMode": "fixed",
520 "fixedPubExp": "010001",
521 "keyFormat": "standard",
545 "revision": "FIPS186-4",
547 "sigType": "pkcs1v1.5",
551 "hashAlg": "SHA2-224"
553 "hashAlg": "SHA2-256"
555 "hashAlg": "SHA2-384"
557 "hashAlg": "SHA2-512"
561 "sigType": "pkcs1v1.5",
565 "hashAlg": "SHA2-224"
567 "hashAlg": "SHA2-256"
569 "hashAlg": "SHA2-384"
571 "hashAlg": "SHA2-512"
575 "sigType": "pkcs1v1.5",
579 "hashAlg": "SHA2-224"
581 "hashAlg": "SHA2-256"
583 "hashAlg": "SHA2-384"
585 "hashAlg": "SHA2-512"
593 "hashAlg": "SHA2-224",
596 "hashAlg": "SHA2-256",
599 "hashAlg": "SHA2-384",
602 "hashAlg": "SHA2-512",
611 "hashAlg": "SHA2-224",
614 "hashAlg": "SHA2-256",
617 "hashAlg": "SHA2-384",
620 "hashAlg": "SHA2-512",
629 "hashAlg": "SHA2-224",
632 "hashAlg": "SHA2-256",
635 "hashAlg": "SHA2-384",
638 "hashAlg": "SHA2-512",
647 "revision": "FIPS186-4",
648 "pubExpMode": "fixed",
649 "fixedPubExp": "010001",
651 "sigType": "pkcs1v1.5",
655 "hashAlg": "SHA2-224"
657 "hashAlg": "SHA2-256"
659 "hashAlg": "SHA2-384"
661 "hashAlg": "SHA2-512"
667 "sigType": "pkcs1v1.5",
671 "hashAlg": "SHA2-224"
673 "hashAlg": "SHA2-256"
675 "hashAlg": "SHA2-384"
677 "hashAlg": "SHA2-512"
683 "sigType": "pkcs1v1.5",
687 "hashAlg": "SHA2-224"
689 "hashAlg": "SHA2-256"
691 "hashAlg": "SHA2-384"
693 "hashAlg": "SHA2-512"
699 "sigType": "pkcs1v1.5",
703 "hashAlg": "SHA2-224"
705 "hashAlg": "SHA2-256"
707 "hashAlg": "SHA2-384"
709 "hashAlg": "SHA2-512"
719 "hashAlg": "SHA2-224",
722 "hashAlg": "SHA2-256",
725 "hashAlg": "SHA2-384",
728 "hashAlg": "SHA2-512",
740 "hashAlg": "SHA2-224",
743 "hashAlg": "SHA2-256",
746 "hashAlg": "SHA2-384",
749 "hashAlg": "SHA2-512",
761 "hashAlg": "SHA2-224",
764 "hashAlg": "SHA2-256",
767 "hashAlg": "SHA2-384",
770 "hashAlg": "SHA2-512",
780 "algorithm": "CMAC-AES",
781 "acvptoolTestOnly": true,
784 "direction": ["gen", "ver"],
790 "keyLen": [128, 256],
799 "algorithm": "kdf-components",
813 "algorithm": "KAS-ECC-SSC",
814 "revision": "Sp800-56Ar3",
816 "ephemeralUnified": {
829 "domainParameterGenerationMethods": [
837 "algorithm": "KAS-FFC-SSC",
838 "revision": "Sp800-56Ar3",
846 "domainParameterGenerationMethods": [
853 reinterpret_cast<const uint8_t *
>(kConfig),
sizeof(kConfig) - 1)});
868 if (
args[0].
size() != DigestLength) {
877 for (
size_t i = 0;
i < 1000;
i++) {
879 OneShotHash(
buf,
sizeof(
buf), digest);
880 memmove(
buf,
buf + DigestLength, DigestLength * 2);
881 memcpy(
buf + DigestLength * 2, digest, DigestLength);
890 if (iterations_bytes.
size() !=
sizeof(iterations)) {
892 "Expected %u-byte input for number of iterations, but found %u "
894 static_cast<unsigned>(
sizeof(iterations)),
895 static_cast<unsigned>(iterations_bytes.
size()));
899 memcpy(&iterations, iterations_bytes.
data(),
sizeof(iterations));
900 if (iterations == 0 || iterations ==
UINT32_MAX) {
902 static_cast<unsigned>(iterations));
922 std::vector<uint8_t> prev_result;
924 if (j == iterations - 1) {
953 std::vector<uint8_t> prev_result, prev_input;
967 memcpy(iv_copy, iv.data(),
sizeof(iv_copy));
987 static const uint32_t kOneIteration = 1;
988 if (
args[3].
size() !=
sizeof(kOneIteration) ||
989 memcmp(
args[3].
data(), &kOneIteration,
sizeof(kOneIteration))) {
990 LOG_ERROR(
"Only a single iteration supported with AES-CTR\n");
1004 LOG_ERROR(
"Multiple iterations of AES-CTR is not supported.\n");
1008 std::vector<uint8_t>
out;
1020 if (tag_len_span.
size() !=
sizeof(tag_len_32)) {
1021 LOG_ERROR(
"Tag size value is %u bytes, not an uint32_t\n",
1022 static_cast<unsigned>(tag_len_span.
size()));
1025 memcpy(&tag_len_32, tag_len_span.
data(),
sizeof(tag_len_32));
1028 switch (
key.size()) {
1039 LOG_ERROR(
"Bad AES-GCM key length %u\n",
static_cast<unsigned>(
key.size()));
1045 LOG_ERROR(
"Failed to setup AES-GCM with tag length %u\n",
1046 static_cast<unsigned>(tag_len_32));
1056 if (tag_len_span.
size() !=
sizeof(tag_len_32)) {
1057 LOG_ERROR(
"Tag size value is %u bytes, not an uint32_t\n",
1058 static_cast<unsigned>(tag_len_span.
size()));
1061 memcpy(&tag_len_32, tag_len_span.
data(),
sizeof(tag_len_32));
1062 if (tag_len_32 != 4) {
1063 LOG_ERROR(
"AES-CCM only supports 4-byte tags, but %u was requested\n",
1064 static_cast<unsigned>(tag_len_32));
1068 if (
key.size() != 16) {
1069 LOG_ERROR(
"AES-CCM only supports 128-bit keys, but %u bits were given\n",
1070 static_cast<unsigned>(
key.size() * 8));
1075 key.size(), tag_len_32,
nullptr)) {
1076 LOG_ERROR(
"Failed to setup AES-CCM with tag length %u\n",
1077 static_cast<unsigned>(tag_len_32));
1084 template <
bool (*SetupFunc)(EVP_AEAD_CTX *ctx, Span<const u
int8_t> tag_len_span,
1085 Span<const u
int8_t> key)>
1093 bssl::ScopedEVP_AEAD_CTX
ctx;
1094 if (!SetupFunc(
ctx.get(), tag_len_span,
key)) {
1110 out.resize(out_len);
1114 template <
bool (*SetupFunc)(EVP_AEAD_CTX *ctx, Span<const u
int8_t> tag_len_span,
1115 Span<const u
int8_t> key)>
1123 bssl::ScopedEVP_AEAD_CTX
ctx;
1124 if (!SetupFunc(
ctx.get(), tag_len_span,
key)) {
1130 uint8_t success_flag[1] = {0};
1139 out.resize(out_len);
1140 success_flag[0] = 1;
1148 key.data(),
key.size() * 8,
out) != 0) {
1149 LOG_ERROR(
"Invalid AES key length for AES-KW(P): %u\n",
1150 static_cast<unsigned>(
key.size()));
1162 if (
input.size() % 8) {
1163 LOG_ERROR(
"Invalid AES-KW input length: %u\n",
1164 static_cast<unsigned>(
input.size()));
1202 uint8_t success_flag[1] = {0};
1209 success_flag[0] = 1;
1232 out.resize(out_len);
1248 uint8_t success_flag[1] = {0};
1255 success_flag[0] = 1;
1261 template <
bool Encrypt>
1266 LOG_ERROR(
"Bad key length %u for 3DES.\n",
1267 static_cast<unsigned>(
args[0].
size()));
1270 bssl::ScopedEVP_CIPHER_CTX
ctx;
1278 LOG_ERROR(
"Bad input length %u for 3DES.\n",
1279 static_cast<unsigned>(
args[1].
size()));
1285 std::vector<uint8_t> prev_result, prev_prev_result;
1288 if (j == iterations - 1) {
1290 }
else if (iterations >= 2 && j == iterations - 2) {
1291 prev_prev_result =
result;
1297 out_len !=
static_cast<int>(
result.size())) {
1307 template <
bool Encrypt>
1312 LOG_ERROR(
"Bad key length %u for 3DES.\n",
1313 static_cast<unsigned>(
args[0].
size()));
1318 LOG_ERROR(
"Bad input length %u for 3DES.\n",
1319 static_cast<unsigned>(
args[1].
size()));
1325 LOG_ERROR(
"Bad IV length %u for 3DES.\n",
1326 static_cast<unsigned>(
args[2].
size()));
1333 std::vector<uint8_t> prev_result, prev_prev_result;
1334 bssl::ScopedEVP_CIPHER_CTX
ctx;
1341 for (
uint32_t j = 0; j < iterations; j++) {
1342 prev_prev_result = prev_result;
1345 int out_len, out_len2;
1351 (out_len + out_len2) !=
static_cast<int>(
result.size())) {
1359 input = prev_result;
1373 template <const EVP_MD *HashFunc()>
1375 const EVP_MD *
const md = HashFunc();
1377 unsigned digest_len;
1379 digest, &digest_len) ==
nullptr) {
1386 const auto out_len_bytes =
args[0];
1387 const auto entropy =
args[1];
1388 const auto personalisation =
args[2];
1389 const auto additional_data1 =
args[3];
1390 const auto additional_data2 =
args[4];
1391 const auto nonce =
args[5];
1394 if (out_len_bytes.size() !=
sizeof(out_len) ||
1397 nonce.
size() != 0) {
1400 memcpy(&out_len, out_len_bytes.data(),
sizeof(out_len));
1401 if (out_len > (1 << 24)) {
1404 std::vector<uint8_t>
out(out_len);
1407 if (!
CTR_DRBG_init(&drbg, entropy.data(), personalisation.data(),
1408 personalisation.size()) ||
1410 additional_data1.size()) ||
1412 additional_data2.size())) {
1420 const size_t len = strlen(
b);
1421 return a.size() ==
len && memcmp(
a.data(),
b,
len) == 0;
1443 std::vector<uint8_t>
ret(
len);
1450 bssl::UniquePtr<BIGNUM>
x(
BN_new());
1451 bssl::UniquePtr<BIGNUM>
y(
BN_new());
1454 y.get(),
nullptr)) {
1471 std::vector<uint8_t> d_bytes =
1480 bssl::UniquePtr<BIGNUM> bn(
BN_new());
1497 point.get(),
x.get(),
y.get(),
1530 unsigned digest_len;
1538 bssl::UniquePtr<ECDSA_SIG> sig(
ECDSA_do_sign(digest, digest_len,
key.get()));
1543 std::vector<uint8_t> r_bytes(
BIGNUMBytes(sig->r));
1544 std::vector<uint8_t> s_bytes(
BIGNUMBytes(sig->s));
1563 unsigned digest_len;
1573 point.get(),
x.get(),
y.get(),
1594 if (
args[0].
size() !=
sizeof(mac_len)) {
1598 if (mac_len >
sizeof(mac)) {
1619 static std::map<unsigned, bssl::UniquePtr<RSA>>&
CachedRSAKeys() {
1620 static std::map<unsigned, bssl::UniquePtr<RSA>>
keys;
1627 return it->second.get();
1650 LOG_ERROR(
"RSA_generate_key_fips failed for modulus length %u.\n",
bits);
1667 template <const EVP_MD *(MDFunc)(),
bool UsePSS>
1679 unsigned digest_len;
1688 digest_len,
md,
md, -1)) {
1697 sig_len = sig_len_u;
1700 sig.resize(sig_len);
1706 template <const EVP_MD *(MDFunc)(),
bool UsePSS>
1724 unsigned digest_len;
1742 template <const EVP_MD *(MDFunc)()>
1752 if (out_len_bytes.
size() !=
sizeof(out_len)) {
1755 memcpy(&out_len, out_len_bytes.
data(),
sizeof(out_len));
1757 std::vector<uint8_t>
out(
static_cast<size_t>(out_len));
1759 reinterpret_cast<const char *
>(
label.data()),
1765 return write_reply({
out});
1780 group, their_point.get(), their_x.get(), their_y.get(),
ctx.get())) {
1781 LOG_ERROR(
"Invalid peer point for ECDH.\n");
1788 LOG_ERROR(
"EC_KEY_set_private_key failed.\n");
1796 LOG_ERROR(
"Calculating public key failed.\n");
1800 LOG_ERROR(
"EC_KEY_generate_key_fips failed.\n");
1809 ec_key.get(),
nullptr);
1811 LOG_ERROR(
"ECDH_compute_key failed.\n");
1813 }
else if (
static_cast<size_t>(out_len) ==
output.size()) {
1814 LOG_ERROR(
"ECDH_compute_key output may have been truncated.\n");
1817 output.resize(
static_cast<size_t>(out_len));
1820 bssl::UniquePtr<BIGNUM>
x(
BN_new());
1821 bssl::UniquePtr<BIGNUM>
y(
BN_new());
1824 LOG_ERROR(
"EC_POINT_get_affine_coordinates_GFp failed.\n");
1839 bssl::UniquePtr<DH> dh(
DH_new());
1850 if (!private_key_span.
empty()) {
1867 std::vector<uint8_t>
z(
DH_size(dh.get()));
1869 static_cast<int>(
z.size())) {
1870 LOG_ERROR(
"DH_compute_key_hashed failed.\n");
1877 static constexpr
struct {
1889 {
"SHA-1/MCT", 1, HashMCT<SHA1, SHA_DIGEST_LENGTH>},
1890 {
"SHA2-224/MCT", 1, HashMCT<SHA224, SHA224_DIGEST_LENGTH>},
1891 {
"SHA2-256/MCT", 1, HashMCT<SHA256, SHA256_DIGEST_LENGTH>},
1892 {
"SHA2-384/MCT", 1, HashMCT<SHA384, SHA384_DIGEST_LENGTH>},
1893 {
"SHA2-512/MCT", 1, HashMCT<SHA512, SHA512_DIGEST_LENGTH>},
1894 {
"SHA2-512/256/MCT", 1, HashMCT<SHA512_256, SHA512_256_DIGEST_LENGTH>},
1895 {
"AES/encrypt", 3, AES<AES_set_encrypt_key, AES_encrypt>},
1896 {
"AES/decrypt", 3, AES<AES_set_decrypt_key, AES_decrypt>},
1897 {
"AES-CBC/encrypt", 4, AES_CBC<AES_set_encrypt_key, AES_ENCRYPT>},
1898 {
"AES-CBC/decrypt", 4, AES_CBC<AES_set_decrypt_key, AES_DECRYPT>},
1899 {
"AES-CTR/encrypt", 4,
AES_CTR},
1900 {
"AES-CTR/decrypt", 4,
AES_CTR},
1901 {
"AES-GCM/seal", 5, AEADSeal<AESGCMSetup>},
1902 {
"AES-GCM/open", 5, AEADOpen<AESGCMSetup>},
1907 {
"AES-CCM/seal", 5, AEADSeal<AESCCMSetup>},
1908 {
"AES-CCM/open", 5, AEADOpen<AESCCMSetup>},
1909 {
"3DES-ECB/encrypt", 3, TDES<true>},
1910 {
"3DES-ECB/decrypt", 3, TDES<false>},
1911 {
"3DES-CBC/encrypt", 4, TDES_CBC<true>},
1912 {
"3DES-CBC/decrypt", 4, TDES_CBC<false>},
1913 {
"HMAC-SHA-1", 2, HMAC<EVP_sha1>},
1914 {
"HMAC-SHA2-224", 2, HMAC<EVP_sha224>},
1915 {
"HMAC-SHA2-256", 2, HMAC<EVP_sha256>},
1916 {
"HMAC-SHA2-384", 2, HMAC<EVP_sha384>},
1917 {
"HMAC-SHA2-512", 2, HMAC<EVP_sha512>},
1918 {
"ctrDRBG/AES-256", 6,
DRBG},
1926 {
"RSA/sigGen/SHA2-224/pkcs1v1.5", 2, RSASigGen<EVP_sha224, false>},
1927 {
"RSA/sigGen/SHA2-256/pkcs1v1.5", 2, RSASigGen<EVP_sha256, false>},
1928 {
"RSA/sigGen/SHA2-384/pkcs1v1.5", 2, RSASigGen<EVP_sha384, false>},
1929 {
"RSA/sigGen/SHA2-512/pkcs1v1.5", 2, RSASigGen<EVP_sha512, false>},
1930 {
"RSA/sigGen/SHA-1/pkcs1v1.5", 2, RSASigGen<EVP_sha1, false>},
1931 {
"RSA/sigGen/SHA2-224/pss", 2, RSASigGen<EVP_sha224, true>},
1932 {
"RSA/sigGen/SHA2-256/pss", 2, RSASigGen<EVP_sha256, true>},
1933 {
"RSA/sigGen/SHA2-384/pss", 2, RSASigGen<EVP_sha384, true>},
1934 {
"RSA/sigGen/SHA2-512/pss", 2, RSASigGen<EVP_sha512, true>},
1935 {
"RSA/sigGen/SHA-1/pss", 2, RSASigGen<EVP_sha1, true>},
1936 {
"RSA/sigVer/SHA2-224/pkcs1v1.5", 4, RSASigVer<EVP_sha224, false>},
1937 {
"RSA/sigVer/SHA2-256/pkcs1v1.5", 4, RSASigVer<EVP_sha256, false>},
1938 {
"RSA/sigVer/SHA2-384/pkcs1v1.5", 4, RSASigVer<EVP_sha384, false>},
1939 {
"RSA/sigVer/SHA2-512/pkcs1v1.5", 4, RSASigVer<EVP_sha512, false>},
1940 {
"RSA/sigVer/SHA-1/pkcs1v1.5", 4, RSASigVer<EVP_sha1, false>},
1941 {
"RSA/sigVer/SHA2-224/pss", 4, RSASigVer<EVP_sha224, true>},
1942 {
"RSA/sigVer/SHA2-256/pss", 4, RSASigVer<EVP_sha256, true>},
1943 {
"RSA/sigVer/SHA2-384/pss", 4, RSASigVer<EVP_sha384, true>},
1944 {
"RSA/sigVer/SHA2-512/pss", 4, RSASigVer<EVP_sha512, true>},
1945 {
"RSA/sigVer/SHA-1/pss", 4, RSASigVer<EVP_sha1, true>},
1946 {
"TLSKDF/1.0/SHA-1", 5, TLSKDF<EVP_md5_sha1>},
1947 {
"TLSKDF/1.2/SHA2-256", 5, TLSKDF<EVP_sha256>},
1948 {
"TLSKDF/1.2/SHA2-384", 5, TLSKDF<EVP_sha384>},
1949 {
"TLSKDF/1.2/SHA2-512", 5, TLSKDF<EVP_sha512>},
1950 {
"ECDH/P-224", 3, ECDH<NID_secp224r1>},
1951 {
"ECDH/P-256", 3, ECDH<NID_X9_62_prime256v1>},
1952 {
"ECDH/P-384", 3, ECDH<NID_secp384r1>},
1953 {
"ECDH/P-521", 3, ECDH<NID_secp521r1>},
1958 const bssl::Span<const uint8_t> algorithm =
args[0];
1960 if (algorithm.size() == strlen(
func.name) &&
1961 memcmp(algorithm.data(),
func.name, algorithm.size()) == 0) {
1962 if (
args.size() - 1 !=
func.num_expected_args) {
1963 LOG_ERROR(
"\'%s\' operation received %zu arguments but expected %u.\n",
1968 return func.handler;
1972 const std::string name(
reinterpret_cast<const char *
>(algorithm.data()),