mempacket_test_inject(c_to_s_mempacket, (char *)certstatus,
sizeof(certstatus), 1, INJECT_PACKET_IGNORE_REC_SEQ);
- if (!create_ssl_connection(serverssl1, clientssl1)) {
+ if (!create_ssl_connection(serverssl1, clientssl1, SSL_ERROR_NONE)) {
printf("Unable to create SSL connection\n");
ERR_print_errors_fp(stdout);
goto end;
goto end;
}
- if (!create_ssl_connection(serverssl, clientssl)) {
+ if (!create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)) {
printf("Unable to create SSL connection\n");
goto end;
}
goto end;
}
- if (!create_ssl_connection(serverssl, clientssl)) {
+ if (!create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)) {
printf("Unable to create SSL connection\n");
goto end;
}
goto end;
}
- if (!create_ssl_connection(serverssl, clientssl)) {
+ if (!create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)) {
printf("Unable to create SSL connection\n");
goto end;
}
goto end;
}
- if (!create_ssl_connection(serverssl, clientssl)) {
+ if (!create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)) {
printf("Unable to create SSL connection\n");
goto end;
}
}
/* This should fail because the callback will fail */
- if (create_ssl_connection(serverssl, clientssl)) {
+ if (create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)) {
printf("Unexpected success creating the connection\n");
goto end;
}
BIO_free(certbio);
certbio = NULL;
- if (!create_ssl_connection(serverssl, clientssl)) {
+ if (!create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)) {
printf("Unable to create SSL connection\n");
goto end;
}
goto end;
}
- if (!create_ssl_connection(serverssl1, clientssl1)) {
+ if (!create_ssl_connection(serverssl1, clientssl1, SSL_ERROR_NONE)) {
printf("Unable to create SSL connection\n");
goto end;
}
goto end;
}
- if (!create_ssl_connection(serverssl2, clientssl2)) {
+ if (!create_ssl_connection(serverssl2, clientssl2, SSL_ERROR_NONE)) {
printf("Unable to create second SSL connection\n");
goto end;
}
}
/* This should fail because of the mismatched protocol versions */
- if (create_ssl_connection(serverssl3, clientssl3)) {
+ if (create_ssl_connection(serverssl3, clientssl3, SSL_ERROR_NONE)) {
printf("Unable to create third SSL connection\n");
goto end;
}
}
}
- if (curr->connsuccess != create_ssl_connection(serverssl, clientssl)) {
+ if (curr->connsuccess != create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)) {
printf("Unexpected return value creating SSL connection (%d)\n", idx);
goto end;
}
return 0;
}
-int create_ssl_connection(SSL *serverssl, SSL *clientssl)
+int create_ssl_connection(SSL *serverssl, SSL *clientssl, int want)
{
int retc = -1, rets = -1, err, abortctr = 0;
int clienterr = 0, servererr = 0;
printf("SSL_connect() failed %d, %d\n", retc, err);
clienterr = 1;
}
+ if (want != SSL_ERROR_NONE && err == want)
+ return 0;
err = SSL_ERROR_WANT_WRITE;
while (!servererr && rets <= 0 && err == SSL_ERROR_WANT_WRITE) {
printf("SSL_accept() failed %d, %d\n", rets, err);
servererr = 1;
}
+ if (want != SSL_ERROR_NONE && err == want)
+ return 0;
if (clienterr && servererr)
return 0;
if (++abortctr == MAXLOOPS) {
char *privkeyfile);
int create_ssl_objects(SSL_CTX *serverctx, SSL_CTX *clientctx, SSL **sssl,
SSL **cssl, BIO *s_to_c_fbio, BIO *c_to_s_fbio);
-int create_ssl_connection(SSL *serverssl, SSL *clientssl);
+int create_ssl_connection(SSL *serverssl, SSL *clientssl, int want);
/* Note: Not thread safe! */
const BIO_METHOD *bio_f_tls_dump_filter(void);