siv: add functions to return min and max nonce length

While AES-SIV-CMAC allows nonces of any length, AES-GCM-SIV requires
exactly 12 bytes, which is less than the unpadded minimum length of 16
used in the NTS authenticator field. These functions will be needed to
support both ciphers in the NTS code.
This commit is contained in:
Miroslav Lichvar
2022-10-10 12:25:47 +02:00
parent 5caf0ad187
commit 5dd173c050
4 changed files with 42 additions and 0 deletions

View File

@@ -244,6 +244,12 @@ test_unit(void)
}
TEST_CHECK(SIV_GetKeyLength(tests[i].algorithm) == tests[i].key_length);
TEST_CHECK(SIV_GetMinNonceLength(siv) >= 1);
TEST_CHECK(SIV_GetMinNonceLength(siv) <= 12);
TEST_CHECK(SIV_GetMaxNonceLength(siv) >= 12);
TEST_CHECK(SIV_GetMinNonceLength(siv) <= SIV_GetMaxNonceLength(siv));
if (fixed_nonce_length)
TEST_CHECK(SIV_GetMinNonceLength(siv) == SIV_GetMaxNonceLength(siv));
r = SIV_Encrypt(siv, tests[i].nonce, tests[i].nonce_length,
tests[i].assoc, tests[i].assoc_length,