Commit c559c7a6 authored by Paul Bakker's avatar Paul Bakker
Browse files

Renamed x509_cert structure to x509_crt for consistency

parent 9556d3d6
...@@ -203,6 +203,8 @@ inline int x509parse_time_expired( const x509_time *time ) { ...@@ -203,6 +203,8 @@ inline int x509parse_time_expired( const x509_time *time ) {
#if defined(POLARSSL_X509_CRT_PARSE_C) #if defined(POLARSSL_X509_CRT_PARSE_C)
#define POLARSSL_X509_PARSE_C #define POLARSSL_X509_PARSE_C
#include "x509_crt.h" #include "x509_crt.h"
typedef x509_crt x509_cert;
inline int x509parse_crt_der( x509_cert *chain, const unsigned char *buf, inline int x509parse_crt_der( x509_cert *chain, const unsigned char *buf,
size_t buflen ) { size_t buflen ) {
return x509_crt_parse_der( chain, buf, buflen ); return x509_crt_parse_der( chain, buf, buflen );
......
...@@ -102,7 +102,7 @@ void debug_print_ecp( const ssl_context *ssl, int level, ...@@ -102,7 +102,7 @@ void debug_print_ecp( const ssl_context *ssl, int level,
#if defined(POLARSSL_X509_CRT_PARSE_C) #if defined(POLARSSL_X509_CRT_PARSE_C)
void debug_print_crt( const ssl_context *ssl, int level, void debug_print_crt( const ssl_context *ssl, int level,
const char *file, int line, const char *file, int line,
const char *text, const x509_cert *crt ); const char *text, const x509_crt *crt );
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#if defined(POLARSSL_PKCS11_C) #if defined(POLARSSL_PKCS11_C)
#include "x509.h" #include "x509_crt.h"
#include <pkcs11-helper-1.0/pkcs11h-certificate.h> #include <pkcs11-helper-1.0/pkcs11h-certificate.h>
...@@ -65,7 +65,7 @@ typedef struct { ...@@ -65,7 +65,7 @@ typedef struct {
* *
* \return 0 on success. * \return 0 on success.
*/ */
int pkcs11_x509_cert_init( x509_cert *cert, pkcs11h_certificate_t pkcs11h_cert ); int pkcs11_x509_cert_init( x509_crt *cert, pkcs11h_certificate_t pkcs11h_cert );
/** /**
* Initialise a pkcs11_context, storing the given certificate. Note that the * Initialise a pkcs11_context, storing the given certificate. Note that the
......
...@@ -411,7 +411,7 @@ struct _ssl_session ...@@ -411,7 +411,7 @@ struct _ssl_session
unsigned char master[48]; /*!< the master secret */ unsigned char master[48]; /*!< the master secret */
#if defined(POLARSSL_X509_CRT_PARSE_C) #if defined(POLARSSL_X509_CRT_PARSE_C)
x509_cert *peer_cert; /*!< peer X.509 cert chain */ x509_crt *peer_cert; /*!< peer X.509 cert chain */
#endif /* POLARSSL_X509_CRT_PARSE_C */ #endif /* POLARSSL_X509_CRT_PARSE_C */
int verify_result; /*!< verification result */ int verify_result; /*!< verification result */
...@@ -584,7 +584,7 @@ struct _ssl_context ...@@ -584,7 +584,7 @@ struct _ssl_context
#endif #endif
#if defined(POLARSSL_X509_CRT_PARSE_C) #if defined(POLARSSL_X509_CRT_PARSE_C)
int (*f_vrfy)(void *, x509_cert *, int, int *); int (*f_vrfy)(void *, x509_crt *, int, int *);
void *p_vrfy; /*!< context for verification */ void *p_vrfy; /*!< context for verification */
#endif #endif
...@@ -647,8 +647,8 @@ struct _ssl_context ...@@ -647,8 +647,8 @@ struct _ssl_context
int pk_key_own_alloc; /*!< did we allocate pk_key? */ int pk_key_own_alloc; /*!< did we allocate pk_key? */
#if defined(POLARSSL_X509_CRT_PARSE_C) #if defined(POLARSSL_X509_CRT_PARSE_C)
x509_cert *own_cert; /*!< own X.509 certificate */ x509_crt *own_cert; /*!< own X.509 certificate */
x509_cert *ca_chain; /*!< own trusted CA chain */ x509_crt *ca_chain; /*!< own trusted CA chain */
const char *peer_cn; /*!< expected peer CN */ const char *peer_cn; /*!< expected peer CN */
#endif /* POLARSSL_X509_CRT_PARSE_C */ #endif /* POLARSSL_X509_CRT_PARSE_C */
#if defined(POLARSSL_X509_CRL_PARSE_C) #if defined(POLARSSL_X509_CRL_PARSE_C)
...@@ -825,7 +825,7 @@ void ssl_set_authmode( ssl_context *ssl, int authmode ); ...@@ -825,7 +825,7 @@ void ssl_set_authmode( ssl_context *ssl, int authmode );
* \param p_vrfy verification parameter * \param p_vrfy verification parameter
*/ */
void ssl_set_verify( ssl_context *ssl, void ssl_set_verify( ssl_context *ssl,
int (*f_vrfy)(void *, x509_cert *, int, int *), int (*f_vrfy)(void *, x509_crt *, int, int *),
void *p_vrfy ); void *p_vrfy );
#endif /* POLARSSL_X509_CRT_PARSE_C */ #endif /* POLARSSL_X509_CRT_PARSE_C */
...@@ -956,7 +956,7 @@ void ssl_set_ciphersuites_for_version( ssl_context *ssl, ...@@ -956,7 +956,7 @@ void ssl_set_ciphersuites_for_version( ssl_context *ssl,
* \param ca_crl trusted CA CRLs * \param ca_crl trusted CA CRLs
* \param peer_cn expected peer CommonName (or NULL) * \param peer_cn expected peer CommonName (or NULL)
*/ */
void ssl_set_ca_chain( ssl_context *ssl, x509_cert *ca_chain, void ssl_set_ca_chain( ssl_context *ssl, x509_crt *ca_chain,
x509_crl *ca_crl, const char *peer_cn ); x509_crl *ca_crl, const char *peer_cn );
/** /**
...@@ -970,7 +970,7 @@ void ssl_set_ca_chain( ssl_context *ssl, x509_cert *ca_chain, ...@@ -970,7 +970,7 @@ void ssl_set_ca_chain( ssl_context *ssl, x509_cert *ca_chain,
* \param own_cert own public certificate chain * \param own_cert own public certificate chain
* \param pk_key own private key * \param pk_key own private key
*/ */
void ssl_set_own_cert( ssl_context *ssl, x509_cert *own_cert, void ssl_set_own_cert( ssl_context *ssl, x509_crt *own_cert,
pk_context *pk_key ); pk_context *pk_key );
#if defined(POLARSSL_RSA_C) #if defined(POLARSSL_RSA_C)
...@@ -987,7 +987,7 @@ void ssl_set_own_cert( ssl_context *ssl, x509_cert *own_cert, ...@@ -987,7 +987,7 @@ void ssl_set_own_cert( ssl_context *ssl, x509_cert *own_cert,
* *
* \return 0 on success, or a specific error code. * \return 0 on success, or a specific error code.
*/ */
int ssl_set_own_cert_rsa( ssl_context *ssl, x509_cert *own_cert, int ssl_set_own_cert_rsa( ssl_context *ssl, x509_crt *own_cert,
rsa_context *rsa_key ); rsa_context *rsa_key );
#endif /* POLARSSL_RSA_C */ #endif /* POLARSSL_RSA_C */
...@@ -1012,7 +1012,7 @@ int ssl_set_own_cert_rsa( ssl_context *ssl, x509_cert *own_cert, ...@@ -1012,7 +1012,7 @@ int ssl_set_own_cert_rsa( ssl_context *ssl, x509_cert *own_cert,
* *
* \return 0 on success, or a specific error code. * \return 0 on success, or a specific error code.
*/ */
int ssl_set_own_cert_alt( ssl_context *ssl, x509_cert *own_cert, int ssl_set_own_cert_alt( ssl_context *ssl, x509_crt *own_cert,
void *rsa_key, void *rsa_key,
rsa_decrypt_func rsa_decrypt, rsa_decrypt_func rsa_decrypt,
rsa_sign_func rsa_sign, rsa_sign_func rsa_sign,
...@@ -1293,7 +1293,7 @@ const char *ssl_get_version( const ssl_context *ssl ); ...@@ -1293,7 +1293,7 @@ const char *ssl_get_version( const ssl_context *ssl );
* *
* \return the current peer certificate * \return the current peer certificate
*/ */
const x509_cert *ssl_get_peer_cert( const ssl_context *ssl ); const x509_crt *ssl_get_peer_cert( const ssl_context *ssl );
#endif /* POLARSSL_X509_CRT_PARSE_C */ #endif /* POLARSSL_X509_CRT_PARSE_C */
/** /**
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
#define POLARSSL_ERR_X509_INVALID_EXTENSIONS -0x2500 /**< The extension tag or value is invalid. */ #define POLARSSL_ERR_X509_INVALID_EXTENSIONS -0x2500 /**< The extension tag or value is invalid. */
#define POLARSSL_ERR_X509_UNKNOWN_VERSION -0x2580 /**< CRT/CRL/CSR has an unsupported version number. */ #define POLARSSL_ERR_X509_UNKNOWN_VERSION -0x2580 /**< CRT/CRL/CSR has an unsupported version number. */
#define POLARSSL_ERR_X509_UNKNOWN_SIG_ALG -0x2600 /**< Signature algorithm (oid) is unsupported. */ #define POLARSSL_ERR_X509_UNKNOWN_SIG_ALG -0x2600 /**< Signature algorithm (oid) is unsupported. */
#define POLARSSL_ERR_X509_SIG_MISMATCH -0x2680 /**< Signature algorithms do not match. (see \c ::x509_cert sig_oid) */ #define POLARSSL_ERR_X509_SIG_MISMATCH -0x2680 /**< Signature algorithms do not match. (see \c ::x509_crt sig_oid) */
#define POLARSSL_ERR_X509_CERT_VERIFY_FAILED -0x2700 /**< Certificate verification failed, e.g. CRL, CA or signature check failed. */ #define POLARSSL_ERR_X509_CERT_VERIFY_FAILED -0x2700 /**< Certificate verification failed, e.g. CRL, CA or signature check failed. */
#define POLARSSL_ERR_X509_CERT_UNKNOWN_FORMAT -0x2780 /**< Format not recognized as DER or PEM. */ #define POLARSSL_ERR_X509_CERT_UNKNOWN_FORMAT -0x2780 /**< Format not recognized as DER or PEM. */
#define POLARSSL_ERR_X509_BAD_INPUT_DATA -0x2800 /**< Input invalid. */ #define POLARSSL_ERR_X509_BAD_INPUT_DATA -0x2800 /**< Input invalid. */
......
...@@ -52,7 +52,7 @@ extern "C" { ...@@ -52,7 +52,7 @@ extern "C" {
/** /**
* Container for an X.509 certificate. The certificate may be chained. * Container for an X.509 certificate. The certificate may be chained.
*/ */
typedef struct _x509_cert typedef struct _x509_crt
{ {
x509_buf raw; /**< The raw certificate data (DER). */ x509_buf raw; /**< The raw certificate data (DER). */
x509_buf tbs; /**< The raw certificate body (DER). The part that is To Be Signed. */ x509_buf tbs; /**< The raw certificate body (DER). The part that is To Be Signed. */
...@@ -92,9 +92,9 @@ typedef struct _x509_cert ...@@ -92,9 +92,9 @@ typedef struct _x509_cert
md_type_t sig_md; /**< Internal representation of the MD algorithm of the signature algorithm, e.g. POLARSSL_MD_SHA256 */ md_type_t sig_md; /**< Internal representation of the MD algorithm of the signature algorithm, e.g. POLARSSL_MD_SHA256 */
pk_type_t sig_pk /**< Internal representation of the Public Key algorithm of the signature algorithm, e.g. POLARSSL_PK_RSA */; pk_type_t sig_pk /**< Internal representation of the Public Key algorithm of the signature algorithm, e.g. POLARSSL_PK_RSA */;
struct _x509_cert *next; /**< Next certificate in the CA-chain. */ struct _x509_crt *next; /**< Next certificate in the CA-chain. */
} }
x509_cert; x509_crt;
#define X509_CRT_VERSION_1 0 #define X509_CRT_VERSION_1 0
#define X509_CRT_VERSION_2 1 #define X509_CRT_VERSION_2 1
...@@ -132,7 +132,7 @@ x509write_cert; ...@@ -132,7 +132,7 @@ x509write_cert;
* *
* \return 0 if successful, or a specific X509 or PEM error code * \return 0 if successful, or a specific X509 or PEM error code
*/ */
int x509_crt_parse_der( x509_cert *chain, const unsigned char *buf, int x509_crt_parse_der( x509_crt *chain, const unsigned char *buf,
size_t buflen ); size_t buflen );
/** /**
...@@ -149,7 +149,7 @@ int x509_crt_parse_der( x509_cert *chain, const unsigned char *buf, ...@@ -149,7 +149,7 @@ int x509_crt_parse_der( x509_cert *chain, const unsigned char *buf,
* \return 0 if all certificates parsed successfully, a positive number * \return 0 if all certificates parsed successfully, a positive number
* if partly successful or a specific X509 or PEM error code * if partly successful or a specific X509 or PEM error code
*/ */
int x509_crt_parse( x509_cert *chain, const unsigned char *buf, size_t buflen ); int x509_crt_parse( x509_crt *chain, const unsigned char *buf, size_t buflen );
#if defined(POLARSSL_FS_IO) #if defined(POLARSSL_FS_IO)
/** /**
...@@ -165,7 +165,7 @@ int x509_crt_parse( x509_cert *chain, const unsigned char *buf, size_t buflen ); ...@@ -165,7 +165,7 @@ int x509_crt_parse( x509_cert *chain, const unsigned char *buf, size_t buflen );
* \return 0 if all certificates parsed successfully, a positive number * \return 0 if all certificates parsed successfully, a positive number
* if partly successful or a specific X509 or PEM error code * if partly successful or a specific X509 or PEM error code
*/ */
int x509_crt_parse_file( x509_cert *chain, const char *path ); int x509_crt_parse_file( x509_crt *chain, const char *path );
/** /**
* \brief Load one or more certificate files from a path and add them * \brief Load one or more certificate files from a path and add them
...@@ -180,7 +180,7 @@ int x509_crt_parse_file( x509_cert *chain, const char *path ); ...@@ -180,7 +180,7 @@ int x509_crt_parse_file( x509_cert *chain, const char *path );
* \return 0 if all certificates parsed successfully, a positive number * \return 0 if all certificates parsed successfully, a positive number
* if partly successful or a specific X509 or PEM error code * if partly successful or a specific X509 or PEM error code
*/ */
int x509_crt_parse_path( x509_cert *chain, const char *path ); int x509_crt_parse_path( x509_crt *chain, const char *path );
#endif /* POLARSSL_FS_IO */ #endif /* POLARSSL_FS_IO */
/** /**
...@@ -196,7 +196,7 @@ int x509_crt_parse_path( x509_cert *chain, const char *path ); ...@@ -196,7 +196,7 @@ int x509_crt_parse_path( x509_cert *chain, const char *path );
* case of an error. * case of an error.
*/ */
int x509_crt_info( char *buf, size_t size, const char *prefix, int x509_crt_info( char *buf, size_t size, const char *prefix,
const x509_cert *crt ); const x509_crt *crt );
/** /**
* \brief Verify the certificate signature * \brief Verify the certificate signature
...@@ -206,7 +206,7 @@ int x509_crt_info( char *buf, size_t size, const char *prefix, ...@@ -206,7 +206,7 @@ int x509_crt_info( char *buf, size_t size, const char *prefix,
* the verification callback is called for each * the verification callback is called for each
* certificate in the chain (from the trust-ca down to the * certificate in the chain (from the trust-ca down to the
* presented crt). The parameters for the callback are: * presented crt). The parameters for the callback are:
* (void *parameter, x509_cert *crt, int certificate_depth, * (void *parameter, x509_crt *crt, int certificate_depth,
* int *flags). With the flags representing current flags for * int *flags). With the flags representing current flags for
* that specific certificate and the certificate depth from * that specific certificate and the certificate depth from
* the bottom (Peer cert depth = 0). * the bottom (Peer cert depth = 0).
...@@ -234,11 +234,11 @@ int x509_crt_info( char *buf, size_t size, const char *prefix, ...@@ -234,11 +234,11 @@ int x509_crt_info( char *buf, size_t size, const char *prefix,
* or another error in case of a fatal error encountered * or another error in case of a fatal error encountered
* during the verification process. * during the verification process.
*/ */
int x509_crt_verify( x509_cert *crt, int x509_crt_verify( x509_crt *crt,
x509_cert *trust_ca, x509_crt *trust_ca,
x509_crl *ca_crl, x509_crl *ca_crl,
const char *cn, int *flags, const char *cn, int *flags,
int (*f_vrfy)(void *, x509_cert *, int, int *), int (*f_vrfy)(void *, x509_crt *, int, int *),
void *p_vrfy ); void *p_vrfy );
#if defined(POLARSSL_X509_CRL_PARSE_C) #if defined(POLARSSL_X509_CRL_PARSE_C)
...@@ -251,7 +251,7 @@ int x509_crt_verify( x509_cert *crt, ...@@ -251,7 +251,7 @@ int x509_crt_verify( x509_cert *crt,
* \return 1 if the certificate is revoked, 0 otherwise * \return 1 if the certificate is revoked, 0 otherwise
* *
*/ */
int x509_crt_revoked( const x509_cert *crt, const x509_crl *crl ); int x509_crt_revoked( const x509_crt *crt, const x509_crl *crl );
#endif /* POLARSSL_X509_CRL_PARSE_C */ #endif /* POLARSSL_X509_CRL_PARSE_C */
/** /**
...@@ -259,14 +259,14 @@ int x509_crt_revoked( const x509_cert *crt, const x509_crl *crl ); ...@@ -259,14 +259,14 @@ int x509_crt_revoked( const x509_cert *crt, const x509_crl *crl );
* *
* \param crt Certificate chain to initialize * \param crt Certificate chain to initialize
*/ */
void x509_crt_init( x509_cert *crt ); void x509_crt_init( x509_crt *crt );
/** /**
* \brief Unallocate all certificate data * \brief Unallocate all certificate data
* *
* \param crt Certificate chain to free * \param crt Certificate chain to free
*/ */
void x509_crt_free( x509_cert *crt ); void x509_crt_free( x509_crt *crt );
#endif /* POLARSSL_X509_CRT_PARSE_C */ #endif /* POLARSSL_X509_CRT_PARSE_C */
/* \} name */ /* \} name */
......
...@@ -260,7 +260,7 @@ static void debug_print_pk( const ssl_context *ssl, int level, ...@@ -260,7 +260,7 @@ static void debug_print_pk( const ssl_context *ssl, int level,
void debug_print_crt( const ssl_context *ssl, int level, void debug_print_crt( const ssl_context *ssl, int level,
const char *file, int line, const char *file, int line,
const char *text, const x509_cert *crt ) const char *text, const x509_crt *crt )
{ {
char str[1024], prefix[64]; char str[1024], prefix[64];
int i = 0, maxlen = sizeof( prefix ) - 1; int i = 0, maxlen = sizeof( prefix ) - 1;
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#include <stdlib.h> #include <stdlib.h>
int pkcs11_x509_cert_init( x509_cert *cert, pkcs11h_certificate_t pkcs11_cert ) int pkcs11_x509_cert_init( x509_crt *cert, pkcs11h_certificate_t pkcs11_cert )
{ {
int ret = 1; int ret = 1;
unsigned char *cert_blob = NULL; unsigned char *cert_blob = NULL;
...@@ -71,7 +71,7 @@ int pkcs11_x509_cert_init( x509_cert *cert, pkcs11h_certificate_t pkcs11_cert ) ...@@ -71,7 +71,7 @@ int pkcs11_x509_cert_init( x509_cert *cert, pkcs11h_certificate_t pkcs11_cert )
goto cleanup; goto cleanup;
} }
if( 0 != x509parse_crt(cert, cert_blob, cert_blob_size ) ) if( 0 != x509_crt_parse(cert, cert_blob, cert_blob_size ) )
{ {
ret = 6; ret = 6;
goto cleanup; goto cleanup;
...@@ -91,9 +91,9 @@ int pkcs11_priv_key_init( pkcs11_context *priv_key, ...@@ -91,9 +91,9 @@ int pkcs11_priv_key_init( pkcs11_context *priv_key,
pkcs11h_certificate_t pkcs11_cert ) pkcs11h_certificate_t pkcs11_cert )
{ {
int ret = 1; int ret = 1;
x509_cert cert; x509_crt cert;
memset( &cert, 0, sizeof( cert ) ); x509_crt_init( &cert );
if( priv_key == NULL ) if( priv_key == NULL )
goto cleanup; goto cleanup;
...@@ -107,7 +107,7 @@ int pkcs11_priv_key_init( pkcs11_context *priv_key, ...@@ -107,7 +107,7 @@ int pkcs11_priv_key_init( pkcs11_context *priv_key,
ret = 0; ret = 0;
cleanup: cleanup:
x509_free( &cert ); x509_crt_free( &cert );
return ret; return ret;
} }
......
...@@ -91,11 +91,11 @@ int ssl_cache_get( void *data, ssl_session *session ) ...@@ -91,11 +91,11 @@ int ssl_cache_get( void *data, ssl_session *session )
*/ */
if( entry->peer_cert.p != NULL ) if( entry->peer_cert.p != NULL )
{ {
session->peer_cert = (x509_cert *) polarssl_malloc( sizeof(x509_cert) ); session->peer_cert = (x509_crt *) polarssl_malloc( sizeof(x509_crt) );
if( session->peer_cert == NULL ) if( session->peer_cert == NULL )
return( 1 ); return( 1 );
memset( session->peer_cert, 0, sizeof(x509_cert) ); memset( session->peer_cert, 0, sizeof(x509_crt) );
if( x509_crt_parse( session->peer_cert, entry->peer_cert.p, if( x509_crt_parse( session->peer_cert, entry->peer_cert.p,
entry->peer_cert.len ) != 0 ) entry->peer_cert.len ) != 0 )
{ {
......
...@@ -135,12 +135,12 @@ static int ssl_load_session( ssl_session *session, ...@@ -135,12 +135,12 @@ static int ssl_load_session( ssl_session *session,
if( p + cert_len > end ) if( p + cert_len > end )
return( POLARSSL_ERR_SSL_BAD_INPUT_DATA ); return( POLARSSL_ERR_SSL_BAD_INPUT_DATA );
session->peer_cert = polarssl_malloc( sizeof( x509_cert ) ); session->peer_cert = polarssl_malloc( sizeof( x509_crt ) );
if( session->peer_cert == NULL ) if( session->peer_cert == NULL )
return( POLARSSL_ERR_SSL_MALLOC_FAILED ); return( POLARSSL_ERR_SSL_MALLOC_FAILED );
memset( session->peer_cert, 0, sizeof( x509_cert ) ); memset( session->peer_cert, 0, sizeof( x509_crt ) );
if( ( ret = x509_crt_parse( session->peer_cert, p, cert_len ) ) != 0 ) if( ( ret = x509_crt_parse( session->peer_cert, p, cert_len ) ) != 0 )
{ {
...@@ -1695,7 +1695,7 @@ static int ssl_write_certificate_request( ssl_context *ssl ) ...@@ -1695,7 +1695,7 @@ static int ssl_write_certificate_request( ssl_context *ssl )
size_t dn_size, total_dn_size; /* excluding length bytes */ size_t dn_size, total_dn_size; /* excluding length bytes */
size_t ct_len, sa_len; /* including length bytes */ size_t ct_len, sa_len; /* including length bytes */
unsigned char *buf, *p; unsigned char *buf, *p;
const x509_cert *crt; const x509_crt *crt;
SSL_DEBUG_MSG( 2, ( "=> write certificate request" ) ); SSL_DEBUG_MSG( 2, ( "=> write certificate request" ) );
......
...@@ -80,10 +80,10 @@ static int ssl_session_copy( ssl_session *dst, const ssl_session *src ) ...@@ -80,10 +80,10 @@ static int ssl_session_copy( ssl_session *dst, const ssl_session *src )
{ {
int ret; int ret;
if( ( dst->peer_cert = polarssl_malloc( sizeof(x509_cert) ) ) == NULL ) if( ( dst->peer_cert = polarssl_malloc( sizeof(x509_crt) ) ) == NULL )
return( POLARSSL_ERR_SSL_MALLOC_FAILED ); return( POLARSSL_ERR_SSL_MALLOC_FAILED );
memset( dst->peer_cert, 0, sizeof(x509_cert) ); memset( dst->peer_cert, 0, sizeof(x509_crt) );
if( ( ret = x509_crt_parse( dst->peer_cert, src->peer_cert->raw.p, if( ( ret = x509_crt_parse( dst->peer_cert, src->peer_cert->raw.p,
src->peer_cert->raw.len ) != 0 ) ) src->peer_cert->raw.len ) != 0 ) )
...@@ -2272,7 +2272,7 @@ int ssl_write_certificate( ssl_context *ssl ) ...@@ -2272,7 +2272,7 @@ int ssl_write_certificate( ssl_context *ssl )
{ {
int ret = POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE; int ret = POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE;
size_t i, n; size_t i, n;
const x509_cert *crt; const x509_crt *crt;
const ssl_ciphersuite_t *ciphersuite_info = ssl->transform_negotiate->ciphersuite_info; const ssl_ciphersuite_t *ciphersuite_info = ssl->transform_negotiate->ciphersuite_info;
SSL_DEBUG_MSG( 2, ( "=> write certificate" ) ); SSL_DEBUG_MSG( 2, ( "=> write certificate" ) );
...@@ -2486,15 +2486,15 @@ int ssl_parse_certificate( ssl_context *ssl ) ...@@ -2486,15 +2486,15 @@ int ssl_parse_certificate( ssl_context *ssl )
polarssl_free( ssl->session_negotiate->peer_cert ); polarssl_free( ssl->session_negotiate->peer_cert );
} }
if( ( ssl->session_negotiate->peer_cert = (x509_cert *) polarssl_malloc( if( ( ssl->session_negotiate->peer_cert = (x509_crt *) polarssl_malloc(
sizeof( x509_cert ) ) ) == NULL ) sizeof( x509_crt ) ) ) == NULL )
{ {
SSL_DEBUG_MSG( 1, ( "malloc(%d bytes) failed", SSL_DEBUG_MSG( 1, ( "malloc(%d bytes) failed",
sizeof( x509_cert ) ) ); sizeof( x509_crt ) ) );
return( POLARSSL_ERR_SSL_MALLOC_FAILED ); return( POLARSSL_ERR_SSL_MALLOC_FAILED );
} }
memset( ssl->session_negotiate->peer_cert, 0, sizeof( x509_cert ) ); memset( ssl->session_negotiate->peer_cert, 0, sizeof( x509_crt ) );
i = 7; i = 7;
...@@ -3379,7 +3379,7 @@ void ssl_set_authmode( ssl_context *ssl, int authmode ) ...@@ -3379,7 +3379,7 @@ void ssl_set_authmode( ssl_context *ssl, int authmode )
#if defined(POLARSSL_X509_CRT_PARSE_C) #if defined(POLARSSL_X509_CRT_PARSE_C)
void ssl_set_verify( ssl_context *ssl, void ssl_set_verify( ssl_context *ssl,
int (*f_vrfy)(void *, x509_cert *, int, int *), int (*f_vrfy)(void *, x509_crt *, int, int *),
void *p_vrfy ) void *p_vrfy )
{ {
ssl->f_vrfy = f_vrfy; ssl->f_vrfy = f_vrfy;
...@@ -3464,7 +3464,7 @@ void ssl_set_ciphersuites_for_version( ssl_context *ssl, const int *ciphersuites ...@@ -3464,7 +3464,7 @@ void ssl_set_ciphersuites_for_version( ssl_context *ssl, const int *ciphersuites
} }
#if defined(POLARSSL_X509_CRT_PARSE_C) #if defined(POLARSSL_X509_CRT_PARSE_C)
void ssl_set_ca_chain( ssl_context *ssl, x509_cert *ca_chain, void ssl_set_ca_chain( ssl_context *ssl, x509_crt *ca_chain,
x509_crl *ca_crl, const char *peer_cn ) x509_crl *ca_crl, const char *peer_cn )
{ {
ssl->ca_chain = ca_chain; ssl->ca_chain = ca_chain;
...@@ -3472,7 +3472,7 @@ void ssl_set_ca_chain( ssl_context *ssl, x509_cert *ca_chain, ...@@ -3472,7 +3472,7 @@ void ssl_set_ca_chain( ssl_context *ssl, x509_cert *ca_chain,
ssl->peer_cn = peer_cn; ssl->peer_cn = peer_cn;
} }
void ssl_set_own_cert( ssl_context *ssl, x509_cert *own_cert, void ssl_set_own_cert( ssl_context *ssl, x509_crt *own_cert,
pk_context *pk_key ) pk_context *pk_key )
{ {
ssl->own_cert = own_cert; ssl->own_cert = own_cert;
...@@ -3480,7 +3480,7 @@ void ssl_set_own_cert( ssl_context *ssl, x509_cert *own_cert, ...@@ -3480,7 +3480,7 @@ void ssl_set_own_cert( ssl_context *ssl, x509_cert *own_cert,
} }
#if defined(POLARSSL_RSA_C) #if defined(POLARSSL_RSA_C)
int ssl_set_own_cert_rsa( ssl_context *ssl, x509_cert *own_cert, int ssl_set_own_cert_rsa( ssl_context *ssl, x509_crt *own_cert,
rsa_context *rsa_key ) rsa_context *rsa_key )
{ {
int ret; int ret;
...@@ -3505,7 +3505,7 @@ int ssl_set_own_cert_rsa( ssl_context *ssl, x509_cert *own_cert, ...@@ -3505,7 +3505,7 @@ int ssl_set_own_cert_rsa( ssl_context *ssl, x509_cert *own_cert,
} }
#endif /* POLARSSL_RSA_C */ #endif /* POLARSSL_RSA_C */
int ssl_set_own_cert_alt( ssl_context *ssl, x509_cert *own_cert, int ssl_set_own_cert_alt( ssl_context *ssl, x509_crt *own_cert,
void *rsa_key, void *rsa_key,