x509_crt.c File Reference

#include "polarssl/config.h"
#include "polarssl/x509_crt.h"
#include "polarssl/oid.h"
#include "polarssl/pem.h"
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
Include dependency graph for x509_crt.c:

Go to the source code of this file.

Defines

#define polarssl_malloc   malloc
#define polarssl_free   free
#define POLARSSL_ERR_DEBUG_BUF_TOO_SMALL   -2
#define SAFE_SNPRINTF()
#define BEFORE_COLON   14
#define BC   "14"

Functions

static int x509_get_version (unsigned char **p, const unsigned char *end, int *ver)
static int x509_get_dates (unsigned char **p, const unsigned char *end, x509_time *from, x509_time *to)
static int x509_get_uid (unsigned char **p, const unsigned char *end, x509_buf *uid, int n)
static int x509_get_basic_constraints (unsigned char **p, const unsigned char *end, int *ca_istrue, int *max_pathlen)
static int x509_get_ns_cert_type (unsigned char **p, const unsigned char *end, unsigned char *ns_cert_type)
static int x509_get_key_usage (unsigned char **p, const unsigned char *end, unsigned char *key_usage)
static int x509_get_ext_key_usage (unsigned char **p, const unsigned char *end, x509_sequence *ext_key_usage)
static int x509_get_subject_alt_name (unsigned char **p, const unsigned char *end, x509_sequence *subject_alt_name)
static int x509_get_crt_ext (unsigned char **p, const unsigned char *end, x509_crt *crt)
static int x509_crt_parse_der_core (x509_crt *crt, const unsigned char *buf, size_t buflen)
int x509_crt_parse_der (x509_crt *chain, const unsigned char *buf, size_t buflen)
 Parse a single DER formatted certificate and add it to the chained list.
int x509_crt_parse (x509_crt *chain, const unsigned char *buf, size_t buflen)
 Parse one or more certificates and add them to the chained list.
int x509_crt_parse_file (x509_crt *chain, const char *path)
 Load one or more certificates and add them to the chained list.
int x509_crt_parse_path (x509_crt *chain, const char *path)
 Load one or more certificate files from a path and add them to the chained list.
int x509_crt_info (char *buf, size_t size, const char *prefix, const x509_crt *crt)
 Returns an informational string about the certificate.
int x509_crt_revoked (const x509_crt *crt, const x509_crl *crl)
 Verify the certificate revocation status.
static int x509_crt_verifycrl (x509_crt *crt, x509_crt *ca, x509_crl *crl_list)
static int x509_name_cmp (const void *s1, const void *s2, size_t len)
static int x509_wildcard_verify (const char *cn, x509_buf *name)
static int x509_crt_verify_top (x509_crt *child, x509_crt *trust_ca, x509_crl *ca_crl, int path_cnt, int *flags, int(*f_vrfy)(void *, x509_crt *, int, int *), void *p_vrfy)
static int x509_crt_verify_child (x509_crt *child, x509_crt *parent, x509_crt *trust_ca, x509_crl *ca_crl, int path_cnt, int *flags, int(*f_vrfy)(void *, x509_crt *, int, int *), void *p_vrfy)
int x509_crt_verify (x509_crt *crt, x509_crt *trust_ca, x509_crl *ca_crl, const char *cn, int *flags, int(*f_vrfy)(void *, x509_crt *, int, int *), void *p_vrfy)
 Verify the certificate signature.
void x509_crt_init (x509_crt *crt)
 Initialize a certificate (chain).
void x509_crt_free (x509_crt *crt)
 Unallocate all certificate data.

Define Documentation

#define BC   "14"

Definition at line 1098 of file x509_crt.c.

#define BEFORE_COLON   14

Definition at line 1097 of file x509_crt.c.

#define POLARSSL_ERR_DEBUG_BUF_TOO_SMALL   -2

Definition at line 1078 of file x509_crt.c.

#define polarssl_free   free

Definition at line 51 of file x509_crt.c.

#define polarssl_malloc   malloc

Definition at line 50 of file x509_crt.c.

 
#define SAFE_SNPRINTF (  ) 
Value:
{                                               \
    if( ret == -1 )                             \
        return( -1 );                           \
                                                \
    if ( (unsigned int) ret > n ) {             \
        p[n - 1] = '\0';                        \
        return POLARSSL_ERR_DEBUG_BUF_TOO_SMALL;\
    }                                           \
                                                \
    n -= (unsigned int) ret;                    \
    p += (unsigned int) ret;                    \
}

Definition at line 1080 of file x509_crt.c.


Function Documentation

static int x509_crt_parse_der_core ( x509_crt crt,
const unsigned char *  buf,
size_t  buflen 
) [static]
static int x509_crt_verify_child ( x509_crt child,
x509_crt parent,
x509_crt trust_ca,
x509_crl ca_crl,
int  path_cnt,
int *  flags,
int(*)(void *, x509_crt *, int, int *)  f_vrfy,
void *  p_vrfy 
) [static]
static int x509_crt_verify_top ( x509_crt child,
x509_crt trust_ca,
x509_crl ca_crl,
int  path_cnt,
int *  flags,
int(*)(void *, x509_crt *, int, int *)  f_vrfy,
void *  p_vrfy 
) [static]
static int x509_crt_verifycrl ( x509_crt crt,
x509_crt ca,
x509_crl crl_list 
) [static]
static int x509_get_basic_constraints ( unsigned char **  p,
const unsigned char *  end,
int *  ca_istrue,
int *  max_pathlen 
) [static]
static int x509_get_crt_ext ( unsigned char **  p,
const unsigned char *  end,
x509_crt crt 
) [static]
static int x509_get_dates ( unsigned char **  p,
const unsigned char *  end,
x509_time from,
x509_time to 
) [static]
static int x509_get_ext_key_usage ( unsigned char **  p,
const unsigned char *  end,
x509_sequence ext_key_usage 
) [static]
static int x509_get_key_usage ( unsigned char **  p,
const unsigned char *  end,
unsigned char *  key_usage 
) [static]
static int x509_get_ns_cert_type ( unsigned char **  p,
const unsigned char *  end,
unsigned char *  ns_cert_type 
) [static]
static int x509_get_subject_alt_name ( unsigned char **  p,
const unsigned char *  end,
x509_sequence subject_alt_name 
) [static]
static int x509_get_uid ( unsigned char **  p,
const unsigned char *  end,
x509_buf uid,
int  n 
) [static]
static int x509_get_version ( unsigned char **  p,
const unsigned char *  end,
int *  ver 
) [static]
static int x509_name_cmp ( const void *  s1,
const void *  s2,
size_t  len 
) [static]

Definition at line 1266 of file x509_crt.c.

Referenced by x509_crt_verify(), and x509_wildcard_verify().

static int x509_wildcard_verify ( const char *  cn,
x509_buf name 
) [static]

Definition at line 1288 of file x509_crt.c.

References _asn1_buf::len, _asn1_buf::p, and x509_name_cmp().

Referenced by x509_crt_verify().


Generated on 9 Apr 2014 for PolarSSL v1.3.2 by  doxygen 1.6.1