Add OID tests for HMAC-xxx
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
f2e3eb8bd9
commit
a0f81e8ef8
2 changed files with 63 additions and 0 deletions
|
@ -201,3 +201,43 @@ oid_from_numeric_string:"2.4294967215":0:"8FFFFFFF7F"
|
|||
|
||||
OID from numeric string - OID with overflowing subidentifier
|
||||
oid_from_numeric_string:"2.4294967216":MBEDTLS_ERR_ASN1_INVALID_DATA:""
|
||||
|
||||
mbedtls_oid_get_md_hmac - RIPEMD160
|
||||
depends_on:MBEDTLS_MD_CAN_RIPEMD160
|
||||
mbedtls_oid_get_md_hmac:"2B06010505080104":MBEDTLS_MD_RIPEMD160
|
||||
|
||||
mbedtls_oid_get_md_hmac - SHA1
|
||||
depends_on:MBEDTLS_MD_CAN_SHA1
|
||||
mbedtls_oid_get_md_hmac:"2A864886F70D0207":MBEDTLS_MD_SHA1
|
||||
|
||||
mbedtls_oid_get_md_hmac - SHA224
|
||||
depends_on:MBEDTLS_MD_CAN_SHA224
|
||||
mbedtls_oid_get_md_hmac:"2A864886F70D0208":MBEDTLS_MD_SHA224
|
||||
|
||||
mbedtls_oid_get_md_hmac - SHA256
|
||||
depends_on:MBEDTLS_MD_CAN_SHA256
|
||||
mbedtls_oid_get_md_hmac:"2A864886F70D0209":MBEDTLS_MD_SHA256
|
||||
|
||||
mbedtls_oid_get_md_hmac - SHA384
|
||||
depends_on:MBEDTLS_MD_CAN_SHA384
|
||||
mbedtls_oid_get_md_hmac:"2A864886F70D020A":MBEDTLS_MD_SHA384
|
||||
|
||||
mbedtls_oid_get_md_hmac - SHA512
|
||||
depends_on:MBEDTLS_MD_CAN_SHA512
|
||||
mbedtls_oid_get_md_hmac:"2A864886F70D020B":MBEDTLS_MD_SHA512
|
||||
|
||||
mbedtls_oid_get_md_hmac - SHA3_224
|
||||
depends_on:MBEDTLS_MD_CAN_SHA3_224
|
||||
mbedtls_oid_get_md_hmac:"60864801650304020D":MBEDTLS_MD_SHA3_224
|
||||
|
||||
mbedtls_oid_get_md_hmac - SHA3_256
|
||||
depends_on:MBEDTLS_MD_CAN_SHA3_256
|
||||
mbedtls_oid_get_md_hmac:"60864801650304020E":MBEDTLS_MD_SHA3_256
|
||||
|
||||
mbedtls_oid_get_md_hmac - SHA3_384
|
||||
depends_on:MBEDTLS_MD_CAN_SHA3_384
|
||||
mbedtls_oid_get_md_hmac:"60864801650304020F":MBEDTLS_MD_SHA3_384
|
||||
|
||||
mbedtls_oid_get_md_hmac - SHA3_512
|
||||
depends_on:MBEDTLS_MD_CAN_SHA3_512
|
||||
mbedtls_oid_get_md_hmac:"608648016503040210":MBEDTLS_MD_SHA3_512
|
||||
|
|
|
@ -96,6 +96,29 @@ void oid_get_md_alg_id(data_t *oid, int exp_md_id)
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void mbedtls_oid_get_md_hmac(data_t *oid, int exp_md_id)
|
||||
{
|
||||
mbedtls_asn1_buf md_oid = { 0, 0, NULL };
|
||||
int ret;
|
||||
mbedtls_md_type_t md_id = 0;
|
||||
|
||||
md_oid.tag = MBEDTLS_ASN1_OID;
|
||||
md_oid.p = oid->x;
|
||||
md_oid.len = oid->len;
|
||||
|
||||
ret = mbedtls_oid_get_md_hmac(&md_oid, &md_id);
|
||||
|
||||
if (exp_md_id < 0) {
|
||||
TEST_ASSERT(ret == MBEDTLS_ERR_OID_NOT_FOUND);
|
||||
TEST_ASSERT(md_id == 0);
|
||||
} else {
|
||||
TEST_ASSERT(ret == 0);
|
||||
TEST_ASSERT((mbedtls_md_type_t) exp_md_id == md_id);
|
||||
}
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void oid_get_numeric_string(data_t *oid, int error_ret, char *result_str)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue