Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CAST for SP 800-56Cr2 One-Step function #1803

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions crypto/fipsmodule/self_check/self_check.c
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,50 @@ static int boringssl_self_test_fast(void) {
goto err;
}

static const uint8_t kSSKDFDigestInfo[] = {
0xaf, 0x85, 0xce, 0x3e, 0xa3, 0x03, 0x35, 0x0a, 0x2a, 0xa1, 0x31,
0xb8, 0x79, 0xea, 0x95, 0x4e, 0x1e, 0xe1, 0xe6, 0x85, 0xd2, 0xbf,
0x9d, 0xb7, 0x95, 0x42, 0x02, 0xe2, 0xf5, 0xec, 0x30, 0x96};
static const uint8_t kSSKDFDigestSharedSecret[] = {
0x39, 0xa1, 0xe2, 0xb3, 0x89, 0x9e, 0x87, 0xef, 0xec, 0xf6, 0x27,
0x12, 0x82, 0xd8, 0xf8, 0x00, 0x8f, 0x25, 0x26, 0x86, 0xdd, 0x35,
0xbf, 0xc3, 0x9a, 0x0f, 0x71, 0x47, 0x8d, 0xa4, 0x8c, 0x69, 0x15,
0x65, 0xce, 0xe4, 0x31, 0x25, 0x4d, 0xd5, 0x0c, 0xab, 0x74, 0x62,
0xc6, 0xcf, 0x19, 0x9b, 0xe9, 0xbf, 0x5c};
static const uint8_t kSSKDFDigestDerivedKey[] = {
0x5a, 0x2e, 0x26, 0x64, 0x4d, 0x16, 0x22, 0x2c, 0xd6, 0x36, 0xa1, 0xfd,
0xb5, 0x7b, 0xfa, 0xa1, 0x7f, 0x94, 0x44, 0x91, 0x27, 0x61, 0x2b, 0xcd,
0x7b,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 0x27, 0xe6, 0x66, 0x28, 0x9f, 0x80,
0x89, 0x2a, 0x3d, 0x14, 0xa8, 0x4f, 0xe3, 0x43, 0xfd, 0x78, 0xd0, 0xda,
0xdb, 0xde, 0x18, 0x19, 0xac, 0xa9, 0x15, 0xf7, 0xc0, 0xc0, 0x24, 0x37,
0x6b, 0x40, 0xcb, 0x34, 0xba, 0xe2, 0xd2, 0x6e, 0x9f, 0x45, 0x52, 0xb6,
0xb1, 0xa2, 0x6f, 0xa5}; // 256 bytes
uint8_t sskdf_digest_output[sizeof(kSSKDFDigestDerivedKey)];
if (!SSKDF_digest(&sskdf_digest_output[0], sizeof(kSSKDFDigestDerivedKey),
EVP_sha256(), &kSSKDFDigestSharedSecret[0],
sizeof(kSSKDFDigestSharedSecret), &kSSKDFDigestInfo[0],
sizeof(kSSKDFDigestInfo)) ||
!check_test(kSSKDFDigestDerivedKey, sskdf_digest_output,
sizeof(kSSKDFDigestDerivedKey), "SSKDF_digest KAT")) {
fprintf(stderr, "SSKDF_digest failed.\n");
skmcgrail marked this conversation as resolved.
Show resolved Hide resolved
goto err;
}

ret = 1;

err:
Expand Down
Loading