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

Fix nonce size for AES-GCM #283

Merged
merged 2 commits into from
Jul 18, 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
16 changes: 8 additions & 8 deletions src/t_cose_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,20 +256,20 @@ uint32_t
bits_iv_alg(int32_t cose_algorithm_id)
{
switch(cose_algorithm_id) {
case T_COSE_ALGORITHM_AES128CCM_16_128:
case T_COSE_ALGORITHM_A128KW:
case T_COSE_ALGORITHM_A128GCM:
case T_COSE_ALGORITHM_A192GCM:
case T_COSE_ALGORITHM_A256GCM:
return 96; /* 12 bytes, 4.1 of RFC 9053 */
case T_COSE_ALGORITHM_AES128CCM_16_128:
case T_COSE_ALGORITHM_AES256CCM_16_128:
return 104; /* 13 bytes, 4.2 of RFC 9053 */
case T_COSE_ALGORITHM_A128CTR:
case T_COSE_ALGORITHM_A128CBC:
case T_COSE_ALGORITHM_A192CTR:
case T_COSE_ALGORITHM_A192CBC:
case T_COSE_ALGORITHM_A256CTR:
case T_COSE_ALGORITHM_A256CBC: return 128;
case T_COSE_ALGORITHM_A192KW:
case T_COSE_ALGORITHM_A192GCM: return 192;
case T_COSE_ALGORITHM_AES256CCM_16_128:
case T_COSE_ALGORITHM_A256KW:
case T_COSE_ALGORITHM_A256GCM: return 256;
case T_COSE_ALGORITHM_A256CBC:
return 128; /* 16 bytes, the same length of the AES block size */
default: return UINT32_MAX;
}
}
Expand Down
Loading