Skip to content

Commit

Permalink
added additional test
Browse files Browse the repository at this point in the history
  • Loading branch information
jakemas committed Dec 20, 2024
1 parent f7f1fbd commit 16f48d6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crypto/dilithium/p_pqdsa_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1258,6 +1258,17 @@ TEST_P(PQDSAParameterTest, RawFunctions) {
CMP_VEC_AND_PKEY_PUBLIC(pk, pkey, pk_len);
CMP_VEC_AND_PKEY_SECRET(sk, pkey, sk_len);

// Passing too large of a buffer is okay. The function will still only read
// the correct number of bytes (defined by pqdsa->public_key_len and
// pqdsa->private_key_len)
pk_len = GetParam().public_key_len + 1;
ASSERT_TRUE(EVP_PKEY_get_raw_public_key(pkey.get(), pk.data(), &pk_len));
CMP_VEC_AND_PKEY_PUBLIC(pk, pkey, pk_len);

sk_len = GetParam().private_key_len + 1;
ASSERT_TRUE(EVP_PKEY_get_raw_private_key(pkey.get(), sk.data(), &sk_len));
CMP_VEC_AND_PKEY_SECRET(sk, pkey, sk_len);

// ---- 3. Test getting public/private key sizes ----
pk_len = 0;
sk_len = 0;
Expand Down

0 comments on commit 16f48d6

Please sign in to comment.