From 77c0c8e9a2a9d0b34f8ded1f0797799270f82080 Mon Sep 17 00:00:00 2001 From: Andres Amaya Garcia Date: Fri, 25 Aug 2017 12:50:48 +0100 Subject: [PATCH] Parse signatureAlgorithm of OCSP response Populate the function x509_ocsp_get_sig_alg() that parses the signatureAlgorithm from the BasicOCSPResponse ASN.1 structure. The parsing is actually done by the preexisting functions: * mbedtls_x509_get_alg() * mbedtls_x509_get_sig_alg() --- library/x509_ocsp.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/library/x509_ocsp.c b/library/x509_ocsp.c index db3ae48cbb..a478188e77 100644 --- a/library/x509_ocsp.c +++ b/library/x509_ocsp.c @@ -763,6 +763,22 @@ static int x509_ocsp_get_sig_alg( mbedtls_x509_ocsp_response *resp, unsigned char **p, const unsigned char *end ) { + int ret; + mbedtls_x509_buf sig_params; + + if( ( ret = mbedtls_x509_get_alg( p, end, &resp->sig_oid, + &sig_params ) ) != 0 ) + { + return( ret ); + } + + if( ( ret = mbedtls_x509_get_sig_alg( &resp->sig_oid, &sig_params, + &resp->sig_md, &resp->sig_pk, + &resp->sig_opts ) ) != 0 ) + { + return( ret ); + } + return( 0 ); }