mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 21:05:37 +01:00
Add a test of the OID->MD map functions
This commit is contained in:
parent
5d9c9636fa
commit
5ed7fff8ce
@ -7,10 +7,10 @@ Features
|
||||
rfc 5280 section 4.2.1.4.
|
||||
* It is now possible to use NIST key wrap mode via the mbedtls_cipher API.
|
||||
Contributed by Jack Lloyd and Fortanix Inc.
|
||||
* It is now possible to perform RSA PKCS v1.5 signatures with RIPEMD-160 digest.
|
||||
Contributed by Jack Lloyd and Fortanix Inc.
|
||||
* Add the Wi-SUN Field Area Network (FAN) device extended key usage.
|
||||
* Add the oid certificate policy x509 extension.
|
||||
* It is now possible to perform RSA PKCS v1.5 signatures with RIPEMD-160 digest.
|
||||
Contributed by Jack Lloyd and Fortanix Inc.
|
||||
|
||||
Bugfix
|
||||
* Fix private key DER output in the key_app_writer example. File contents
|
||||
|
@ -57,3 +57,35 @@ oid_get_x509_extension:"5533445566":0
|
||||
|
||||
OID get x509 extension - wrong oid - id-ce
|
||||
oid_get_x509_extension:"551D":0
|
||||
|
||||
OID hash id - id-md5
|
||||
depends_on:MBEDTLS_MD5_C
|
||||
oid_get_md_alg_id:"2A864886f70d0205":MBEDTLS_MD_MD5
|
||||
|
||||
OID hash id - id-sha1
|
||||
depends_on:MBEDTLS_SHA1_C
|
||||
oid_get_md_alg_id:"2b0e03021a":MBEDTLS_MD_SHA1
|
||||
|
||||
OID hash id - id-sha224
|
||||
depends_on:MBEDTLS_SHA256_C
|
||||
oid_get_md_alg_id:"608648016503040204":MBEDTLS_MD_SHA224
|
||||
|
||||
OID hash id - id-sha256
|
||||
depends_on:MBEDTLS_SHA256_C
|
||||
oid_get_md_alg_id:"608648016503040201":MBEDTLS_MD_SHA256
|
||||
|
||||
OID hash id - id-sha384
|
||||
depends_on:MBEDTLS_SHA512_C
|
||||
oid_get_md_alg_id:"608648016503040202":MBEDTLS_MD_SHA384
|
||||
|
||||
OID hash id - id-sha512
|
||||
depends_on:MBEDTLS_SHA512_C
|
||||
oid_get_md_alg_id:"608648016503040203":MBEDTLS_MD_SHA512
|
||||
|
||||
OID hash id - id-ripemd160
|
||||
depends_on:MBEDTLS_RIPEMD160_C
|
||||
oid_get_md_alg_id:"2b24030201":MBEDTLS_MD_RIPEMD160
|
||||
|
||||
OID hash id - invalid oid
|
||||
oid_get_md_alg_id:"2B864886f70d0204":-1
|
||||
|
||||
|
@ -78,3 +78,29 @@ void oid_get_x509_extension( data_t *oid, int exp_type )
|
||||
}
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void oid_get_md_alg_id( 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_alg( &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 */
|
||||
|
Loading…
Reference in New Issue
Block a user