Added new "WOLFSSL_BUFFER_INFO" type to represent internal "buffer" type and the "WOLFSSL_X509_STORE_CTX" certs. Added "VERIFY_CALLBACK_SHOW_PEER_CERTS" to print peer certs pointer and length.

This commit is contained in:
David Garske
2016-11-22 19:24:54 -08:00
parent 5b76a37234
commit 50131b410d
3 changed files with 16 additions and 6 deletions

View File

@@ -1280,11 +1280,8 @@ WOLFSSL_LOCAL int DoFinished(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
WOLFSSL_LOCAL int DoApplicationData(WOLFSSL* ssl, byte* input, word32* inOutIdx);
/* wolfSSL buffer type */
typedef struct buffer {
byte* buffer;
word32 length;
} buffer;
/* wolfSSL buffer type - internal uses "buffer" type */
typedef WOLFSSL_BUFFER_INFO buffer;
#ifndef NO_CERTS
/* wolfSSL DER buffer */

View File

@@ -166,6 +166,11 @@ typedef struct WOLFSSL_X509_OBJECT {
} data;
} WOLFSSL_X509_OBJECT;
typedef struct WOLFSSL_BUFFER_INFO {
unsigned char* buffer;
unsigned int length;
} WOLFSSL_BUFFER_INFO;
typedef struct WOLFSSL_X509_STORE_CTX {
WOLFSSL_X509_STORE* store; /* Store full of a CA cert chain */
WOLFSSL_X509* current_cert; /* stunnel dereference */
@@ -176,7 +181,7 @@ typedef struct WOLFSSL_X509_STORE_CTX {
int error_depth; /* cert depth for this error */
int discardSessionCerts; /* so verify callback can flag for discard */
int totalCerts; /* number of peer cert buffers */
struct buffer* certs; /* peer certs */
WOLFSSL_BUFFER_INFO* certs; /* peer certs */
} WOLFSSL_X509_STORE_CTX;

View File

@@ -1152,6 +1152,14 @@ static INLINE int myVerify(int preverify, WOLFSSL_X509_STORE_CTX* store)
printf("\tPeer has no cert!\n");
#else
printf("\tPeer certs: %d\n", store->totalCerts);
#ifdef VERIFY_CALLBACK_SHOW_PEER_CERTS
{ int i;
for (i=0; i<store->totalCerts; i++) {
WOLFSSL_BUFFER_INFO* cert = &store->certs[i];
printf("\t\tCert %d: Ptr %p, Len %u\n", i, cert->buffer, cert->length);
}
}
#endif
#endif
printf("\tSubject's domain name is %s\n", store->domain);