57#if !defined(MBEDTLS_CONFIG_FILE)
60#include MBEDTLS_CONFIG_FILE
63#if defined(MBEDTLS_X509_CRL_PARSE_C)
71#if defined(MBEDTLS_PEM_PARSE_C)
75#if defined(MBEDTLS_PLATFORM_C)
80#define mbedtls_free free
81#define mbedtls_calloc calloc
82#define mbedtls_snprintf snprintf
85#if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32)
91#if defined(MBEDTLS_FS_IO) || defined(EFIX64) || defined(EFI32)
98static int x509_crl_get_version(
unsigned char **
p,
99 const unsigned char *
end,
125static int x509_get_crl_ext(
unsigned char **
p,
126 const unsigned char *
end,
152 const unsigned char *end_ext_data;
160 end_ext_data = *
p +
len;
172 &is_critical ) ) != 0 &&
185 if( *
p != end_ext_data )
205static int x509_get_crl_entry_ext(
unsigned char **
p,
206 const unsigned char *
end,
259static int x509_get_entries(
unsigned char **
p,
260 const unsigned char *
end,
279 end = *
p + entry_len;
284 const unsigned char *end2;
293 cur_entry->
raw.
p = *
p;
294 cur_entry->
raw.
len = len2;
304 if( (
ret = x509_get_crl_entry_ext(
p, end2,
315 cur_entry = cur_entry->
next;
326 const unsigned char *
buf,
size_t buflen )
347 while(
crl->version != 0 &&
crl->next !=
NULL )
377 crl->raw.len = buflen;
394 if(
len != (
size_t) (
end -
p ) )
422 if( (
ret = x509_crl_get_version( &
p,
end, &
crl->version ) ) != 0 ||
429 if(
crl->version < 0 ||
crl->version > 1 )
438 &
crl->sig_md, &
crl->sig_pk,
439 &
crl->sig_opts ) ) != 0 )
448 crl->issuer_raw.p =
p;
463 crl->issuer_raw.len =
p -
crl->issuer_raw.p;
495 if( (
ret = x509_get_entries( &
p,
end, &
crl->entry ) ) != 0 )
505 if(
crl->version == 2 )
507 ret = x509_get_crl_ext( &
p,
end, &
crl->crl_ext );
535 if(
crl->sig_oid.len != sig_oid2.
len ||
536 memcmp(
crl->sig_oid.p, sig_oid2.
p,
crl->sig_oid.len ) != 0 ||
537 sig_params1.
len != sig_params2.
len ||
538 ( sig_params1.
len != 0 &&
539 memcmp( sig_params1.
p, sig_params2.
p, sig_params1.
len ) != 0 ) )
566#if defined(MBEDTLS_PEM_PARSE_C)
569 mbedtls_pem_context pem;
577 mbedtls_pem_init( &pem );
581 if( buflen == 0 ||
buf[buflen - 1] !=
'\0' )
584 ret = mbedtls_pem_read_buffer( &pem,
585 "-----BEGIN X509 CRL-----",
586 "-----END X509 CRL-----",
600 pem.buf, pem.buflen ) ) != 0 )
602 mbedtls_pem_free( &pem );
608 mbedtls_pem_free( &pem );
612 mbedtls_pem_free( &pem );
616 while( is_pem && buflen > 1 );
625#if defined(MBEDTLS_FS_IO)
635 if( (
ret = mbedtls_pk_load_file(
path, &
buf, &
n ) ) != 0 )
650#define BEFORE_COLON 14
667 prefix,
crl->version );
676 "%04d-%02d-%02d %02d:%02d:%02d", prefix,
677 crl->this_update.year,
crl->this_update.mon,
678 crl->this_update.day,
crl->this_update.hour,
679 crl->this_update.min,
crl->this_update.sec );
683 "%04d-%02d-%02d %02d:%02d:%02d", prefix,
684 crl->next_update.year,
crl->next_update.mon,
685 crl->next_update.day,
crl->next_update.hour,
686 crl->next_update.min,
crl->next_update.sec );
705 "%04d-%02d-%02d %02d:%02d:%02d",
706 entry->revocation_date.year,
entry->revocation_date.mon,
707 entry->revocation_date.day,
entry->revocation_date.hour,
708 entry->revocation_date.min,
entry->revocation_date.sec );
724 return( (
int) (
size -
n ) );
752#if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT)
757 while( name_cur !=
NULL )
760 name_cur = name_cur->
next;
766 while( entry_cur !=
NULL )
768 entry_prv = entry_cur;
769 entry_cur = entry_cur->
next;
781 crl_cur = crl_cur->
next;
783 while( crl_cur !=
NULL );
789 crl_cur = crl_cur->
next;
795 while( crl_cur !=
NULL );
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
static const WCHAR *const ext[]
GLenum GLuint GLenum GLsizei const GLchar * buf
#define MBEDTLS_ASN1_OCTET_STRING
#define MBEDTLS_ERR_ASN1_OUT_OF_DATA
struct mbedtls_asn1_named_data * next
#define MBEDTLS_ASN1_SEQUENCE
int mbedtls_asn1_get_int(unsigned char **p, const unsigned char *end, int *val)
Retrieve an integer ASN.1 tag and its value. Updates the pointer to immediately behind the full tag.
#define MBEDTLS_ASN1_CONSTRUCTED
#define MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
#define MBEDTLS_ERR_ASN1_LENGTH_MISMATCH
int mbedtls_asn1_get_tag(unsigned char **p, const unsigned char *end, size_t *len, int tag)
Get the tag and length of the tag. Check for the requested tag. Updates the pointer to immediately be...
int mbedtls_asn1_get_bool(unsigned char **p, const unsigned char *end, int *val)
Retrieve a boolean ASN.1 tag and its value. Updates the pointer to immediately behind the full tag.
int mbedtls_x509_get_name(unsigned char **p, const unsigned char *end, mbedtls_x509_name *cur)
int mbedtls_x509_crl_parse_der(mbedtls_x509_crl *chain, const unsigned char *buf, size_t buflen)
Parse a DER-encoded CRL and append it to the chained list.
int mbedtls_x509_crl_info(char *buf, size_t size, const char *prefix, const mbedtls_x509_crl *crl)
Returns an informational string about the CRL.
#define MBEDTLS_ERR_X509_INVALID_FORMAT
#define MBEDTLS_ERR_X509_UNKNOWN_SIG_ALG
#define MBEDTLS_ERR_X509_INVALID_VERSION
int mbedtls_x509_dn_gets(char *buf, size_t size, const mbedtls_x509_name *dn)
Store the certificate DN in printable form into buf; no more than size characters will be written.
mbedtls_x509_buf entry_ext
struct mbedtls_x509_crl * next
void mbedtls_x509_crl_init(mbedtls_x509_crl *crl)
Initialize a CRL (chain)
mbedtls_x509_crl_entry entry
#define MBEDTLS_X509_SAFE_SNPRINTF
int mbedtls_x509_get_sig_alg(const mbedtls_x509_buf *sig_oid, const mbedtls_x509_buf *sig_params, mbedtls_md_type_t *md_alg, mbedtls_pk_type_t *pk_alg, void **sig_opts)
int mbedtls_x509_get_alg(unsigned char **p, const unsigned char *end, mbedtls_x509_buf *alg, mbedtls_x509_buf *params)
#define MBEDTLS_ERR_X509_INVALID_EXTENSIONS
int mbedtls_x509_get_ext(unsigned char **p, const unsigned char *end, mbedtls_x509_buf *ext, int tag)
#define MBEDTLS_ERR_X509_UNKNOWN_VERSION
mbedtls_x509_time revocation_date
struct mbedtls_x509_crl_entry * next
#define MBEDTLS_ERR_X509_INVALID_DATE
#define MBEDTLS_ERR_X509_SIG_MISMATCH
int mbedtls_x509_sig_alg_gets(char *buf, size_t size, const mbedtls_x509_buf *sig_oid, mbedtls_pk_type_t pk_alg, mbedtls_md_type_t md_alg, const void *sig_opts)
#define MBEDTLS_ERR_X509_ALLOC_FAILED
int mbedtls_x509_get_serial(unsigned char **p, const unsigned char *end, mbedtls_x509_buf *serial)
int mbedtls_x509_get_sig(unsigned char **p, const unsigned char *end, mbedtls_x509_buf *sig)
int mbedtls_x509_get_time(unsigned char **p, const unsigned char *end, mbedtls_x509_time *t)
int mbedtls_x509_crl_parse(mbedtls_x509_crl *chain, const unsigned char *buf, size_t buflen)
Parse one or more CRLs and append them to the chained list.
void mbedtls_x509_crl_free(mbedtls_x509_crl *crl)
Unallocate all CRL data.
#define MBEDTLS_ERR_X509_BAD_INPUT_DATA
int mbedtls_x509_serial_gets(char *buf, size_t size, const mbedtls_x509_buf *serial)
Store the certificate serial in printable form into buf; no more than size characters will be written...
#define memcpy(s1, s2, n)
Object Identifier (OID) database.
Privacy Enhanced Mail (PEM) decoding.
#define MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT
Configuration options (set of defines)
X.509 certificate revocation list parsing.