diff --git a/include/mbedtls/asn1.h b/include/mbedtls/asn1.h index 6b791966f..d2162fe12 100644 --- a/include/mbedtls/asn1.h +++ b/include/mbedtls/asn1.h @@ -578,7 +578,7 @@ int mbedtls_asn1_get_alg_null( unsigned char **p, * * \return NULL if not found, or a pointer to the existing entry. */ -mbedtls_asn1_named_data *mbedtls_asn1_find_named_data( mbedtls_asn1_named_data *list, +const mbedtls_asn1_named_data *mbedtls_asn1_find_named_data( const mbedtls_asn1_named_data *list, const char *oid, size_t len ); /** diff --git a/library/asn1parse.c b/library/asn1parse.c index 22747d3ba..83c7c58a1 100644 --- a/library/asn1parse.c +++ b/library/asn1parse.c @@ -461,7 +461,7 @@ void mbedtls_asn1_free_named_data_list( mbedtls_asn1_named_data **head ) } } -mbedtls_asn1_named_data *mbedtls_asn1_find_named_data( mbedtls_asn1_named_data *list, +const mbedtls_asn1_named_data *mbedtls_asn1_find_named_data( const mbedtls_asn1_named_data *list, const char *oid, size_t len ) { while( list != NULL ) diff --git a/tests/suites/test_suite_asn1parse.function b/tests/suites/test_suite_asn1parse.function index 990f343a7..4d179ea49 100644 --- a/tests/suites/test_suite_asn1parse.function +++ b/tests/suites/test_suite_asn1parse.function @@ -718,7 +718,7 @@ void find_named_data( data_t *oid0, data_t *oid1, data_t *oid2, data_t *oid3, }; mbedtls_asn1_named_data *pointers[ARRAY_LENGTH( nd ) + 1]; size_t i; - mbedtls_asn1_named_data *found; + const mbedtls_asn1_named_data *found; for( i = 0; i < ARRAY_LENGTH( nd ); i++ ) pointers[i] = &nd[i]; @@ -726,7 +726,7 @@ void find_named_data( data_t *oid0, data_t *oid1, data_t *oid2, data_t *oid3, for( i = 0; i < ARRAY_LENGTH( nd ); i++ ) nd[i].next = pointers[i+1]; - found = mbedtls_asn1_find_named_data( pointers[from], + found = mbedtls_asn1_find_named_data( (const mbedtls_asn1_named_data*) pointers[from], (const char *) needle->x, needle->len ); TEST_ASSERT( found == pointers[position] );