summaryrefslogtreecommitdiff
path: root/tests/tls-rehandshake-cert-2.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tls-rehandshake-cert-2.c')
-rw-r--r--tests/tls-rehandshake-cert-2.c58
1 files changed, 7 insertions, 51 deletions
diff --git a/tests/tls-rehandshake-cert-2.c b/tests/tls-rehandshake-cert-2.c
index c096519210..cd89b8fe62 100644
--- a/tests/tls-rehandshake-cert-2.c
+++ b/tests/tls-rehandshake-cert-2.c
@@ -48,6 +48,7 @@ int main()
#include <signal.h>
#include "utils.h"
+#include "cert-common.h"
static void terminate(void);
@@ -64,46 +65,6 @@ static void client_log_func(int level, const char *str)
fprintf(stderr, "client|<%d>| %s", level, str);
}
-static unsigned char server_cert_pem[] =
- "-----BEGIN CERTIFICATE-----\n"
- "MIICVjCCAcGgAwIBAgIERiYdMTALBgkqhkiG9w0BAQUwGTEXMBUGA1UEAxMOR251\n"
- "VExTIHRlc3QgQ0EwHhcNMDcwNDE4MTMyOTIxWhcNMDgwNDE3MTMyOTIxWjA3MRsw\n"
- "GQYDVQQKExJHbnVUTFMgdGVzdCBzZXJ2ZXIxGDAWBgNVBAMTD3Rlc3QuZ251dGxz\n"
- "Lm9yZzCBnDALBgkqhkiG9w0BAQEDgYwAMIGIAoGA17pcr6MM8C6pJ1aqU46o63+B\n"
- "dUxrmL5K6rce+EvDasTaDQC46kwTHzYWk95y78akXrJutsoKiFV1kJbtple8DDt2\n"
- "DZcevensf9Op7PuFZKBroEjOd35znDET/z3IrqVgbtm2jFqab7a+n2q9p/CgMyf1\n"
- "tx2S5Zacc1LWn9bIjrECAwEAAaOBkzCBkDAMBgNVHRMBAf8EAjAAMBoGA1UdEQQT\n"
- "MBGCD3Rlc3QuZ251dGxzLm9yZzATBgNVHSUEDDAKBggrBgEFBQcDATAPBgNVHQ8B\n"
- "Af8EBQMDB6AAMB0GA1UdDgQWBBTrx0Vu5fglyoyNgw106YbU3VW0dTAfBgNVHSME\n"
- "GDAWgBTpPBz7rZJu5gakViyi4cBTJ8jylTALBgkqhkiG9w0BAQUDgYEAaFEPTt+7\n"
- "bzvBuOf7+QmeQcn29kT6Bsyh1RHJXf8KTk5QRfwp6ogbp94JQWcNQ/S7YDFHglD1\n"
- "AwUNBRXwd3riUsMnsxgeSDxYBfJYbDLeohNBsqaPDJb7XailWbMQKfAbFQ8cnOxg\n"
- "rOKLUQRWJ0K3HyXRMhbqjdLIaQiCvQLuizo=\n" "-----END CERTIFICATE-----\n";
-
-const gnutls_datum_t server_cert = { server_cert_pem,
- sizeof(server_cert_pem)
-};
-
-static unsigned char server_key_pem[] =
- "-----BEGIN RSA PRIVATE KEY-----\n"
- "MIICXAIBAAKBgQDXulyvowzwLqknVqpTjqjrf4F1TGuYvkrqtx74S8NqxNoNALjq\n"
- "TBMfNhaT3nLvxqResm62ygqIVXWQlu2mV7wMO3YNlx696ex/06ns+4VkoGugSM53\n"
- "fnOcMRP/PciupWBu2baMWppvtr6far2n8KAzJ/W3HZLllpxzUtaf1siOsQIDAQAB\n"
- "AoGAYAFyKkAYC/PYF8e7+X+tsVCHXppp8AoP8TEZuUqOZz/AArVlle/ROrypg5kl\n"
- "8YunrvUdzH9R/KZ7saNZlAPLjZyFG9beL/am6Ai7q7Ma5HMqjGU8kTEGwD7K+lbG\n"
- "iomokKMOl+kkbY/2sI5Czmbm+/PqLXOjtVc5RAsdbgvtmvkCQQDdV5QuU8jap8Hs\n"
- "Eodv/tLJ2z4+SKCV2k/7FXSKWe0vlrq0cl2qZfoTUYRnKRBcWxc9o92DxK44wgPi\n"
- "oMQS+O7fAkEA+YG+K9e60sj1K4NYbMPAbYILbZxORDecvP8lcphvwkOVUqbmxOGh\n"
- "XRmTZUuhBrJhJKKf6u7gf3KWlPl6ShKEbwJASC118cF6nurTjuLf7YKARDjNTEws\n"
- "qZEeQbdWYINAmCMj0RH2P0mvybrsXSOD5UoDAyO7aWuqkHGcCLv6FGG+qwJAOVqq\n"
- "tXdUucl6GjOKKw5geIvRRrQMhb/m5scb+5iw8A4LEEHPgGiBaF5NtJZLALgWfo5n\n"
- "hmC8+G8F0F78znQtPwJBANexu+Tg5KfOnzSILJMo3oXiXhf5PqXIDmbN0BKyCKAQ\n"
- "LfkcEcUbVfmDaHpvzwY9VEaoMOKVLitETXdNSxVpvWM=\n"
- "-----END RSA PRIVATE KEY-----\n";
-
-const gnutls_datum_t server_key = { server_key_pem,
- sizeof(server_key_pem)
-};
#define MAX_BUF 1024
@@ -130,6 +91,7 @@ static void client(int fd, unsigned test)
/* Initialize TLS session
*/
gnutls_init(&session, GNUTLS_CLIENT);
+ gnutls_handshake_set_timeout(session, 20 * 1000);
/* Use default priorities */
gnutls_priority_set_direct(session, "NORMAL", NULL);
@@ -182,12 +144,6 @@ static void client(int fd, unsigned test)
|| ret == GNUTLS_E_INTERRUPTED);
} while (ret > 0);
- if (ret < GNUTLS_E_REHANDSHAKE) {
- fail("client: Error receiving: %s\n",
- gnutls_strerror(ret));
- exit(1);
- }
-
} else {
do {
do {
@@ -274,6 +230,7 @@ static void server(int fd, unsigned test)
gnutls_anon_allocate_server_credentials(&anoncred);
gnutls_init(&session, GNUTLS_SERVER);
+ gnutls_handshake_set_timeout(session, 20 * 1000);
/* avoid calling all the priority functions, since the defaults
* are adequate.
@@ -400,6 +357,7 @@ static void start(unsigned test)
{
int fd[2];
int ret;
+ int status = 0;
ret = socketpair(AF_UNIX, SOCK_STREAM, 0, fd);
if (ret < 0) {
@@ -418,7 +376,8 @@ static void start(unsigned test)
/* parent */
close(fd[1]);
server(fd[0], test);
- kill(child, SIGTERM);
+ wait(&status);
+ check_wait_status(status);
} else {
close(fd[0]);
client(fd[1], test);
@@ -428,9 +387,6 @@ static void start(unsigned test)
static void ch_handler(int sig)
{
- int status = 0;
- wait(&status);
- check_wait_status(status);
return;
}
@@ -439,7 +395,7 @@ void doit(void)
signal(SIGCHLD, ch_handler);
signal(SIGPIPE, SIG_IGN);
- start(0);
+// start(0);
start(1);
}