mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-04-05 20:15:36 +02:00
Parse OCSP ResponseType OID
Parse the OCSP ResponseType OID contained in the ResponseBytes.
This commit is contained in:
committed by
Andres Amaya Garcia
parent
cd5d0aaa59
commit
f4d32f695f
@@ -36,7 +36,8 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define MBEDTLS_ERR_X509_OCSP_INVALID_RESPONSE_STATUS -0x9010 /**< The OCSP response status is invalid */
|
||||
#define MBEDTLS_ERR_X509_OCSP_INVALID_RESPONSE_STATUS -0x2A00 /**< The OCSP response status is invalid */
|
||||
#define MBEDTLS_ERR_X509_OCSP_INVALID_RESPONSE_TYPE -0x2A10 /**< The OCSP response type is invalid */
|
||||
|
||||
/* OCSP response status values as defined in RFC 6960 Section 4.2.1 */
|
||||
#define MBEDTLS_X509_OCSP_RESPONSE_STATUS_SUCCESSFUL 0
|
||||
|
||||
@@ -92,6 +92,24 @@ static int x509_ocsp_get_response_type( unsigned char **p,
|
||||
const unsigned char *end,
|
||||
mbedtls_x509_buf *resp_type )
|
||||
{
|
||||
int ret;
|
||||
size_t len;
|
||||
|
||||
if( ( ret = mbedtls_asn1_get_tag( p, end, &len, MBEDTLS_ASN1_OID ) ) != 0 )
|
||||
return( MBEDTLS_ERR_X509_INVALID_FORMAT + ret );
|
||||
|
||||
resp_type->tag = MBEDTLS_ASN1_OID;
|
||||
resp_type->len = len;
|
||||
resp_type->p = *p;
|
||||
|
||||
if( MBEDTLS_OID_CMP( MBEDTLS_OID_OCSP, resp_type ) != 0 &&
|
||||
MBEDTLS_OID_CMP( MBEDTLS_OID_OCSP_BASIC, resp_type ) != 0 )
|
||||
{
|
||||
return( MBEDTLS_ERR_X509_OCSP_INVALID_RESPONSE_TYPE );
|
||||
}
|
||||
|
||||
*p = *p + len;
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user