From 27d54b109686d064c138d6a87637f9c6c4ab504f Mon Sep 17 00:00:00 2001 From: Todd A Ouska Date: Mon, 28 Feb 2011 13:40:56 -0800 Subject: [PATCH] parse all certs when user callback accepts some --- src/cyassl_int.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cyassl_int.c b/src/cyassl_int.c index 522803e64..b8d236b58 100644 --- a/src/cyassl_int.c +++ b/src/cyassl_int.c @@ -1360,6 +1360,7 @@ static int DoCertificate(SSL* ssl, byte* input, word32* inOutIdx) { word32 listSz, i = *inOutIdx; int ret = 0; + int anyError = 0; int firstTime = 1; /* peer's is at front */ char domain[ASN_NAME_MAX]; @@ -1370,7 +1371,7 @@ static int DoCertificate(SSL* ssl, byte* input, word32* inOutIdx) c24to32(&input[i], &listSz); i += CERT_HEADER_SZ; - while (listSz && ret == 0) { + while (listSz) { /* cert size */ buffer myCert; word32 certSz; @@ -1386,6 +1387,9 @@ static int DoCertificate(SSL* ssl, byte* input, word32* inOutIdx) listSz -= certSz + CERT_HEADER_SZ; + if (ret != 0 && anyError == 0) + anyError = ret; /* save error from last time */ + #ifdef SESSION_CERTS if (ssl->session.chain.count < MAX_CHAIN_DEPTH && myCert.length < MAX_X509_SIZE) { @@ -1476,6 +1480,9 @@ static int DoCertificate(SSL* ssl, byte* input, word32* inOutIdx) FreeDecodedCert(&dCert); } + if (anyError != 0) + ret = anyError; + if (ret == 0 && ssl->options.side == CLIENT_END) ssl->options.serverState = SERVER_CERT_COMPLETE;