From 4d2a8eb6ffcebcabff63b61d488b9ba3e79e7f6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Fri, 13 Jun 2014 20:33:27 +0200 Subject: [PATCH] SSL modules now using x509_crt_parse_der() Avoid uselessly trying to decode PEM. --- library/ssl_srv.c | 3 ++- library/ssl_tls.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/library/ssl_srv.c b/library/ssl_srv.c index dfa7e48cd..7a5f462b3 100644 --- a/library/ssl_srv.c +++ b/library/ssl_srv.c @@ -149,7 +149,8 @@ static int ssl_load_session( ssl_session *session, x509_crt_init( session->peer_cert ); - if( ( ret = x509_crt_parse( session->peer_cert, p, cert_len ) ) != 0 ) + if( ( ret = x509_crt_parse_der( session->peer_cert, + p, cert_len ) ) != 0 ) { x509_crt_free( session->peer_cert ); polarssl_free( session->peer_cert ); diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 1c5249cd2..ce6730d53 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -101,8 +101,8 @@ static int ssl_session_copy( ssl_session *dst, const ssl_session *src ) x509_crt_init( dst->peer_cert ); - if( ( ret = x509_crt_parse( dst->peer_cert, src->peer_cert->raw.p, - src->peer_cert->raw.len ) ) != 0 ) + if( ( ret = x509_crt_parse_der( dst->peer_cert, src->peer_cert->raw.p, + src->peer_cert->raw.len ) ) != 0 ) { polarssl_free( dst->peer_cert ); dst->peer_cert = NULL;