@ -297,10 +297,10 @@ static bool GetConfig(const Span<const uint8_t> args[], ReplyCallback write_repl
" direction " : [ " encrypt " , " decrypt " ] ,
" keyLen " : [ 128 , 192 , 256 ] ,
" payloadLen " : [ {
" min " : 0 , " max " : 25 6, " increment " : 8
" min " : 0 , " max " : 6553 6, " increment " : 8
} ] ,
" aadLen " : [ {
" min " : 0 , " max " : 320 , " increment " : 8
" min " : 0 , " max " : 65536 , " increment " : 8
} ] ,
" tagLen " : [ 32 , 64 , 96 , 104 , 112 , 120 , 128 ] ,
" ivLen " : [ 96 ] ,
@ -312,10 +312,10 @@ static bool GetConfig(const Span<const uint8_t> args[], ReplyCallback write_repl
" direction " : [ " encrypt " , " decrypt " ] ,
" keyLen " : [ 128 , 192 , 256 ] ,
" payloadLen " : [ {
" min " : 0 , " max " : 25 6, " increment " : 8
" min " : 0 , " max " : 6553 6, " increment " : 8
} ] ,
" aadLen " : [ {
" min " : 0 , " max " : 320 , " increment " : 8
" min " : 0 , " max " : 65536 , " increment " : 8
} ] ,
" tagLen " : [ 32 , 64 , 96 , 104 , 112 , 120 , 128 ] ,
" ivLen " : [ 96 ] ,
@ -334,7 +334,7 @@ static bool GetConfig(const Span<const uint8_t> args[], ReplyCallback write_repl
" keyLen " : [
128 , 192 , 256
] ,
" payloadLen " : [ { " min " : 128 , " max " : 102 4, " increment " : 64 } ]
" payloadLen " : [ { " min " : 128 , " max " : 4096 , " increment " : 64 } ]
} ,
{
" algorithm " : " ACVP-AES-KWP " ,
@ -363,14 +363,14 @@ static bool GetConfig(const Span<const uint8_t> args[], ReplyCallback write_repl
] ,
" payloadLen " : [ { " min " : 0 , " max " : 256 , " increment " : 8 } ] ,
" ivLen " : [ 104 ] ,
" tagLen " : [ 32 ] ,
" aadLen " : [ { " min " : 0 , " max " : 1024 , " increment " : 8 } ]
" tagLen " : [ 32 , 64 ] ,
" aadLen " : [ { " min " : 0 , " max " : 524288 , " increment " : 8 } ]
} ,
{
" algorithm " : " HMAC-SHA-1 " ,
" revision " : " 1.0 " ,
" keyLen " : [ {
" min " : 8 , " max " : 20 48 , " increment " : 8
" min " : 8 , " max " : 5 2428 8, " increment " : 8
} ] ,
" macLen " : [ {
" min " : 32 , " max " : 160 , " increment " : 8
@ -380,7 +380,7 @@ static bool GetConfig(const Span<const uint8_t> args[], ReplyCallback write_repl
" algorithm " : " HMAC-SHA2-224 " ,
" revision " : " 1.0 " ,
" keyLen " : [ {
" min " : 8 , " max " : 20 48 , " increment " : 8
" min " : 8 , " max " : 5 2428 8, " increment " : 8
} ] ,
" macLen " : [ {
" min " : 32 , " max " : 224 , " increment " : 8
@ -390,7 +390,7 @@ static bool GetConfig(const Span<const uint8_t> args[], ReplyCallback write_repl
" algorithm " : " HMAC-SHA2-256 " ,
" revision " : " 1.0 " ,
" keyLen " : [ {
" min " : 8 , " max " : 20 48 , " increment " : 8
" min " : 8 , " max " : 5 2428 8, " increment " : 8
} ] ,
" macLen " : [ {
" min " : 32 , " max " : 256 , " increment " : 8
@ -400,7 +400,7 @@ static bool GetConfig(const Span<const uint8_t> args[], ReplyCallback write_repl
" algorithm " : " HMAC-SHA2-384 " ,
" revision " : " 1.0 " ,
" keyLen " : [ {
" min " : 8 , " max " : 20 48 , " increment " : 8
" min " : 8 , " max " : 5 2428 8, " increment " : 8
} ] ,
" macLen " : [ {
" min " : 32 , " max " : 384 , " increment " : 8
@ -410,7 +410,7 @@ static bool GetConfig(const Span<const uint8_t> args[], ReplyCallback write_repl
" algorithm " : " HMAC-SHA2-512 " ,
" revision " : " 1.0 " ,
" keyLen " : [ {
" min " : 8 , " max " : 20 48 , " increment " : 8
" min " : 8 , " max " : 5 2428 8, " increment " : 8
} ] ,
" macLen " : [ {
" min " : 32 , " max " : 512 , " increment " : 8
@ -420,7 +420,7 @@ static bool GetConfig(const Span<const uint8_t> args[], ReplyCallback write_repl
" algorithm " : " HMAC-SHA2-512/256 " ,
" revision " : " 1.0 " ,
" keyLen " : [ {
" min " : 8 , " max " : 20 48 , " increment " : 8
" min " : 8 , " max " : 5 2428 8, " increment " : 8
} ] ,
" macLen " : [ {
" min " : 32 , " max " : 256 , " increment " : 8
@ -821,12 +821,12 @@ static bool GetConfig(const Span<const uint8_t> args[], ReplyCallback write_repl
" direction " : [ " gen " , " ver " ] ,
" msgLen " : [ {
" min " : 0 ,
" max " : 65536 ,
" max " : 524288 ,
" increment " : 8
} ] ,
" keyLen " : [ 128 , 256 ] ,
" macLen " : [ {
" min " : 32 ,
" min " : 8 ,
" max " : 128 ,
" increment " : 8
} ]
@ -1096,10 +1096,21 @@ static bool AESCCMSetup(EVP_AEAD_CTX *ctx, Span<const uint8_t> tag_len_span,
return false ;
}
memcpy ( & tag_len_32 , tag_len_span . data ( ) , sizeof ( tag_len_32 ) ) ;
if ( tag_len_32 ! = 4 ) {
LOG_ERROR ( " AES-CCM only supports 4-byte tags, but %u was requested \n " ,
static_cast < unsigned > ( tag_len_32 ) ) ;
return false ;
const EVP_AEAD * aead ;
switch ( tag_len_32 ) {
case 4 :
aead = EVP_aead_aes_128_ccm_bluetooth ( ) ;
break ;
case 8 :
aead = EVP_aead_aes_128_ccm_bluetooth_8 ( ) ;
break ;
default :
LOG_ERROR (
" AES-CCM only supports 4- and 8-byte tags, but %u was requested \n " ,
static_cast < unsigned > ( tag_len_32 ) ) ;
return false ;
}
if ( key . size ( ) ! = 16 ) {
@ -1108,8 +1119,8 @@ static bool AESCCMSetup(EVP_AEAD_CTX *ctx, Span<const uint8_t> tag_len_span,
return false ;
}
if ( ! EVP_AEAD_CTX_init ( ctx , EVP_aead_aes_128_ccm_bluetooth ( ) , key . data ( ) ,
key . size ( ) , tag_len_32 , nullptr ) ) {
if ( ! EVP_AEAD_CTX_init ( ctx , aead , key . data ( ) , key . size ( ) , tag_len_32 ,
nullptr ) ) {
LOG_ERROR ( " Failed to setup AES-CCM with tag length %u \n " ,
static_cast < unsigned > ( tag_len_32 ) ) ;
return false ;