aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2014-01-26 00:51:09 +0000
committerDr. Stephen Henson <steve@openssl.org>2014-01-26 16:29:50 +0000
commit3323314fc1c6d18e650a2de97f7cf9892ac92a60 (patch)
treeed89a9c8c99f2d71a4a8e27970c6db2002aded82
parent46ab9bbd7fa610d775fe645dd0fe6d509c8dff3a (diff)
downloadopenssl-3323314fc1c6d18e650a2de97f7cf9892ac92a60.tar.gz
Add cert callback retry test.
-rw-r--r--apps/s_cb.c10
-rw-r--r--apps/s_server.c9
2 files changed, 19 insertions, 0 deletions
diff --git a/apps/s_cb.c b/apps/s_cb.c
index 083956916c..dcc9da309c 100644
--- a/apps/s_cb.c
+++ b/apps/s_cb.c
@@ -1272,6 +1272,16 @@ static int set_cert_cb(SSL *ssl, void *arg)
{
int i, rv;
SSL_EXCERT *exc = arg;
+#ifdef CERT_CB_TEST_RETRY
+ static int retry_cnt;
+ if (retry_cnt < 5)
+ {
+ retry_cnt++;
+ fprintf(stderr, "Certificate callback retry test: count %d\n",
+ retry_cnt);
+ return -1;
+ }
+#endif
SSL_certs_clear(ssl);
if (!exc)
diff --git a/apps/s_server.c b/apps/s_server.c
index 1bac3b438f..cb68b2cc84 100644
--- a/apps/s_server.c
+++ b/apps/s_server.c
@@ -2668,6 +2668,15 @@ static int init_ssl_connection(SSL *con)
i=SSL_accept(con);
+#ifdef CERT_CB_TEST_RETRY
+ {
+ while (i <= 0 && SSL_get_error(con,i) == SSL_ERROR_WANT_X509_LOOKUP && SSL_state(con) == SSL3_ST_SR_CLNT_HELLO_C)
+ {
+ fprintf(stderr, "LOOKUP from certificate callback during accept\n");
+ i=SSL_accept(con);
+ }
+ }
+#endif
#ifndef OPENSSL_NO_SRP
while (i <= 0 && SSL_get_error(con,i) == SSL_ERROR_WANT_X509_LOOKUP)
{