annotate tests/testcnx.c @ 808:c0a88c1bcc1e

Updated copyright information
author Sebastien Decugis <sdecugis@freediameter.net>
date Fri, 24 Aug 2012 00:26:53 +0200
parents 09f8f0c4f4a4
children 10f6ce479e1c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1 /*********************************************************************************************************
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
2 * Software License Agreement (BSD License) *
740
4a9f08d6b6ba Updated my mail address
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 729
diff changeset
3 * Author: Sebastien Decugis <sdecugis@freediameter.net> *
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
4 * *
808
c0a88c1bcc1e Updated copyright information
Sebastien Decugis <sdecugis@freediameter.net>
parents: 807
diff changeset
5 * Copyright (c) 2012, WIDE Project and NICT *
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
6 * All rights reserved. *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
7 * *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
8 * Redistribution and use of this software in source and binary forms, with or without modification, are *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
9 * permitted provided that the following conditions are met: *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
10 * *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
11 * * Redistributions of source code must retain the above *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
12 * copyright notice, this list of conditions and the *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
13 * following disclaimer. *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
14 * *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
15 * * Redistributions in binary form must reproduce the above *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
16 * copyright notice, this list of conditions and the *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
17 * following disclaimer in the documentation and/or other *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
18 * materials provided with the distribution. *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
19 * *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
20 * * Neither the name of the WIDE Project or NICT nor the *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
21 * names of its contributors may be used to endorse or *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
22 * promote products derived from this software without *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
23 * specific prior written permission of WIDE Project and *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
24 * NICT. *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
25 * *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
27 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
28 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
29 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
32 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
33 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
34 *********************************************************************************************************/
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
35
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
36 #include "tests.h"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
37
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
38 #ifndef TEST_PORT
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
39 #define TEST_PORT 3868
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
40 #endif /* TEST_PORT */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
41
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
42 #ifndef NB_STREAMS
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
43 #define NB_STREAMS 10
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
44 #endif /* NB_STREAMS */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
45
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
46 #ifndef GNUTLS_DEFAULT_PRIORITY
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
47 # define GNUTLS_DEFAULT_PRIORITY "NORMAL"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
48 #endif /* GNUTLS_DEFAULT_PRIORITY */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
49
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
50 #ifndef GNUTLS_DEFAULT_DHBITS
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
51 # define GNUTLS_DEFAULT_DHBITS 1024
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
52 #endif /* GNUTLS_DEFAULT_DHBITS */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
53
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
54
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
55 /* The cryptographic data */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
56 static char ca_data[] = "-----BEGIN CERTIFICATE-----\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
57 "MIIEqjCCA5KgAwIBAgIJANKgDwdlDYQDMA0GCSqGSIb3DQEBBQUAMIGUMQswCQYD\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
58 "VQQGEwJKUDEOMAwGA1UECAwFVG9reW8xEDAOBgNVBAcMB0tvZ2FuZWkxDTALBgNV\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
59 "BAoMBFdJREUxDzANBgNVBAsMBkFBQSBXRzEfMB0GA1UEAwwWY2hhdnJvdXguY293\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
60 "YWRkaWN0Lm9yZzEiMCAGCSqGSIb3DQEJARYTc2RlY3VnaXNAbmljdC5nby5qcDAe\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
61 "Fw0wOTEwMDUwODUxNDRaFw0xOTEwMDMwODUxNDRaMIGUMQswCQYDVQQGEwJKUDEO\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
62 "MAwGA1UECAwFVG9reW8xEDAOBgNVBAcMB0tvZ2FuZWkxDTALBgNVBAoMBFdJREUx\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
63 "DzANBgNVBAsMBkFBQSBXRzEfMB0GA1UEAwwWY2hhdnJvdXguY293YWRkaWN0Lm9y\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
64 "ZzEiMCAGCSqGSIb3DQEJARYTc2RlY3VnaXNAbmljdC5nby5qcDCCASIwDQYJKoZI\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
65 "hvcNAQEBBQADggEPADCCAQoCggEBAM5c6w4NnngTvGNWcJzbo0Kklp+kvUNQNgGu\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
66 "myvz826qPp07HTSyJrIcgFnuYDR0Nd130Ot9u5osqpQhHTvolxDE87Tii8i3hJSj\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
67 "TTY9K0ZwGb4AZ6QkuyMXS1jtOY657HqjpGZqT/2Syh0i7dM/hqSXFw0SPbyq+W1H\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
68 "SVFWa1CTkPywFWAzwdr5WKah77uZ1dxWqgPgUdcZOiIQtLRp5n3fg40Nwso5YdwS\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
69 "64+ebBX1pkhrCQ8AGc8O61Ep1JTXcO7jqQmPgzjiN+FeostI1Dp73S3MqleTAHjR\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
70 "hqZ77VF7nkroMM9btMHJBaxnfwc2ewULUJwnuOiGWrvMq/9Z4J8CAwEAAaOB/DCB\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
71 "+TAdBgNVHQ4EFgQUkqpVn7N3gmiJ7X5zQ2bki+7qv4UwgckGA1UdIwSBwTCBvoAU\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
72 "kqpVn7N3gmiJ7X5zQ2bki+7qv4WhgZqkgZcwgZQxCzAJBgNVBAYTAkpQMQ4wDAYD\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
73 "VQQIDAVUb2t5bzEQMA4GA1UEBwwHS29nYW5laTENMAsGA1UECgwEV0lERTEPMA0G\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
74 "A1UECwwGQUFBIFdHMR8wHQYDVQQDDBZjaGF2cm91eC5jb3dhZGRpY3Qub3JnMSIw\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
75 "IAYJKoZIhvcNAQkBFhNzZGVjdWdpc0BuaWN0LmdvLmpwggkA0qAPB2UNhAMwDAYD\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
76 "VR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAJy0XLk8j8YLSTt2/VMy9TAUx\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
77 "esXUiZj0Ung+gkr7A1K0NnwYxDzG2adMhf13upHoydu2ErLMmD6F77x+QuY/q7nc\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
78 "ZvO0tvcoAP6ToSDwiypU5dnTmnfkgwVwzFkNCi1sGRosEm8c/c/8MfK0I0nVdj1/\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
79 "BIkIG7tTDVi9JvkWYl0UlSKWTZKrntVwCmscfC02DGb+GoLbO9+QmiNM5Y3yOYZ4\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
80 "Pc7SSoKLL0rwJBmpPNs7boYsweeSuCAVu0shRfgC90odXcej2EN5ETfCuU1evXNW\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
81 "5cA+zZsDK/nWJwxBaW0CxAHX579FElFWlK4+BnzhZRdDhmJDnN5dh4ekJGM6Lg==\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
82 "-----END CERTIFICATE-----\n";
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
83
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
84 /* Client:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
85 Certificate:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
86 Data:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
87 Version: 3 (0x2)
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
88 Serial Number: 5 (0x5)
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
89 Signature Algorithm: sha1WithRSAEncryption
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
90 Issuer: C=JP, ST=Tokyo, L=Koganei, O=WIDE, OU=AAA WG, CN=chavroux.cowaddict.org/emailAddress=sdecugis@nict.go.jp
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
91 Validity
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
92 Not Before: Oct 27 04:04:05 2009 GMT
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
93 Not After : Oct 25 04:04:05 2019 GMT
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
94 Subject: C=JP, ST=Tokyo, L=Koganei, O=WIDE, OU=AAA WG, CN=client.test/emailAddress=client@test
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
95 Subject Public Key Info:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
96 Public Key Algorithm: rsaEncryption
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
97 RSA Public Key: (1024 bit)
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
98 Modulus (1024 bit):
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
99 00:bd:eb:50:1e:9d:7a:cd:9d:bb:e7:bc:4e:38:4a:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
100 b2:cc:9e:b4:89:77:01:ef:d1:c6:19:29:00:fe:ce:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
101 3c:62:05:13:b1:8c:ff:31:7a:0f:c1:2e:4b:3c:0c:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
102 40:1e:36:4e:76:da:0a:64:43:fc:1e:ea:0c:97:b2:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
103 57:9c:9c:8c:90:bd:eb:23:7b:b8:b7:5c:03:ed:6f:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
104 48:55:8a:88:08:38:c5:cd:33:b7:ab:a8:3a:6f:7f:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
105 13:10:65:a5:50:b9:f4:8b:cc:2e:e9:79:58:a6:11:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
106 f0:58:45:41:ef:36:b3:35:cb:14:ec:82:0c:ad:11:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
107 6a:ea:64:ef:28:a2:6e:47:45
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
108 Exponent: 65537 (0x10001)
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
109 X509v3 extensions:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
110 X509v3 Basic Constraints:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
111 CA:FALSE
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
112 Netscape Comment:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
113 OpenSSL Generated Certificate
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
114 X509v3 Subject Key Identifier:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
115 BE:B3:89:4F:9D:8F:6C:20:C4:D0:3E:6A:05:11:82:50:54:49:70:A2
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
116 X509v3 Authority Key Identifier:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
117 keyid:92:AA:55:9F:B3:77:82:68:89:ED:7E:73:43:66:E4:8B:EE:EA:BF:85
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
118
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
119 Signature Algorithm: sha1WithRSAEncryption
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
120 a3:88:f5:15:b5:ad:20:60:a1:85:19:3f:b9:5e:1e:be:31:7f:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
121 84:7a:c2:18:3a:63:6a:67:1f:46:86:4d:10:d6:1d:ad:a2:c8:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
122 0b:95:33:fa:e4:05:f4:b8:70:34:77:f7:85:6e:70:46:ac:39:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
123 54:a9:5f:ea:5e:d1:33:bb:c9:a3:42:81:41:90:25:b5:92:8b:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
124 e8:6e:3e:97:06:dd:9a:cc:29:61:34:5a:d3:1c:5d:ad:d1:a3:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
125 eb:6a:47:b4:d0:c2:17:89:e1:e2:2d:36:18:50:1a:e7:d4:fc:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
126 38:2e:47:0b:39:50:87:2f:aa:07:64:f8:9a:4d:47:01:da:10:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
127 d8:97:c7:a6:13:bc:0e:ca:63:c1:f2:09:fb:f8:6a:a4:5f:08:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
128 b5:ad:ed:4f:71:b9:89:7f:43:27:85:72:e7:8d:a8:4a:cc:f6:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
129 36:ca:8a:ae:82:b5:a8:42:41:99:87:84:7c:f0:90:fd:ca:96:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
130 37:a2:e0:d9:fa:dd:a4:c9:f1:50:b7:e5:e6:8f:af:83:8c:23:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
131 b6:20:cc:66:e3:08:60:13:02:8f:42:3a:07:91:a7:38:b2:72:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
132 16:fd:bd:a9:60:f0:e2:9f:23:f3:c0:99:e3:17:bc:00:7c:b3:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
133 89:9c:ea:fa:3e:f6:69:a1:98:c2:ec:46:da:70:b6:f9:c3:93:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
134 a7:fc:36:dd
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
135 */
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
136 static char client_cert_data[] ="-----BEGIN CERTIFICATE-----\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
137 "MIIDiTCCAnGgAwIBAgIBBTANBgkqhkiG9w0BAQUFADCBlDELMAkGA1UEBhMCSlAx\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
138 "DjAMBgNVBAgMBVRva3lvMRAwDgYDVQQHDAdLb2dhbmVpMQ0wCwYDVQQKDARXSURF\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
139 "MQ8wDQYDVQQLDAZBQUEgV0cxHzAdBgNVBAMMFmNoYXZyb3V4LmNvd2FkZGljdC5v\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
140 "cmcxIjAgBgkqhkiG9w0BCQEWE3NkZWN1Z2lzQG5pY3QuZ28uanAwHhcNMDkxMDI3\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
141 "MDQwNDA1WhcNMTkxMDI1MDQwNDA1WjCBgTELMAkGA1UEBhMCSlAxDjAMBgNVBAgM\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
142 "BVRva3lvMRAwDgYDVQQHDAdLb2dhbmVpMQ0wCwYDVQQKDARXSURFMQ8wDQYDVQQL\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
143 "DAZBQUEgV0cxFDASBgNVBAMMC2NsaWVudC50ZXN0MRowGAYJKoZIhvcNAQkBFgtj\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
144 "bGllbnRAdGVzdDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAvetQHp16zZ27\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
145 "57xOOEqyzJ60iXcB79HGGSkA/s48YgUTsYz/MXoPwS5LPAxAHjZOdtoKZEP8HuoM\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
146 "l7JXnJyMkL3rI3u4t1wD7W9IVYqICDjFzTO3q6g6b38TEGWlULn0i8wu6XlYphHw\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
147 "WEVB7zazNcsU7IIMrRFq6mTvKKJuR0UCAwEAAaN7MHkwCQYDVR0TBAIwADAsBglg\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
148 "hkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0O\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
149 "BBYEFL6ziU+dj2wgxNA+agURglBUSXCiMB8GA1UdIwQYMBaAFJKqVZ+zd4Joie1+\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
150 "c0Nm5Ivu6r+FMA0GCSqGSIb3DQEBBQUAA4IBAQCjiPUVta0gYKGFGT+5Xh6+MX+E\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
151 "esIYOmNqZx9Ghk0Q1h2tosgLlTP65AX0uHA0d/eFbnBGrDlUqV/qXtEzu8mjQoFB\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
152 "kCW1kovobj6XBt2azClhNFrTHF2t0aPrake00MIXieHiLTYYUBrn1Pw4LkcLOVCH\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
153 "L6oHZPiaTUcB2hDYl8emE7wOymPB8gn7+GqkXwi1re1PcbmJf0MnhXLnjahKzPY2\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
154 "yoqugrWoQkGZh4R88JD9ypY3ouDZ+t2kyfFQt+Xmj6+DjCO2IMxm4whgEwKPQjoH\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
155 "kac4snIW/b2pYPDinyPzwJnjF7wAfLOJnOr6PvZpoZjC7EbacLb5w5On/Dbd\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
156 "-----END CERTIFICATE-----\n";
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
157 static char client_priv_data[] ="-----BEGIN RSA PRIVATE KEY-----\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
158 "MIICXgIBAAKBgQC961AenXrNnbvnvE44SrLMnrSJdwHv0cYZKQD+zjxiBROxjP8x\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
159 "eg/BLks8DEAeNk522gpkQ/we6gyXslecnIyQvesje7i3XAPtb0hViogIOMXNM7er\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
160 "qDpvfxMQZaVQufSLzC7peVimEfBYRUHvNrM1yxTsggytEWrqZO8oom5HRQIDAQAB\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
161 "AoGBAIYnsOLPby3LnC5n8AEHkyHDgdgQvsd/MSYYtuFHIZRD7dNfu+xhQru9TdvO\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
162 "84Pj7K07/FczRuc3gUmu6wBv/UIP9To15RHZh+/n537nybGus5S4IYKVvap477To\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
163 "0rQDf9ec27iw77gxb7moQ9Otuxwbv0h0Z+1EVLI8d8jHOq0BAkEA9YNr0R+7KXBS\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
164 "48yT43g5HpOFkTZzNXWVdpSvYGneb56wslk5Eatp235I4uz/a7Rej5v99W0M3nSe\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
165 "/AgHfYn75QJBAMYH/pBx/WkrLj+pPaARlNwInCIC5zUhr6B0IKCt2tvy5eyuc5sd\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
166 "AoTFaU+cSI+ZqsRzY8jMKkonktxBg48oJ+ECQQCt4AtlqcFVkbVCm8pJGQXq/7Ni\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
167 "qlthiwr1Vkv2TkQ4bPza8pGWT/3Cc2ePPyWN08n8jw+G11p72cAW4mDbqfN5AkEA\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
168 "mNYKrkiLn+NnqlJf8W4gSUGL3uQGtYbuGRQHKnuDckWhFm39YzWcgAQsJvkjN1EN\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
169 "7thvpsWLzfeE7ODTPGVtgQJATObxYJOt6rms3fAStwuXW3ET77TA1ja4XsUEe5Yu\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
170 "JpcQOruJb9XwndqzNbL0dSUePb9gFiBCGKYOyreNTTRTmw==\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
171 "-----END RSA PRIVATE KEY-----\n";
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
172
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
173 /* Server:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
174 Certificate:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
175 Data:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
176 Version: 3 (0x2)
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
177 Serial Number: 4 (0x4)
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
178 Signature Algorithm: sha1WithRSAEncryption
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
179 Issuer: C=JP, ST=Tokyo, L=Koganei, O=WIDE, OU=AAA WG, CN=chavroux.cowaddict.org/emailAddress=sdecugis@nict.go.jp
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
180 Validity
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
181 Not Before: Oct 27 04:03:39 2009 GMT
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
182 Not After : Oct 25 04:03:39 2019 GMT
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
183 Subject: C=JP, ST=Tokyo, L=Koganei, O=WIDE, OU=AAA WG, CN=serv.test/emailAddress=serv@test
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
184 Subject Public Key Info:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
185 Public Key Algorithm: rsaEncryption
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
186 RSA Public Key: (1024 bit)
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
187 Modulus (1024 bit):
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
188 00:a6:f7:1c:a9:90:5b:fa:c8:f6:a3:04:0c:d0:8b:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
189 45:c3:90:f7:2d:c2:c9:d7:bd:66:8a:7c:1c:51:89:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
190 40:9e:cd:70:57:cb:00:47:a3:e8:76:8b:00:b3:c9:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
191 c3:0d:b1:b9:2a:08:9f:52:92:82:d3:18:c1:d8:d1:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
192 b8:1e:fd:71:fe:23:ec:19:e9:6d:9d:fd:ae:88:bc:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
193 39:44:7a:37:ad:c6:88:d1:64:7c:b1:d4:3c:a9:30:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
194 c4:de:51:02:c4:48:4f:25:3e:2f:93:ae:25:32:66:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
195 9a:dc:f4:44:45:ff:7f:12:49:97:0d:01:8d:13:9a:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
196 d3:8f:9e:2d:62:95:02:0a:c7
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
197 Exponent: 65537 (0x10001)
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
198 X509v3 extensions:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
199 X509v3 Basic Constraints:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
200 CA:FALSE
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
201 Netscape Comment:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
202 OpenSSL Generated Certificate
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
203 X509v3 Subject Key Identifier:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
204 0C:33:C4:7F:39:D0:34:FF:F8:61:A1:46:8B:49:1D:A3:57:B3:4D:58
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
205 X509v3 Authority Key Identifier:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
206 keyid:92:AA:55:9F:B3:77:82:68:89:ED:7E:73:43:66:E4:8B:EE:EA:BF:85
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
207
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
208 Signature Algorithm: sha1WithRSAEncryption
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
209 87:f5:49:a6:04:f9:98:9a:f1:1a:68:ce:06:ae:4c:0c:08:eb:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
210 ba:98:e7:3f:df:22:7f:35:88:1d:b7:8a:f3:89:a3:68:0d:53:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
211 45:eb:23:a1:dd:6b:dc:b0:80:58:0c:10:0b:49:74:ea:a8:b6:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
212 8c:2e:c6:73:dc:7a:74:c7:59:3e:79:5a:d2:5c:15:0b:f1:d8:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
213 19:37:2a:c0:22:75:10:3f:4c:e9:a1:e0:eb:b2:9e:09:70:3d:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
214 2a:4c:fe:9c:99:36:4b:aa:6c:e1:8b:9c:aa:e1:29:1f:49:6b:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
215 14:db:12:ae:cf:68:4a:dd:03:e1:3b:ad:79:b4:54:84:1d:bb:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
216 ac:45:c4:85:f1:03:65:65:96:23:ae:e7:97:3c:5c:db:ce:55:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
217 34:5d:c3:73:ec:cd:f6:0f:a5:81:5f:c2:ab:a3:42:fa:36:7f:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
218 83:ef:db:0f:cd:62:0b:ea:d9:4f:73:35:68:5f:23:d5:0a:be:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
219 ff:7f:23:9a:af:0d:a5:f8:3e:3a:f0:63:1c:e1:d2:96:81:cf:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
220 7b:5a:6b:d0:9b:67:56:9e:aa:a9:e8:f1:6c:fb:54:2b:1a:f4:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
221 ef:16:5a:be:1d:a9:c8:d6:cc:f7:42:8c:fe:83:2c:84:8c:80:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
222 fb:1c:88:f6:35:1c:ae:43:72:fa:68:30:9c:25:8b:db:2c:84:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
223 87:76:9d:b9
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
224 */
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
225 static char server_cert_data[] ="-----BEGIN CERTIFICATE-----\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
226 "MIIDhDCCAmygAwIBAgIBBDANBgkqhkiG9w0BAQUFADCBlDELMAkGA1UEBhMCSlAx\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
227 "DjAMBgNVBAgMBVRva3lvMRAwDgYDVQQHDAdLb2dhbmVpMQ0wCwYDVQQKDARXSURF\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
228 "MQ8wDQYDVQQLDAZBQUEgV0cxHzAdBgNVBAMMFmNoYXZyb3V4LmNvd2FkZGljdC5v\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
229 "cmcxIjAgBgkqhkiG9w0BCQEWE3NkZWN1Z2lzQG5pY3QuZ28uanAwHhcNMDkxMDI3\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
230 "MDQwMzM5WhcNMTkxMDI1MDQwMzM5WjB9MQswCQYDVQQGEwJKUDEOMAwGA1UECAwF\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
231 "VG9reW8xEDAOBgNVBAcMB0tvZ2FuZWkxDTALBgNVBAoMBFdJREUxDzANBgNVBAsM\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
232 "BkFBQSBXRzESMBAGA1UEAwwJc2Vydi50ZXN0MRgwFgYJKoZIhvcNAQkBFglzZXJ2\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
233 "QHRlc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKb3HKmQW/rI9qMEDNCL\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
234 "RcOQ9y3Cyde9Zop8HFGJQJ7NcFfLAEej6HaLALPJww2xuSoIn1KSgtMYwdjRuB79\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
235 "cf4j7BnpbZ39roi8OUR6N63GiNFkfLHUPKkwxN5RAsRITyU+L5OuJTJmmtz0REX/\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
236 "fxJJlw0BjROa04+eLWKVAgrHAgMBAAGjezB5MAkGA1UdEwQCMAAwLAYJYIZIAYb4\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
237 "QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBQM\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
238 "M8R/OdA0//hhoUaLSR2jV7NNWDAfBgNVHSMEGDAWgBSSqlWfs3eCaIntfnNDZuSL\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
239 "7uq/hTANBgkqhkiG9w0BAQUFAAOCAQEAh/VJpgT5mJrxGmjOBq5MDAjrupjnP98i\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
240 "fzWIHbeK84mjaA1TResjod1r3LCAWAwQC0l06qi2jC7Gc9x6dMdZPnla0lwVC/HY\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
241 "GTcqwCJ1ED9M6aHg67KeCXA9Kkz+nJk2S6ps4YucquEpH0lrFNsSrs9oSt0D4Tut\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
242 "ebRUhB27rEXEhfEDZWWWI67nlzxc285VNF3Dc+zN9g+lgV/Cq6NC+jZ/g+/bD81i\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
243 "C+rZT3M1aF8j1Qq+/38jmq8Npfg+OvBjHOHSloHPe1pr0JtnVp6qqejxbPtUKxr0\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
244 "7xZavh2pyNbM90KM/oMshIyA+xyI9jUcrkNy+mgwnCWL2yyEh3aduQ==\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
245 "-----END CERTIFICATE-----\n";
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
246 static char server_priv_data[] ="-----BEGIN RSA PRIVATE KEY-----\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
247 "MIICXQIBAAKBgQCm9xypkFv6yPajBAzQi0XDkPctwsnXvWaKfBxRiUCezXBXywBH\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
248 "o+h2iwCzycMNsbkqCJ9SkoLTGMHY0bge/XH+I+wZ6W2d/a6IvDlEejetxojRZHyx\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
249 "1DypMMTeUQLESE8lPi+TriUyZprc9ERF/38SSZcNAY0TmtOPni1ilQIKxwIDAQAB\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
250 "AoGAZv3Ddm0P79CLIt9asEFY1VvUvSuMqkGwwPfx1/HcJJkBFYapM4fN22G/Gyf3\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
251 "47ifSWhsLtklTeXVnVMwSh14dJaJQuSEnaFnUUWfjiRbEAXZnMFwAIiaszEZbPap\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
252 "NUNpcGl06FZrphYAMkjOVUfjCjfOZDAvL4JGpo271Zx4l0ECQQDYoFFQpBCPx0PK\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
253 "TWUmvatXI/Amo94XkGfofbdeeI8PiAJBO5UI6rmjjIVwsJwO9dQb/IlP1/OnBeJv\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
254 "p9YW5uixAkEAxVAOKu7mpGu0Q/K2iEUUYDX9YHf253kgkdIDF4iZk4Tcecjoxuru\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
255 "fIWu9dMtyDVV+HT2X4cNEnO1/oS3kJII9wJBAJkdwDwiqz4lV6o/yFZ4zAoc8dsu\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
256 "CoZXYMq5SYox5tTQit928OHLn4mVgqBjhPsiEVnyx0+zUZpmE2ZemHm5nxECQHfE\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
257 "FBVzVYRP6+eil7E3XRrZKqc3qiLunxpkA4RxYebtKnaxwLmdOI1VB9InEQ8JcNmT\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
258 "BUkOzJx6p+mJ3XJfchkCQQDWmbMYYJajsjlS4YpdUUj7cBSotA6vtkNVHFr0/ak/\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
259 "S+tLkMNuruaInWizK+BKYTIJLlQDf5u5NTrw41vye5Hv\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
260 "-----END RSA PRIVATE KEY-----\n";
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
261
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
262 /* Expired:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
263 Certificate:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
264 Data:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
265 Version: 3 (0x2)
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
266 Serial Number: 6 (0x6)
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
267 Signature Algorithm: sha1WithRSAEncryption
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
268 Issuer: C=JP, ST=Tokyo, L=Koganei, O=WIDE, OU=AAA WG, CN=chavroux.cowaddict.org/emailAddress=sdecugis@nict.go.jp
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
269 Validity
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
270 Not Before: Oct 27 04:06:35 2009 GMT
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
271 Not After : Oct 28 04:06:35 2009 GMT
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
272 Subject: C=JP, ST=Tokyo, L=Koganei, O=WIDE, OU=AAA WG, CN=expired.test/emailAddress=expired@test
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
273 Subject Public Key Info:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
274 Public Key Algorithm: rsaEncryption
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
275 RSA Public Key: (1024 bit)
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
276 Modulus (1024 bit):
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
277 00:e3:17:15:54:85:dc:cf:c7:a0:32:4a:49:7d:55:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
278 75:9b:29:15:db:7e:87:17:d9:0e:65:44:53:d7:19:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
279 37:27:c7:c6:fe:c6:dc:72:2b:dc:86:1a:ff:24:6c:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
280 63:3f:75:9c:0a:14:e1:70:06:79:d4:b9:26:d4:68:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
281 4c:28:38:ba:34:60:56:02:3d:94:55:4a:1f:4e:5a:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
282 f0:a5:71:4c:3e:71:69:39:ad:bc:aa:55:35:fb:73:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
283 5b:5f:6c:30:71:8e:8a:b6:a5:06:cc:ee:dd:29:c7:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
284 52:0d:a7:9c:0f:a1:ba:52:11:e2:1b:b9:74:6b:08:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
285 87:11:d2:ec:a9:ac:63:63:4f
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
286 Exponent: 65537 (0x10001)
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
287 X509v3 extensions:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
288 X509v3 Basic Constraints:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
289 CA:FALSE
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
290 Netscape Comment:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
291 OpenSSL Generated Certificate
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
292 X509v3 Subject Key Identifier:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
293 1C:AF:66:42:5B:AD:AA:A5:9B:D9:AE:3A:C1:5A:AC:2F:CC:CE:22:6C
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
294 X509v3 Authority Key Identifier:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
295 keyid:92:AA:55:9F:B3:77:82:68:89:ED:7E:73:43:66:E4:8B:EE:EA:BF:85
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
296
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
297 Signature Algorithm: sha1WithRSAEncryption
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
298 60:8f:55:55:59:82:0f:64:cb:b8:11:c8:44:ce:bf:69:07:0d:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
299 be:c2:34:be:42:6a:78:15:39:9f:be:8a:17:d6:43:42:c9:7c:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
300 f1:6d:5d:aa:c3:1b:4d:b0:f0:b6:73:46:2a:87:cd:55:56:a3:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
301 6d:cc:de:a8:28:6a:53:85:9e:e5:68:b7:3c:f5:72:13:7b:d0:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
302 21:f2:91:49:35:e0:37:1e:28:19:d5:1b:cc:e1:32:1e:7f:b0:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
303 86:df:43:a4:47:0f:29:0b:eb:51:60:9a:f5:ca:50:f4:2d:59:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
304 cd:fc:50:9d:29:ed:45:98:de:a2:5c:d1:b5:7a:34:ad:7a:73:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
305 48:8b:a2:9b:89:8e:4a:2e:2a:04:19:d6:62:6a:0d:f0:96:f2:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
306 f0:d0:22:77:3b:7f:b1:2a:f4:3b:17:47:5e:38:07:09:65:ad:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
307 1d:ea:46:69:6a:96:b6:6b:3b:5c:cc:6e:30:d7:cb:53:69:59:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
308 c2:63:78:2b:03:d4:d4:f7:17:29:99:9a:43:ff:78:0a:af:42:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
309 c5:b3:8d:09:38:5b:30:70:28:c1:97:ab:fd:7f:87:9a:ec:f2:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
310 97:44:ff:f5:b9:41:30:d1:c6:32:98:69:34:c4:39:30:6f:e2:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
311 d3:b2:70:97:66:ee:41:f5:ae:0f:09:f0:ed:60:96:67:a9:8a:
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
312 cd:d6:95:f2
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
313 */
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
314 static char expired_cert_data[]="-----BEGIN CERTIFICATE-----\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
315 "MIIDizCCAnOgAwIBAgIBBjANBgkqhkiG9w0BAQUFADCBlDELMAkGA1UEBhMCSlAx\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
316 "DjAMBgNVBAgMBVRva3lvMRAwDgYDVQQHDAdLb2dhbmVpMQ0wCwYDVQQKDARXSURF\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
317 "MQ8wDQYDVQQLDAZBQUEgV0cxHzAdBgNVBAMMFmNoYXZyb3V4LmNvd2FkZGljdC5v\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
318 "cmcxIjAgBgkqhkiG9w0BCQEWE3NkZWN1Z2lzQG5pY3QuZ28uanAwHhcNMDkxMDI3\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
319 "MDQwNjM1WhcNMDkxMDI4MDQwNjM1WjCBgzELMAkGA1UEBhMCSlAxDjAMBgNVBAgM\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
320 "BVRva3lvMRAwDgYDVQQHDAdLb2dhbmVpMQ0wCwYDVQQKDARXSURFMQ8wDQYDVQQL\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
321 "DAZBQUEgV0cxFTATBgNVBAMMDGV4cGlyZWQudGVzdDEbMBkGCSqGSIb3DQEJARYM\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
322 "ZXhwaXJlZEB0ZXN0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDjFxVUhdzP\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
323 "x6AySkl9VXWbKRXbfocX2Q5lRFPXGTcnx8b+xtxyK9yGGv8kbGM/dZwKFOFwBnnU\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
324 "uSbUaEwoOLo0YFYCPZRVSh9OWvClcUw+cWk5rbyqVTX7c1tfbDBxjoq2pQbM7t0p\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
325 "x1INp5wPobpSEeIbuXRrCIcR0uyprGNjTwIDAQABo3sweTAJBgNVHRMEAjAAMCwG\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
326 "CWCGSAGG+EIBDQQfFh1PcGVuU1NMIEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAdBgNV\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
327 "HQ4EFgQUHK9mQlutqqWb2a46wVqsL8zOImwwHwYDVR0jBBgwFoAUkqpVn7N3gmiJ\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
328 "7X5zQ2bki+7qv4UwDQYJKoZIhvcNAQEFBQADggEBAGCPVVVZgg9ky7gRyETOv2kH\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
329 "Db7CNL5CangVOZ++ihfWQ0LJfPFtXarDG02w8LZzRiqHzVVWo23M3qgoalOFnuVo\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
330 "tzz1chN70CHykUk14DceKBnVG8zhMh5/sIbfQ6RHDykL61FgmvXKUPQtWc38UJ0p\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
331 "7UWY3qJc0bV6NK16c0iLopuJjkouKgQZ1mJqDfCW8vDQInc7f7Eq9DsXR144Bwll\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
332 "rR3qRmlqlrZrO1zMbjDXy1NpWcJjeCsD1NT3FymZmkP/eAqvQsWzjQk4WzBwKMGX\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
333 "q/1/h5rs8pdE//W5QTDRxjKYaTTEOTBv4tOycJdm7kH1rg8J8O1glmepis3WlfI=\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
334 "-----END CERTIFICATE-----\n";
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
335 static char expired_priv_data[]="-----BEGIN RSA PRIVATE KEY-----\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
336 "MIICXgIBAAKBgQDjFxVUhdzPx6AySkl9VXWbKRXbfocX2Q5lRFPXGTcnx8b+xtxy\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
337 "K9yGGv8kbGM/dZwKFOFwBnnUuSbUaEwoOLo0YFYCPZRVSh9OWvClcUw+cWk5rbyq\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
338 "VTX7c1tfbDBxjoq2pQbM7t0px1INp5wPobpSEeIbuXRrCIcR0uyprGNjTwIDAQAB\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
339 "AoGASwPoDui9XYHTIGm7xwRA+kVjLAOq+qy//aHJlEeHGcP7r1PfpHNqwH4QhGat\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
340 "jlv6dLYbFld9TVDwS8A8UBkVIPLWnCysd5tF2A4C5akx6ouW6HliW/JheYrgl8AV\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
341 "PVeR3bm91UbnpC0ABVlw87jp1Ovyr60Suo4jsoJz+CyTa2ECQQD0LJWpnwn1jIlR\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
342 "DGkLi7F3E70JJcdhTWzBjGFD+Na+/2ZO0MKLhK+O1WUkKa0oi+e5P1JOnGIpTI8c\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
343 "BJOO415RAkEA7hauapYuqGI/auSPH8/nFB5z1G94RTxo2a5THKcG5MqS/8N3ubFj\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
344 "i2PPS0lEYVjqoHEsZUsMnDmXp6KDKMAfnwJBAIp+T1UqM8fmsmwaEerOjRXxSCNM\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
345 "Hk5+T9Vn/jNDjOpAipLhrbbcx4bIWtmsGd8Jm6Fi3RhhcvvhxLorjlZZeEECQQCf\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
346 "IaPD88sNmlUewdLzhUbCiLQMadCuHflKfRxpyy1tYAQuVFxCTdDlynkzra25ju+K\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
347 "+vmcXjP4evnk/lbBtt+rAkEAgOr4Apgs3nMppngPV5yFx0NDqH2n8PlEAM1Il4Qs\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
348 "IuuK18v0KwlUGAfEEmCiNh1e1qkLmD0CnI2QjYAjcLQUhw==\n"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
349 "-----END RSA PRIVATE KEY-----\n";
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
350
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
351 /* Unknown CA certificate :
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
352 Certificate:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
353 Data:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
354 Version: 3 (0x2)
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
355 Serial Number: 1 (0x1)
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
356 Signature Algorithm: sha1WithRSAEncryption
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
357 Issuer: C=JP, ST=Tokyo, L=Koganei, O=WIDE, OU=AAA WG, CN=chavroux.cowaddict.org/emailAddress=sdecugis@nict.go.jp
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
358 Validity
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
359 Not Before: Oct 28 08:04:40 2009 GMT
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
360 Not After : Oct 28 08:04:40 2010 GMT
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
361 Subject: C=JP, ST=Tokyo, L=Koganei, O=WIDE, OU=AAA WG, CN=unknown.cs/emailAddress=unknown@ca
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
362 Subject Public Key Info:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
363 Public Key Algorithm: rsaEncryption
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
364 RSA Public Key: (1024 bit)
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
365 Modulus (1024 bit):
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
366 00:e6:3a:d5:8a:14:c8:15:d0:f0:5c:03:c3:af:33:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
367 51:2c:17:b7:65:ac:45:e8:48:2d:ae:70:fd:7c:79:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
368 3a:c7:80:c8:50:53:d0:19:d8:3a:26:a8:16:4d:4c:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
369 04:17:09:df:69:9b:59:2b:89:c8:e0:60:bb:1d:37:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
370 82:d2:3f:17:39:c9:8f:5d:76:e1:0f:6e:08:9a:8f:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
371 16:4a:ea:83:86:f9:bd:15:14:56:68:87:79:05:f9:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
372 5f:66:11:bd:22:46:26:64:be:57:16:51:66:41:50:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
373 ac:f2:b1:ca:d0:38:11:4b:4c:b2:ee:25:36:6e:d3:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
374 b9:63:72:c4:84:82:1c:2b:27
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
375 Exponent: 65537 (0x10001)
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
376 X509v3 extensions:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
377 X509v3 Basic Constraints:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
378 CA:FALSE
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
379 Netscape Comment:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
380 OpenSSL Generated Certificate
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
381 X509v3 Subject Key Identifier:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
382 BA:5A:9D:D2:B0:4B:72:D6:1F:00:11:0B:B5:7B:59:DF:08:38:81:BE
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
383 X509v3 Authority Key Identifier:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
384 keyid:52:C5:A4:63:B8:DB:AC:F2:92:34:2F:72:56:71:C8:11:8E:76:E6:DF
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
385
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
386 Signature Algorithm: sha1WithRSAEncryption
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
387 90:8f:3b:bd:e3:a1:ca:6a:92:a6:fd:f0:64:ae:46:83:32:35:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
388 61:80:57:8b:30:12:70:02:e1:51:d9:87:c8:af:d9:4b:b9:6d:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
389 bf:ab:86:5f:19:1f:dc:af:84:67:bf:3c:bf:33:f3:7c:c6:81:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
390 7b:e4:e9:26:1d:bc:d6:8c:ab:72:94:7f:85:33:95:d9:24:ec:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
391 fd:7b:d2:fd:50:3e:e5:61:4f:75:51:ae:c6:4a:ec:df:cf:aa:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
392 73:a5:08:f7:f3:9a:40:66:48:f0:8e:9b:43:b1:30:f3:e3:c8:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
393 36:3f:68:36:6a:1c:aa:16:40:49:b4:73:9a:71:f1:17:6c:0b:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
394 d3:e1:a7:b7:40:de:2c:3c:36:7c:d4:dd:d6:94:c9:d7:5f:f5:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
395 ae:35:56:e8:cc:65:9c:bb:3d:e8:7a:ca:0e:ed:78:03:41:cb:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
396 fd:80:81:de:f9:de:b2:14:4b:81:24:36:de:29:c1:06:11:86:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
397 8c:a9:b0:0c:c7:57:cf:79:a7:3a:84:0c:27:dc:86:6d:cb:44:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
398 2d:26:dc:7e:fb:17:d6:b2:3d:31:03:d3:f1:ab:5d:91:5d:94:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
399 e4:94:88:70:96:b3:7c:0f:15:fe:c8:c6:4d:99:37:ab:09:0c:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
400 da:ba:b6:0e:fa:5e:bb:4b:ce:04:21:06:09:a9:2c:27:86:76:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
401 cc:ee:73:6f
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
402 */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
403 static char notrust_ca_data[] = "-----BEGIN CERTIFICATE-----\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
404 "MIIEqjCCA5KgAwIBAgIJAP3UMghSlH9PMA0GCSqGSIb3DQEBBQUAMIGUMQswCQYD\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
405 "VQQGEwJKUDEOMAwGA1UECAwFVG9reW8xEDAOBgNVBAcMB0tvZ2FuZWkxDTALBgNV\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
406 "BAoMBFdJREUxDzANBgNVBAsMBkFBQSBXRzEfMB0GA1UEAwwWY2hhdnJvdXguY293\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
407 "YWRkaWN0Lm9yZzEiMCAGCSqGSIb3DQEJARYTc2RlY3VnaXNAbmljdC5nby5qcDAe\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
408 "Fw0wOTEwMjgwODAzNDRaFw0xOTEwMjYwODAzNDRaMIGUMQswCQYDVQQGEwJKUDEO\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
409 "MAwGA1UECAwFVG9reW8xEDAOBgNVBAcMB0tvZ2FuZWkxDTALBgNVBAoMBFdJREUx\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
410 "DzANBgNVBAsMBkFBQSBXRzEfMB0GA1UEAwwWY2hhdnJvdXguY293YWRkaWN0Lm9y\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
411 "ZzEiMCAGCSqGSIb3DQEJARYTc2RlY3VnaXNAbmljdC5nby5qcDCCASIwDQYJKoZI\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
412 "hvcNAQEBBQADggEPADCCAQoCggEBALKW9iSUggF5mbvYe1Xk128Csfiijx+fwH5y\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
413 "ZqWrHNt0YG/tZSwyCDMWBLXTeuYsntg5y0mcpsrN8v02tvrPiCzDfRPyz3mG68us\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
414 "DPEEgQ1kqL2Gsti2DUcsdyZcDM+4rgsWRivgOTVyoNimv5f+xgmPYoElkgelLwZK\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
415 "WxGt1VCebOxP3qZA3hSHWE1hJgL4svful7RD1PbwPzidxJKITyAiJoPKWQA9cjSa\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
416 "gVzRQ7S4vmYALJn7xe+dMFRcfAK8RMv7/gJF6Rw7zufW0DIZK98KZs6aL0lmMPVk\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
417 "f31N2uvndf+cjy0n4luwEoXY+TeJZY205lbwHrzR0rH75FSm0RsCAwEAAaOB/DCB\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
418 "+TAdBgNVHQ4EFgQUUsWkY7jbrPKSNC9yVnHIEY525t8wgckGA1UdIwSBwTCBvoAU\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
419 "UsWkY7jbrPKSNC9yVnHIEY525t+hgZqkgZcwgZQxCzAJBgNVBAYTAkpQMQ4wDAYD\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
420 "VQQIDAVUb2t5bzEQMA4GA1UEBwwHS29nYW5laTENMAsGA1UECgwEV0lERTEPMA0G\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
421 "A1UECwwGQUFBIFdHMR8wHQYDVQQDDBZjaGF2cm91eC5jb3dhZGRpY3Qub3JnMSIw\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
422 "IAYJKoZIhvcNAQkBFhNzZGVjdWdpc0BuaWN0LmdvLmpwggkA/dQyCFKUf08wDAYD\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
423 "VR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEACANo6IR3OQlQaXHJaprVVDvl\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
424 "oMJC0FRbVCK503sbmWTJL98UqxRdsTZNIL07gXlK0oUKyiNijIXiLG8d5IlUrDxF\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
425 "H/Vsu6s8k3/PpAUVeiO2oygWqvU5NGvt0jg54MrOJKhYYPWrzbmHty+cAXyoNzOR\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
426 "+W5RX6HRQgxvZWQq2Ok46VX622R1nNjFmCBYT7I7/gWG+hkbIAoH6d9sULLjpC+B\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
427 "bI+L/N7ac9/Og8pGIgpUI60Gn5zO93+E+Nhg+1BlcDHGnQD6vFNs8LYp5CCX/Zj1\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
428 "tWFVXZnx58odaU3M4t9/ZQnkZdx9YJIroETbN0PoqlnSagBjgUvbWwn4YCotCA==\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
429 "-----END CERTIFICATE-----\n";
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
430
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
431 static char notrust_cert_data[]="-----BEGIN CERTIFICATE-----\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
432 "MIIDhjCCAm6gAwIBAgIBATANBgkqhkiG9w0BAQUFADCBlDELMAkGA1UEBhMCSlAx\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
433 "DjAMBgNVBAgMBVRva3lvMRAwDgYDVQQHDAdLb2dhbmVpMQ0wCwYDVQQKDARXSURF\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
434 "MQ8wDQYDVQQLDAZBQUEgV0cxHzAdBgNVBAMMFmNoYXZyb3V4LmNvd2FkZGljdC5v\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
435 "cmcxIjAgBgkqhkiG9w0BCQEWE3NkZWN1Z2lzQG5pY3QuZ28uanAwHhcNMDkxMDI4\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
436 "MDgwNDQwWhcNMTAxMDI4MDgwNDQwWjB/MQswCQYDVQQGEwJKUDEOMAwGA1UECAwF\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
437 "VG9reW8xEDAOBgNVBAcMB0tvZ2FuZWkxDTALBgNVBAoMBFdJREUxDzANBgNVBAsM\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
438 "BkFBQSBXRzETMBEGA1UEAwwKdW5rbm93bi5jczEZMBcGCSqGSIb3DQEJARYKdW5r\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
439 "bm93bkBjYTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA5jrVihTIFdDwXAPD\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
440 "rzNRLBe3ZaxF6EgtrnD9fHk6x4DIUFPQGdg6JqgWTUwEFwnfaZtZK4nI4GC7HTeC\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
441 "0j8XOcmPXXbhD24Imo8WSuqDhvm9FRRWaId5BflfZhG9IkYmZL5XFlFmQVCs8rHK\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
442 "0DgRS0yy7iU2btO5Y3LEhIIcKycCAwEAAaN7MHkwCQYDVR0TBAIwADAsBglghkgB\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
443 "hvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYE\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
444 "FLpandKwS3LWHwARC7V7Wd8IOIG+MB8GA1UdIwQYMBaAFFLFpGO426zykjQvclZx\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
445 "yBGOdubfMA0GCSqGSIb3DQEBBQUAA4IBAQCQjzu946HKapKm/fBkrkaDMjVhgFeL\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
446 "MBJwAuFR2YfIr9lLuW2/q4ZfGR/cr4Rnvzy/M/N8xoF75OkmHbzWjKtylH+FM5XZ\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
447 "JOz9e9L9UD7lYU91Ua7GSuzfz6pzpQj385pAZkjwjptDsTDz48g2P2g2ahyqFkBJ\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
448 "tHOacfEXbAvT4ae3QN4sPDZ81N3WlMnXX/WuNVbozGWcuz3oesoO7XgDQcv9gIHe\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
449 "+d6yFEuBJDbeKcEGEYaMqbAMx1fPeac6hAwn3IZty0QtJtx++xfWsj0xA9Pxq12R\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
450 "XZTklIhwlrN8DxX+yMZNmTerCQzaurYO+l67S84EIQYJqSwnhnbM7nNv\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
451 "-----END CERTIFICATE-----\n";
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
452 static char notrust_priv_data[]="-----BEGIN RSA PRIVATE KEY-----\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
453 "MIICXQIBAAKBgQDmOtWKFMgV0PBcA8OvM1EsF7dlrEXoSC2ucP18eTrHgMhQU9AZ\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
454 "2DomqBZNTAQXCd9pm1kricjgYLsdN4LSPxc5yY9dduEPbgiajxZK6oOG+b0VFFZo\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
455 "h3kF+V9mEb0iRiZkvlcWUWZBUKzyscrQOBFLTLLuJTZu07ljcsSEghwrJwIDAQAB\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
456 "AoGAeRec1SGVE5Rvt5XrSK0vFofq2DlCE6hTDpszWFLTDbe4pDdRDybhfw+Nm15O\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
457 "EGgK8BrbTcEMvKdkAzv9POQeLDE8JImgesHZFxN3jnkK+b762BGRDt57DzvMJsfj\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
458 "1LBle+UBnZB1CvjrINvu+tNMVPlUpjIstbpMq0D+s01+ijECQQD8MHTv/M+Uc86u\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
459 "1SFywgs+eQPQ8g0OoTLxzqo6YhW8FtwLjoRCZx2TNQS5gYBuQrixd/yE0Spfv9aS\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
460 "UtlAaOc1AkEA6bVufggHVHcgiWqS8CHzb6g/GRxQixVshOsoVLMkCSz04zlwIfXF\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
461 "c03hh5RJVv7jmuBmhHbayujMgvinw75oawJAQb9oXUDt5Wgj1FTgeYi5YbovEoRo\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
462 "fw3ruDsHCl2UCQt0ptarCJzVixFhf/ORRi3C9RGxFfdqMrhS+qb62N4AmQJBALYU\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
463 "T1BLiwJoiWXmLTJ/EP0V9Irov2uMtm5cE6DhrJqlduksz8r1gu7RZ3tMsVLg5Iy+\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
464 "dcCQJOffNa54caQUTZ8CQQDTs/70Nr6F6ktrtmtU/S7lIitpQJCu9u/SPyBYPmFZ\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
465 "9Axy6Ee66Php+eWDNP4Ln4axrapD0732wD8DcmGDVHij\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
466 "-----END RSA PRIVATE KEY-----\n";
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
467
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
468 /* Diffie-Hellman parameters, generated with GNUTLS certtool:
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
469 certtool --generate-dh-params
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
470 Generator: 06
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
471
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
472 Prime: ea:c3:75:0b:32:cf:d9:17:98:5c:da:d1
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
473 e0:1d:b9:7c:be:29:60:b0:6f:68:a9:f6
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
474 8d:75:05:59:69:04:ae:39:7c:2b:74:04
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
475 3c:e2:da:28:8a:9b:93:aa:67:05:a7:3e
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
476 06:3e:0d:31:63:88:55:ad:5a:bd:41:22
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
477 b7:58:a7:45:b3:d5:03:ad:de:3c:8d:69
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
478 42:bf:84:3d:c1:90:e7:39:6a:4b:87:01
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
479 19:e5:f3:a4:e5:8e:e2:45:d5:0c:6b:17
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
480 22:2b:2e:50:83:91:0c:5b:82:fc:72:27
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
481 49:3b:9f:29:11:53:c7:90:b8:8d:87:73
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
482 1a:7b:05:ab:cb:30:59:16:71:30:60:1b
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
483 4c:80:15:3a:a2:d3:47:b7:4a:61:de:64
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
484 7e:79:de:88:53:b7:7a:c6:a2:9a:bb:55
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
485 40:2d:7a:71:c7:41:b5:29:df:d7:5c:fb
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
486 42:e4:d8:5e:0b:99:d3:3c:93:0f:33:51
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
487 8b:f4:60:e4:c5:b5:58:21:c0:51:c4:43
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
488 25:7c:37:fe:5c:d3:62:6c:2a:af:a7:2a
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
489 82:d5:d3:e2:bb:5d:ad:84:15:f6:78:d9
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
490 d5:a8:f7:f0:48:5c:8d:e0:3d:04:ac:cf
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
491 aa:34:3f:5d:f2:0d:3d:ee:ec:b8:d8:e8
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
492 ad:dc:d3:40:59:a0:fd:45:62:47:63:c0
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
493 bd:f5:df:8b
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
494 */
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
495 static char dh_params_data[] = "-----BEGIN DH PARAMETERS-----\n"
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
496 "MIIBCAKCAQEA6sN1CzLP2ReYXNrR4B25fL4pYLBvaKn2jXUFWWkErjl8K3QEPOLa\n"
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
497 "KIqbk6pnBac+Bj4NMWOIVa1avUEit1inRbPVA63ePI1pQr+EPcGQ5zlqS4cBGeXz\n"
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
498 "pOWO4kXVDGsXIisuUIORDFuC/HInSTufKRFTx5C4jYdzGnsFq8swWRZxMGAbTIAV\n"
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
499 "OqLTR7dKYd5kfnneiFO3esaimrtVQC16ccdBtSnf11z7QuTYXguZ0zyTDzNRi/Rg\n"
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
500 "5MW1WCHAUcRDJXw3/lzTYmwqr6cqgtXT4rtdrYQV9njZ1aj38EhcjeA9BKzPqjQ/\n"
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
501 "XfINPe7suNjordzTQFmg/UViR2PAvfXfiwIBBg==\n"
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
502 "-----END DH PARAMETERS-----\n";
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
503
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
504
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
505 /* List server endpoints */
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
506 static struct fd_list eps = FD_LIST_INITIALIZER(eps);
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
507
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
508 /* Pass parameters to the connect thread */
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
509 struct connect_flags {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
510 int proto;
38
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
511 int expect_failure; /* 0 or 1 */
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
512 };
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
513
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
514 /* Client's side of the connection established from a separate thread */
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
515 static void * connect_thr(void * arg)
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
516 {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
517 struct connect_flags * cf = arg;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
518 struct cnxctx * cnx = NULL;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
519
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
520 fd_log_threadname ( "testcnx:connect" );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
521
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
522 /* Connect to the server */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
523 switch (cf->proto) {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
524 case IPPROTO_TCP:
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
525 {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
526 struct fd_endpoint * ep = (struct fd_endpoint *)(eps.next);
246
6418a188c1b5 getnameinfo is also more sensitive on freeBSD
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 208
diff changeset
527 cnx = fd_cnx_cli_connect_tcp( &ep->sa, sSAlen(&ep->ss) );
38
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
528 CHECK( 1, (cnx ? 1 : 0) ^ cf->expect_failure );
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
529 }
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
530 break;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
531 #ifndef DISABLE_SCTP
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
532 case IPPROTO_SCTP:
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
533 {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
534 cnx = fd_cnx_cli_connect_sctp(0, TEST_PORT, &eps);
38
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
535 CHECK( 1, (cnx ? 1 : 0) ^ cf->expect_failure );
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
536 }
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
537 break;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
538 #endif /* DISABLE_SCTP */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
539 default:
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
540 CHECK( 0, 1 );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
541 }
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
542
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
543 /* exit */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
544 return cnx;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
545 }
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
546
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
547 /* Parameters to the handshake thread */
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
548 struct handshake_flags {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
549 struct cnxctx * cnx;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
550 gnutls_certificate_credentials_t creds;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
551 int ret;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
552 };
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
553
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
554 /* Handshake the client's side */
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
555 static void * handshake_thr(void * arg)
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
556 {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
557 struct handshake_flags * hf = arg;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
558 fd_log_threadname ( "testcnx:handshake" );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
559 hf->ret = fd_cnx_handshake(hf->cnx, GNUTLS_CLIENT, NULL, hf->creds);
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
560 return NULL;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
561 }
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
562
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
563 /* Terminate the client's connection side */
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
564 static void * destroy_thr(void * arg)
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
565 {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
566 struct cnxctx * cnx = arg;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
567 fd_log_threadname ( "testcnx:destroy" );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
568 fd_cnx_destroy(cnx);
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
569 return NULL;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
570 }
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
571
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
572 /* Main test routine */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
573 int main(int argc, char *argv[])
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
574 {
403
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 393
diff changeset
575 gnutls_datum_t ca = { (uint8_t *)ca_data, sizeof(ca_data) };
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 393
diff changeset
576 gnutls_datum_t server_cert = { (uint8_t *)server_cert_data, sizeof(server_cert_data) };
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 393
diff changeset
577 gnutls_datum_t server_priv = { (uint8_t *)server_priv_data, sizeof(server_priv_data) };
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 393
diff changeset
578 gnutls_datum_t client_cert = { (uint8_t *)client_cert_data, sizeof(client_cert_data) };
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 393
diff changeset
579 gnutls_datum_t client_priv = { (uint8_t *)client_priv_data, sizeof(client_priv_data) };
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 393
diff changeset
580 gnutls_datum_t expired_cert = { (uint8_t *)expired_cert_data, sizeof(expired_cert_data) };
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 393
diff changeset
581 gnutls_datum_t expired_priv = { (uint8_t *)expired_priv_data, sizeof(expired_priv_data) };
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 393
diff changeset
582 gnutls_datum_t notrust_ca = { (uint8_t *)notrust_ca_data, sizeof(notrust_ca_data) };
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 393
diff changeset
583 gnutls_datum_t notrust_cert = { (uint8_t *)notrust_cert_data, sizeof(notrust_cert_data) };
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 393
diff changeset
584 gnutls_datum_t notrust_priv = { (uint8_t *)notrust_priv_data, sizeof(notrust_priv_data) };
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
585 gnutls_datum_t dh_params = { (uint8_t *)dh_params_data, sizeof(dh_params_data) };
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
586
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
587 /* Listening socket, server side */
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
588 struct cnxctx * listener;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
589 #ifndef DISABLE_SCTP
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
590 struct cnxctx * listener_sctp;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
591 #endif /* DISABLE_SCTP */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
592
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
593 /* Server & client connected sockets */
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
594 struct cnxctx * server_side;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
595 struct cnxctx * client_side;
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
596
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
597 pthread_t thr;
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
598 int ret, i;
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
599 uint8_t * cer_buf;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
600 size_t cer_sz;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
601 uint8_t * rcv_buf;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
602 size_t rcv_sz;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
603
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
604 /* First, initialize the daemon modules */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
605 INIT_FD();
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
606
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
607 /* Restrain the # of streams */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
608 fd_g_config->cnf_sctp_str = NB_STREAMS;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
609
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
610 /* Set the CA parameter in the config */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
611 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( fd_g_config->cnf_sec_data.credentials,
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
612 &ca,
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
613 GNUTLS_X509_FMT_PEM), );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
614 CHECK( 1, ret );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
615
807
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
616 #ifdef GNUTLS_VERSION_300
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
617 {
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
618 /* We import these CA in the trust list */
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
619 gnutls_x509_crt_t * calist;
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
620 unsigned int cacount = 0;
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
621
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
622 CHECK_GNUTLS_DO( ret = gnutls_x509_crt_list_import2(&calist, &cacount, &ca, GNUTLS_X509_FMT_PEM,
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
623 GNUTLS_X509_CRT_LIST_FAIL_IF_UNSORTED), );
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
624 CHECK( 1, cacount );
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
625
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
626 CHECK_GNUTLS_DO( ret = gnutls_x509_trust_list_add_cas (fd_g_config->cnf_sec_data.trustlist, calist, cacount, 0), );
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
627 CHECK( 1, ret );
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
628 }
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
629
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
630 /* Use certificate verification during the handshake */
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
631 gnutls_certificate_set_verify_function (fd_g_config->cnf_sec_data.credentials, fd_tls_verify_credentials_2);
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
632
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
633 #endif /* GNUTLS_VERSION_300 */
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
634
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
635
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
636 /* Set the server credentials (in config) */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
637 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_key_mem( fd_g_config->cnf_sec_data.credentials,
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
638 &server_cert,
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
639 &server_priv,
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
640 GNUTLS_X509_FMT_PEM), );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
641 CHECK( GNUTLS_E_SUCCESS, ret );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
642
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
643 /* Set the default priority */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
644 CHECK_GNUTLS_DO( ret = gnutls_priority_init( &fd_g_config->cnf_sec_data.prio_cache, GNUTLS_DEFAULT_PRIORITY, NULL), );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
645 CHECK( GNUTLS_E_SUCCESS, ret );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
646
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
647 /* Set default DH params */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
648 CHECK_GNUTLS_DO( ret = gnutls_dh_params_import_pkcs3( fd_g_config->cnf_sec_data.dh_cache, &dh_params, GNUTLS_X509_FMT_PEM), );
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
649 CHECK( GNUTLS_E_SUCCESS, ret );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
650
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
651
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
652 /* Initialize the server address (this should give a safe loopback address + port, even on non-standard configs) */
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
653 {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
654 struct addrinfo hints, *ai, *aip;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
655 memset(&hints, 0, sizeof(hints));
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
656 hints.ai_flags = AI_NUMERICSERV;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
657 hints.ai_family = AF_INET;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
658 CHECK( 0, getaddrinfo("localhost", _stringize(TEST_PORT), &hints, &ai) );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
659 aip = ai;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
660 while (aip) {
140
34e47f4addf8 Fix broken test
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 38
diff changeset
661 CHECK( 0, fd_ep_add_merge( &eps, aip->ai_addr, aip->ai_addrlen, EP_FL_DISC | EP_ACCEPTALL ));
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
662 aip = aip->ai_next;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
663 };
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
664 freeaddrinfo(ai);
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
665
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
666 CHECK( 0, FD_IS_LIST_EMPTY(&eps) ? 1 : 0 );
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
667 }
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
668
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
669 /* Start the server(s) */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
670 {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
671 /* TCP server */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
672 listener = fd_cnx_serv_tcp(TEST_PORT, 0, (struct fd_endpoint *)(eps.next));
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
673 CHECK( 1, listener ? 1 : 0 );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
674
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
675 /* Accept incoming clients */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
676 CHECK( 0, fd_cnx_serv_listen(listener));
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
677
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
678 #ifndef DISABLE_SCTP
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
679 /* SCTP server */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
680 listener_sctp = fd_cnx_serv_sctp(TEST_PORT, &eps);
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
681 CHECK( 1, listener_sctp ? 1 : 0 );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
682
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
683 /* Accept incoming clients */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
684 CHECK( 0, fd_cnx_serv_listen(listener_sctp));
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
685 #endif /* DISABLE_SCTP */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
686
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
687 }
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
688
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
689 /* Initialize the CER message */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
690 {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
691 struct msg * cer;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
692 struct dict_object * model = NULL;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
693 struct avp * oh;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
694 union avp_value value;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
695
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
696 /* Find the CER dictionary object */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
697 CHECK( 0, fd_dict_search ( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "Capabilities-Exchange-Request", &model, ENOENT ) );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
698
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
699 /* Create the instance */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
700 CHECK( 0, fd_msg_new ( model, 0, &cer ) );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
701
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
702 /* Now find the Origin-Host dictionary object */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
703 CHECK( 0, fd_dict_search ( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Origin-Host", &model, ENOENT ) );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
704
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
705 /* Create the instance */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
706 CHECK( 0, fd_msg_avp_new ( model, 0, &oh ) );
403
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 393
diff changeset
707 value.os.data = (uint8_t *)"Client.side";
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 393
diff changeset
708 value.os.len = strlen((char *)value.os.data);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
709 CHECK( 0, fd_msg_avp_setvalue ( oh, &value ) );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
710
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
711 /* Add the AVP */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
712 CHECK( 0, fd_msg_avp_add( cer, MSG_BRW_LAST_CHILD, oh) );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
713
688
8c3dc8584dab Prepared capability for messages logging to separate files / folders
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 662
diff changeset
714 #if 0
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
715 /* For debug: dump the object */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
716 fd_log_debug("Dumping CER\n");
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
717 fd_msg_dump_walk(0, cer);
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
718 #endif
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
719
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
720 CHECK( 0, fd_msg_bufferize( cer, &cer_buf, &cer_sz ) );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
721 CHECK( 0, fd_msg_free(cer) );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
722 }
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
723
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
724 /* Simple TCP client / server test (no TLS) */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
725 {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
726 struct connect_flags cf;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
727
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
728 memset(&cf, 0, sizeof(cf));
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
729 cf.proto = IPPROTO_TCP;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
730
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
731 /* Start the client thread */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
732 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
733
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
734 /* Accept the connection of the client */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
735 server_side = fd_cnx_serv_accept(listener);
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
736 CHECK( 1, server_side ? 1 : 0 );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
737 CHECK( 0, fd_cnx_start_clear(server_side, 0) );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
738
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
739 /* Retrieve the client connection object */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
740 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
741 CHECK( 1, client_side ? 1 : 0 );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
742 CHECK( 0, fd_cnx_start_clear(client_side, 0) );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
743
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
744 /* Send a message and receive it */
208
e1da03ba112f Force ordering of messages by using only stream 0 for link-local messages -- avoids issue of DWR arriving before CEA.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 141
diff changeset
745 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz, 0));
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
746 CHECK( 0, fd_cnx_receive(client_side, NULL, &rcv_buf, &rcv_sz));
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
747 CHECK( cer_sz, rcv_sz );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
748 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
749 free(rcv_buf);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
750
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
751 /* Do it in the other direction */
208
e1da03ba112f Force ordering of messages by using only stream 0 for link-local messages -- avoids issue of DWR arriving before CEA.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 141
diff changeset
752 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz, 0));
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
753 CHECK( 0, fd_cnx_receive(server_side, NULL, &rcv_buf, &rcv_sz));
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
754 CHECK( cer_sz, rcv_sz );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
755 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
756 free(rcv_buf);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
757
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
758 /* Now close the connections */
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
759 fd_cnx_destroy(client_side);
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
760 fd_cnx_destroy(server_side);
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
761 }
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
762
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
763 #ifndef DISABLE_SCTP
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
764 /* Simple SCTP client / server test (no TLS) */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
765 {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
766 struct connect_flags cf;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
767
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
768 memset(&cf, 0, sizeof(cf));
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
769 cf.proto = IPPROTO_SCTP;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
770
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
771 /* Start the client thread */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
772 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
773
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
774 /* Accept the connection of the client */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
775 server_side = fd_cnx_serv_accept(listener_sctp);
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
776 CHECK( 1, server_side ? 1 : 0 );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
777
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
778 /* Retrieve the client connection object */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
779 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
780 CHECK( 1, client_side ? 1 : 0 );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
781
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
782 CHECK( 0, fd_cnx_start_clear(server_side, 1) );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
783
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
784 /* Send a message and receive it */
208
e1da03ba112f Force ordering of messages by using only stream 0 for link-local messages -- avoids issue of DWR arriving before CEA.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 141
diff changeset
785 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz, 0));
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
786 CHECK( EINVAL, fd_cnx_receive(client_side, NULL, &rcv_buf, &rcv_sz));
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
787 CHECK( 0, fd_cnx_start_clear(client_side, 0) );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
788 CHECK( 0, fd_cnx_receive(client_side, NULL, &rcv_buf, &rcv_sz));
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
789 CHECK( cer_sz, rcv_sz );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
790 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
791 free(rcv_buf);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
792
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
793 /* Do it in the other direction */
208
e1da03ba112f Force ordering of messages by using only stream 0 for link-local messages -- avoids issue of DWR arriving before CEA.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 141
diff changeset
794 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz, 0));
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
795 CHECK( 0, fd_cnx_receive(server_side, NULL, &rcv_buf, &rcv_sz));
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
796 CHECK( cer_sz, rcv_sz );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
797 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
798 free(rcv_buf);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
799
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
800 /* Do it one more time to use another stream */
208
e1da03ba112f Force ordering of messages by using only stream 0 for link-local messages -- avoids issue of DWR arriving before CEA.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 141
diff changeset
801 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz, 0));
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
802 CHECK( 0, fd_cnx_receive(server_side, NULL, &rcv_buf, &rcv_sz));
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
803 CHECK( cer_sz, rcv_sz );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
804 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
805 free(rcv_buf);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
806
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
807 /* Now close the connection */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
808 fd_cnx_destroy(client_side);
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
809 fd_cnx_destroy(server_side);
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
810 }
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
811 #endif /* DISABLE_SCTP */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
812
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
813 /* TCP Client / server emulating old Diameter behavior (handshake after 1 message exchange) */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
814 {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
815 struct connect_flags cf;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
816 struct handshake_flags hf;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
817
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
818 memset(&cf, 0, sizeof(cf));
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
819 cf.proto = IPPROTO_TCP;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
820
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
821 memset(&hf, 0, sizeof(hf));
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
822
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
823 /* Initialize remote certificate */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
824 CHECK_GNUTLS_DO( ret = gnutls_certificate_allocate_credentials (&hf.creds), );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
825 CHECK( GNUTLS_E_SUCCESS, ret );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
826 /* Set the CA */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
827 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &ca, GNUTLS_X509_FMT_PEM), );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
828 CHECK( 1, ret );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
829 /* Set the key */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
830 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_key_mem( hf.creds, &client_cert, &client_priv, GNUTLS_X509_FMT_PEM), );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
831 CHECK( GNUTLS_E_SUCCESS, ret );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
832
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
833 /* Start the client thread */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
834 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
835
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
836 /* Accept the connection of the client */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
837 server_side = fd_cnx_serv_accept(listener);
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
838 CHECK( 1, server_side ? 1 : 0 );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
839
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
840 /* Retrieve the client connection object */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
841 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
842 CHECK( 1, client_side ? 1 : 0 );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
843 hf.cnx = client_side;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
844
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
845 /* In legacy Diameter, we exchange first one message (CER / CEA) */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
846
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
847 CHECK( 0, fd_cnx_start_clear(server_side, 0) );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
848 CHECK( 0, fd_cnx_start_clear(client_side, 0) );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
849
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
850 /* Send a message and receive it */
208
e1da03ba112f Force ordering of messages by using only stream 0 for link-local messages -- avoids issue of DWR arriving before CEA.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 141
diff changeset
851 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz, 0));
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
852 CHECK( 0, fd_cnx_receive(client_side, NULL, &rcv_buf, &rcv_sz));
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
853 CHECK( cer_sz, rcv_sz );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
854 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
855 free(rcv_buf);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
856
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
857 /* And the supposed reply */
208
e1da03ba112f Force ordering of messages by using only stream 0 for link-local messages -- avoids issue of DWR arriving before CEA.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 141
diff changeset
858 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz, 0));
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
859 CHECK( 0, fd_cnx_receive(server_side, NULL, &rcv_buf, &rcv_sz));
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
860 CHECK( cer_sz, rcv_sz );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
861 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
862 free(rcv_buf);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
863
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
864 /* At this point in legacy Diameter we start the handshake */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
865 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
866 CHECK( 0, fd_cnx_handshake(server_side, GNUTLS_SERVER, NULL, NULL) );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
867 CHECK( 0, pthread_join(thr, NULL) );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
868 CHECK( 0, hf.ret );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
869
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
870 /* Send a few TLS protected message, and replies */
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
871 for (i = 0; i < 2 * NB_STREAMS; i++) {
208
e1da03ba112f Force ordering of messages by using only stream 0 for link-local messages -- avoids issue of DWR arriving before CEA.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 141
diff changeset
872 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz, 0));
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
873 CHECK( 0, fd_cnx_receive(client_side, NULL, &rcv_buf, &rcv_sz));
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
874 CHECK( cer_sz, rcv_sz );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
875 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
876 free(rcv_buf);
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
877
208
e1da03ba112f Force ordering of messages by using only stream 0 for link-local messages -- avoids issue of DWR arriving before CEA.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 141
diff changeset
878 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz, 0));
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
879 CHECK( 0, fd_cnx_receive(server_side, NULL, &rcv_buf, &rcv_sz));
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
880 CHECK( cer_sz, rcv_sz );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
881 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
882 free(rcv_buf);
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
883 }
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
884
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
885
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
886 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
887 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
888 fd_cnx_destroy(server_side);
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
889 CHECK( 0, pthread_join(thr, NULL) );
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
890
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
891 /* Free the credentials */
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
892 gnutls_certificate_free_keys(hf.creds);
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
893 gnutls_certificate_free_cas(hf.creds);
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
894 gnutls_certificate_free_credentials(hf.creds);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
895 }
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
896
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
897 #ifndef DISABLE_SCTP
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
898 /* SCTP Client / server emulating old Diameter behavior (handshake after 1 message exchange) */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
899 {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
900 struct connect_flags cf;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
901 struct handshake_flags hf;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
902
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
903 memset(&cf, 0, sizeof(cf));
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
904 cf.proto = IPPROTO_SCTP;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
905
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
906 memset(&hf, 0, sizeof(hf));
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
907
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
908 /* Initialize remote certificate */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
909 CHECK_GNUTLS_DO( ret = gnutls_certificate_allocate_credentials (&hf.creds), );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
910 CHECK( GNUTLS_E_SUCCESS, ret );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
911 /* Set the CA */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
912 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &ca, GNUTLS_X509_FMT_PEM), );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
913 CHECK( 1, ret );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
914 /* Set the key */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
915 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_key_mem( hf.creds, &client_cert, &client_priv, GNUTLS_X509_FMT_PEM), );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
916 CHECK( GNUTLS_E_SUCCESS, ret );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
917
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
918 /* Start the client thread */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
919 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
920
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
921 /* Accept the connection of the client */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
922 server_side = fd_cnx_serv_accept(listener_sctp);
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
923 CHECK( 1, server_side ? 1 : 0 );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
924
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
925 /* Retrieve the client connection object */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
926 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
927 CHECK( 1, client_side ? 1 : 0 );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
928 hf.cnx = client_side;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
929
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
930 /* In legacy Diameter, we exchange first one message (CER / CEA) */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
931
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
932 CHECK( 0, fd_cnx_start_clear(server_side, 0) );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
933 CHECK( 0, fd_cnx_start_clear(client_side, 0) );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
934
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
935 /* Send a message and receive it */
208
e1da03ba112f Force ordering of messages by using only stream 0 for link-local messages -- avoids issue of DWR arriving before CEA.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 141
diff changeset
936 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz, 0));
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
937 CHECK( 0, fd_cnx_receive(client_side, NULL, &rcv_buf, &rcv_sz));
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
938 CHECK( cer_sz, rcv_sz );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
939 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
940 free(rcv_buf);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
941
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
942 /* And the supposed reply */
208
e1da03ba112f Force ordering of messages by using only stream 0 for link-local messages -- avoids issue of DWR arriving before CEA.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 141
diff changeset
943 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz, 0));
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
944 CHECK( 0, fd_cnx_receive(server_side, NULL, &rcv_buf, &rcv_sz));
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
945 CHECK( cer_sz, rcv_sz );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
946 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
947 free(rcv_buf);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
948
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
949 /* At this point in legacy Diameter we start the handshake */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
950 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
951 CHECK( 0, fd_cnx_handshake(server_side, GNUTLS_SERVER, NULL, NULL) );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
952 CHECK( 0, pthread_join(thr, NULL) );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
953 CHECK( 0, hf.ret );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
954
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
955 /* Send a few TLS protected message, and replies */
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
956 for (i = 0; i < 2 * NB_STREAMS; i++) {
208
e1da03ba112f Force ordering of messages by using only stream 0 for link-local messages -- avoids issue of DWR arriving before CEA.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 141
diff changeset
957 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz, 0));
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
958 CHECK( 0, fd_cnx_receive(client_side, NULL, &rcv_buf, &rcv_sz));
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
959 CHECK( cer_sz, rcv_sz );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
960 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
961 free(rcv_buf);
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
962
208
e1da03ba112f Force ordering of messages by using only stream 0 for link-local messages -- avoids issue of DWR arriving before CEA.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 141
diff changeset
963 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz, 0));
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
964 CHECK( 0, fd_cnx_receive(server_side, NULL, &rcv_buf, &rcv_sz));
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
965 CHECK( cer_sz, rcv_sz );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
966 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
967 free(rcv_buf);
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
968 }
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
969
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
970
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
971 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
972 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
973 fd_cnx_destroy(server_side);
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
974 CHECK( 0, pthread_join(thr, NULL) );
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
975
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
976 /* Free the credentials */
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
977 gnutls_certificate_free_keys(hf.creds);
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
978 gnutls_certificate_free_cas(hf.creds);
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
979 gnutls_certificate_free_credentials(hf.creds);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
980 }
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
981 #endif /* DISABLE_SCTP */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
982
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
983 /* TCP Client / server emulating new Diameter behavior (handshake at connection directly) */
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
984 {
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
985 struct connect_flags cf;
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
986 struct handshake_flags hf;
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
987
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
988 memset(&cf, 0, sizeof(cf));
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
989 cf.proto = IPPROTO_TCP;
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
990
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
991 memset(&hf, 0, sizeof(hf));
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
992
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
993 /* Initialize remote certificate */
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
994 CHECK_GNUTLS_DO( ret = gnutls_certificate_allocate_credentials (&hf.creds), );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
995 CHECK( GNUTLS_E_SUCCESS, ret );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
996 /* Set the CA */
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
997 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &ca, GNUTLS_X509_FMT_PEM), );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
998 CHECK( 1, ret );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
999 /* Set the key */
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1000 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_key_mem( hf.creds, &client_cert, &client_priv, GNUTLS_X509_FMT_PEM), );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1001 CHECK( GNUTLS_E_SUCCESS, ret );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1002
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1003 /* Start the client thread */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1004 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1005
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1006 /* Accept the connection of the client */
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1007 server_side = fd_cnx_serv_accept(listener);
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1008 CHECK( 1, server_side ? 1 : 0 );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1009
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1010 /* Retrieve the client connection object */
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1011 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1012 CHECK( 1, client_side ? 1 : 0 );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1013 hf.cnx = client_side;
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1014
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1015 /* Start the handshake directly */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1016 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1017 CHECK( 0, fd_cnx_handshake(server_side, GNUTLS_SERVER, NULL, NULL) );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1018 CHECK( 0, pthread_join(thr, NULL) );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1019 CHECK( 0, hf.ret );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1020
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1021 /* Send a few TLS protected message, and replies */
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1022 for (i = 0; i < 2 * NB_STREAMS; i++) {
208
e1da03ba112f Force ordering of messages by using only stream 0 for link-local messages -- avoids issue of DWR arriving before CEA.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 141
diff changeset
1023 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz, 0));
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1024 CHECK( 0, fd_cnx_receive(client_side, NULL, &rcv_buf, &rcv_sz));
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1025 CHECK( cer_sz, rcv_sz );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1026 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1027 free(rcv_buf);
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1028
208
e1da03ba112f Force ordering of messages by using only stream 0 for link-local messages -- avoids issue of DWR arriving before CEA.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 141
diff changeset
1029 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz, 0));
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1030 CHECK( 0, fd_cnx_receive(server_side, NULL, &rcv_buf, &rcv_sz));
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1031 CHECK( cer_sz, rcv_sz );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1032 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1033 free(rcv_buf);
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1034 }
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1035
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1036 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1037 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1038 fd_cnx_destroy(server_side);
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1039 CHECK( 0, pthread_join(thr, NULL) );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1040
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1041 /* Free the credentials */
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1042 gnutls_certificate_free_keys(hf.creds);
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1043 gnutls_certificate_free_cas(hf.creds);
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1044 gnutls_certificate_free_credentials(hf.creds);
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1045 }
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1046
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1047 #ifndef DISABLE_SCTP
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1048 /* SCTP Client / server emulating new Diameter behavior (handshake at connection directly) */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1049 {
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1050 struct connect_flags cf;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1051 struct handshake_flags hf;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1052
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1053 memset(&cf, 0, sizeof(cf));
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1054 cf.proto = IPPROTO_SCTP;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1055
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1056 memset(&hf, 0, sizeof(hf));
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1057
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1058 /* Initialize remote certificate */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1059 CHECK_GNUTLS_DO( ret = gnutls_certificate_allocate_credentials (&hf.creds), );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1060 CHECK( GNUTLS_E_SUCCESS, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1061 /* Set the CA */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1062 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &ca, GNUTLS_X509_FMT_PEM), );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1063 CHECK( 1, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1064 /* Set the key */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1065 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_key_mem( hf.creds, &client_cert, &client_priv, GNUTLS_X509_FMT_PEM), );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1066 CHECK( GNUTLS_E_SUCCESS, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1067
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1068 /* Start the client thread */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1069 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1070
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1071 /* Accept the connection of the client */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1072 server_side = fd_cnx_serv_accept(listener_sctp);
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1073 CHECK( 1, server_side ? 1 : 0 );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1074
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1075 /* Retrieve the client connection object */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1076 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1077 CHECK( 1, client_side ? 1 : 0 );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1078 hf.cnx = client_side;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1079
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1080 /* Start the handshake directly */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1081 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1082 CHECK( 0, fd_cnx_handshake(server_side, GNUTLS_SERVER, NULL, NULL) );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1083 CHECK( 0, pthread_join(thr, NULL) );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1084 CHECK( 0, hf.ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1085
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1086 /* Send a few TLS protected messages, and replies */
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1087 for (i = 0; i < 2 * NB_STREAMS; i++) {
208
e1da03ba112f Force ordering of messages by using only stream 0 for link-local messages -- avoids issue of DWR arriving before CEA.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 141
diff changeset
1088 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz, 0));
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1089 CHECK( 0, fd_cnx_receive(client_side, NULL, &rcv_buf, &rcv_sz));
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1090 CHECK( cer_sz, rcv_sz );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1091 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1092 free(rcv_buf);
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1093
208
e1da03ba112f Force ordering of messages by using only stream 0 for link-local messages -- avoids issue of DWR arriving before CEA.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 141
diff changeset
1094 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz, 0));
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1095 CHECK( 0, fd_cnx_receive(server_side, NULL, &rcv_buf, &rcv_sz));
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1096 CHECK( cer_sz, rcv_sz );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1097 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1098 free(rcv_buf);
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1099 }
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1100
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1101
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1102 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1103 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1104 fd_cnx_destroy(server_side);
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1105 CHECK( 0, pthread_join(thr, NULL) );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1106
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1107 /* Free the credentials */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1108 gnutls_certificate_free_keys(hf.creds);
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1109 gnutls_certificate_free_cas(hf.creds);
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1110 gnutls_certificate_free_credentials(hf.creds);
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1111 }
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1112 #endif /* DISABLE_SCTP */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1113
393
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1114 /* Test with different number of streams between server and client */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1115 #ifndef DISABLE_SCTP
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1116 {
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1117 struct connect_flags cf;
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1118 struct handshake_flags hf;
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1119
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1120 memset(&cf, 0, sizeof(cf));
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1121 cf.proto = IPPROTO_SCTP;
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1122
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1123 memset(&hf, 0, sizeof(hf));
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1124
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1125 /* Initialize remote certificate */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1126 CHECK_GNUTLS_DO( ret = gnutls_certificate_allocate_credentials (&hf.creds), );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1127 CHECK( GNUTLS_E_SUCCESS, ret );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1128 /* Set the CA */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1129 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &ca, GNUTLS_X509_FMT_PEM), );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1130 CHECK( 1, ret );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1131 /* Set the key */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1132 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_key_mem( hf.creds, &client_cert, &client_priv, GNUTLS_X509_FMT_PEM), );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1133 CHECK( GNUTLS_E_SUCCESS, ret );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1134
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1135 /* Start the client thread with more streams than the server */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1136 fd_g_config->cnf_sctp_str = 2 * NB_STREAMS;
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1137 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
393
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1138
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1139 /* Accept the connection of the client */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1140 server_side = fd_cnx_serv_accept(listener_sctp);
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1141 CHECK( 1, server_side ? 1 : 0 );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1142
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1143 /* Retrieve the client connection object */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1144 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1145 CHECK( 1, client_side ? 1 : 0 );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1146 hf.cnx = client_side;
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1147
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1148 /* Start the handshake directly */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1149 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
393
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1150 CHECK( 0, fd_cnx_handshake(server_side, GNUTLS_SERVER, NULL, NULL) );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1151 CHECK( 0, pthread_join(thr, NULL) );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1152 CHECK( 0, hf.ret );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1153
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1154 /* Send a few TLS protected message, and replies */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1155 for (i = 0; i < 4 * NB_STREAMS; i++) {
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1156 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz, 0));
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1157 CHECK( 0, fd_cnx_receive(client_side, NULL, &rcv_buf, &rcv_sz));
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1158 CHECK( cer_sz, rcv_sz );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1159 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1160 free(rcv_buf);
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1161
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1162 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz, 0));
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1163 CHECK( 0, fd_cnx_receive(server_side, NULL, &rcv_buf, &rcv_sz));
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1164 CHECK( cer_sz, rcv_sz );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1165 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1166 free(rcv_buf);
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1167 }
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1168
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1169 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1170 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
393
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1171 fd_cnx_destroy(server_side);
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1172 CHECK( 0, pthread_join(thr, NULL) );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1173
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1174 /* Do the same test but with more streams on the server this time */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1175 fd_g_config->cnf_sctp_str = NB_STREAMS / 2;
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1176 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
393
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1177
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1178 /* Accept the connection of the client */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1179 server_side = fd_cnx_serv_accept(listener_sctp);
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1180 CHECK( 1, server_side ? 1 : 0 );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1181
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1182 /* Retrieve the client connection object */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1183 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1184 CHECK( 1, client_side ? 1 : 0 );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1185 hf.cnx = client_side;
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1186
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1187 /* Start the handshake directly */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1188 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
393
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1189 CHECK( 0, fd_cnx_handshake(server_side, GNUTLS_SERVER, NULL, NULL) );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1190 CHECK( 0, pthread_join(thr, NULL) );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1191 CHECK( 0, hf.ret );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1192
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1193 /* Send a few TLS protected message, and replies */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1194 for (i = 0; i < 2 * NB_STREAMS; i++) {
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1195 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz, 0));
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1196 CHECK( 0, fd_cnx_receive(client_side, NULL, &rcv_buf, &rcv_sz));
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1197 CHECK( cer_sz, rcv_sz );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1198 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1199 free(rcv_buf);
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1200
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1201 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz, 0));
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1202 CHECK( 0, fd_cnx_receive(server_side, NULL, &rcv_buf, &rcv_sz));
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1203 CHECK( cer_sz, rcv_sz );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1204 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1205 free(rcv_buf);
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1206 }
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1207
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1208 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1209 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
393
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1210 fd_cnx_destroy(server_side);
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1211 CHECK( 0, pthread_join(thr, NULL) );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1212
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1213
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1214 /* Free the credentials */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1215 gnutls_certificate_free_keys(hf.creds);
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1216 gnutls_certificate_free_cas(hf.creds);
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1217 gnutls_certificate_free_credentials(hf.creds);
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1218 }
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1219 #endif /* DISABLE_SCTP */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1220
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1221
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1222 /* Basic operation tested successfully, now test we detect error conditions */
807
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
1223
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1224 /* Untrusted certificate, TCP */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1225 {
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1226 struct connect_flags cf;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1227 struct handshake_flags hf;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1228
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1229 memset(&cf, 0, sizeof(cf));
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1230 cf.proto = IPPROTO_TCP;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1231
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1232 memset(&hf, 0, sizeof(hf));
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1233
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1234 /* Initialize remote certificate */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1235 CHECK_GNUTLS_DO( ret = gnutls_certificate_allocate_credentials (&hf.creds), );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1236 CHECK( GNUTLS_E_SUCCESS, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1237 /* Set the CA */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1238 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &notrust_ca, GNUTLS_X509_FMT_PEM), );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1239 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &ca, GNUTLS_X509_FMT_PEM), );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1240 CHECK( 1, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1241 /* Set the key */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1242 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_key_mem( hf.creds, &notrust_cert, &notrust_priv, GNUTLS_X509_FMT_PEM), );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1243 CHECK( GNUTLS_E_SUCCESS, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1244
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1245 /* Start the client thread */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1246 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1247
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1248 /* Accept the connection of the client */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1249 server_side = fd_cnx_serv_accept(listener);
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1250 CHECK( 1, server_side ? 1 : 0 );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1251
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1252 /* Retrieve the client connection object */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1253 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1254 CHECK( 1, client_side ? 1 : 0 );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1255 hf.cnx = client_side;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1256
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1257 /* Start the handshake directly */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1258 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1259 CHECK( EINVAL, fd_cnx_handshake(server_side, GNUTLS_SERVER, NULL, NULL) );
807
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
1260 fd_cnx_destroy(server_side);
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
1261
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1262 CHECK( 0, pthread_join(thr, NULL) );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1263
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1264 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1265 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1266 CHECK( 0, pthread_join(thr, NULL) );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1267
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1268 /* Free the credentials */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1269 gnutls_certificate_free_keys(hf.creds);
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1270 gnutls_certificate_free_cas(hf.creds);
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1271 gnutls_certificate_free_credentials(hf.creds);
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1272 }
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1273
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1274 /* Same in SCTP */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1275 #ifndef DISABLE_SCTP
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1276 {
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1277 struct connect_flags cf;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1278 struct handshake_flags hf;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1279
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1280 memset(&cf, 0, sizeof(cf));
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1281 cf.proto = IPPROTO_SCTP;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1282
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1283 memset(&hf, 0, sizeof(hf));
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1284
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1285 /* Initialize remote certificate */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1286 CHECK_GNUTLS_DO( ret = gnutls_certificate_allocate_credentials (&hf.creds), );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1287 CHECK( GNUTLS_E_SUCCESS, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1288 /* Set the CA */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1289 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &notrust_ca, GNUTLS_X509_FMT_PEM), );
807
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
1290 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &ca, GNUTLS_X509_FMT_PEM), );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1291 CHECK( 1, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1292 /* Set the key */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1293 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_key_mem( hf.creds, &notrust_cert, &notrust_priv, GNUTLS_X509_FMT_PEM), );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1294 CHECK( GNUTLS_E_SUCCESS, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1295
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1296 /* Start the client thread */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1297 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1298
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1299 /* Accept the connection of the client */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1300 server_side = fd_cnx_serv_accept(listener_sctp);
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1301 CHECK( 1, server_side ? 1 : 0 );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1302
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1303 /* Retrieve the client connection object */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1304 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1305 CHECK( 1, client_side ? 1 : 0 );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1306 hf.cnx = client_side;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1307
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1308 /* Start the handshake directly */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1309 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1310 CHECK( EINVAL, fd_cnx_handshake(server_side, GNUTLS_SERVER, NULL, NULL) );
807
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
1311 fd_cnx_destroy(server_side);
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1312 CHECK( 0, pthread_join(thr, NULL) );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1313
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1314 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1315 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1316 CHECK( 0, pthread_join(thr, NULL) );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1317
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1318 /* Free the credentials */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1319 gnutls_certificate_free_keys(hf.creds);
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1320 gnutls_certificate_free_cas(hf.creds);
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1321 gnutls_certificate_free_credentials(hf.creds);
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1322 }
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1323 #endif /* DISABLE_SCTP */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1324
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1325 /* Expired certificate */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1326 {
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1327 struct connect_flags cf;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1328 struct handshake_flags hf;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1329
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1330 memset(&cf, 0, sizeof(cf));
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1331 cf.proto = IPPROTO_TCP;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1332
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1333 memset(&hf, 0, sizeof(hf));
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1334
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1335 /* Initialize remote certificate */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1336 CHECK_GNUTLS_DO( ret = gnutls_certificate_allocate_credentials (&hf.creds), );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1337 CHECK( GNUTLS_E_SUCCESS, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1338 /* Set the CA */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1339 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &ca, GNUTLS_X509_FMT_PEM), );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1340 CHECK( 1, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1341 /* Set the key */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1342 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_key_mem( hf.creds, &expired_cert, &expired_priv, GNUTLS_X509_FMT_PEM), );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1343 CHECK( GNUTLS_E_SUCCESS, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1344
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1345 /* Start the client thread */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1346 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1347
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1348 /* Accept the connection of the client */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1349 server_side = fd_cnx_serv_accept(listener);
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1350 CHECK( 1, server_side ? 1 : 0 );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1351
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1352 /* Retrieve the client connection object */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1353 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1354 CHECK( 1, client_side ? 1 : 0 );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1355 hf.cnx = client_side;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1356
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1357 /* Start the handshake directly */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1358 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1359 CHECK( EINVAL, fd_cnx_handshake(server_side, GNUTLS_SERVER, NULL, NULL) );
807
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
1360 fd_cnx_destroy(server_side);
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1361 CHECK( 0, pthread_join(thr, NULL) );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1362
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1363 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1364 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1365 CHECK( 0, pthread_join(thr, NULL) );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1366
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1367 /* Free the credentials */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1368 gnutls_certificate_free_keys(hf.creds);
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1369 gnutls_certificate_free_cas(hf.creds);
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1370 gnutls_certificate_free_credentials(hf.creds);
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1371 }
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1372
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1373 /* Non matching hostname */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1374
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1375 {
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1376 struct connect_flags cf;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1377 struct handshake_flags hf;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1378
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1379 memset(&cf, 0, sizeof(cf));
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1380 cf.proto = IPPROTO_TCP;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1381
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1382 memset(&hf, 0, sizeof(hf));
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1383
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1384 /* Initialize remote certificate */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1385 CHECK_GNUTLS_DO( ret = gnutls_certificate_allocate_credentials (&hf.creds), );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1386 CHECK( GNUTLS_E_SUCCESS, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1387 /* Set the CA */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1388 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &ca, GNUTLS_X509_FMT_PEM), );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1389 CHECK( 1, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1390 /* Set the key */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1391 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_key_mem( hf.creds, &client_cert, &client_priv, GNUTLS_X509_FMT_PEM), );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1392 CHECK( GNUTLS_E_SUCCESS, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1393
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1394 /* Start the client thread */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1395 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1396
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1397 /* Accept the connection of the client */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1398 server_side = fd_cnx_serv_accept(listener);
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1399 CHECK( 1, server_side ? 1 : 0 );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1400
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1401 /* Retrieve the client connection object */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1402 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1403 CHECK( 1, client_side ? 1 : 0 );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1404 hf.cnx = client_side;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1405
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1406 /* Set the correct hostname we expect from the client (in the server) */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1407 fd_cnx_sethostname(server_side, "client.test");
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1408
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1409 /* Start the handshake, check it is successful */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1410 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1411 CHECK( 0, fd_cnx_handshake(server_side, GNUTLS_SERVER, NULL, NULL) );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1412 CHECK( 0, pthread_join(thr, NULL) );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1413 CHECK( 0, hf.ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1414
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1415 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1416 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1417 fd_cnx_destroy(server_side);
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1418 CHECK( 0, pthread_join(thr, NULL) );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1419
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1420 /* Do it again with an invalid hostname */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1421 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1422
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1423 /* Accept the connection of the client */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1424 server_side = fd_cnx_serv_accept(listener);
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1425 CHECK( 1, server_side ? 1 : 0 );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1426
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1427 /* Retrieve the client connection object */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1428 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1429 CHECK( 1, client_side ? 1 : 0 );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1430 hf.cnx = client_side;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1431
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1432 /* Set the correct hostname we expect from the client (in the server) */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1433 fd_cnx_sethostname(server_side, "nomatch.test");
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1434
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1435 /* Start the handshake, check it is successful */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1436 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1437 CHECK( EINVAL, fd_cnx_handshake(server_side, GNUTLS_SERVER, NULL, NULL) );
807
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
1438 fd_cnx_destroy(server_side);
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1439 CHECK( 0, pthread_join(thr, NULL) );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1440
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1441 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1442 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1443 CHECK( 0, pthread_join(thr, NULL) );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1444
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1445 /* Free the credentials */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1446 gnutls_certificate_free_keys(hf.creds);
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1447 gnutls_certificate_free_cas(hf.creds);
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1448 gnutls_certificate_free_credentials(hf.creds);
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1449 }
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1450
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1451 /* Test the other functions of the module */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1452 {
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1453 struct connect_flags cf;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1454 struct handshake_flags hf;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1455 char * str;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1456 const gnutls_datum_t *cert_list;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1457 unsigned int cert_list_size;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1458 struct fifo * myfifo = NULL;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1459 struct timespec now;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1460 int ev_code;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1461
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1462 memset(&cf, 0, sizeof(cf));
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1463 cf.proto = IPPROTO_TCP;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1464
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1465 memset(&hf, 0, sizeof(hf));
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1466
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1467 /* Initialize remote certificate */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1468 CHECK_GNUTLS_DO( ret = gnutls_certificate_allocate_credentials (&hf.creds), );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1469 CHECK( GNUTLS_E_SUCCESS, ret );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1470 /* Set the CA */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1471 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &ca, GNUTLS_X509_FMT_PEM), );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1472 CHECK( 1, ret );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1473 /* Set the key */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1474 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_key_mem( hf.creds, &client_cert, &client_priv, GNUTLS_X509_FMT_PEM), );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1475 CHECK( GNUTLS_E_SUCCESS, ret );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1476
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1477 /* Start the client thread */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1478 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1479
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1480 /* Accept the connection of the client */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1481 server_side = fd_cnx_serv_accept(listener);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1482 CHECK( 1, server_side ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1483
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1484 /* Retrieve the client connection object */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1485 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1486 CHECK( 1, client_side ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1487 hf.cnx = client_side;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1488
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1489 /* Start the handshake */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1490 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1491 CHECK( 0, fd_cnx_handshake(server_side, GNUTLS_SERVER, NULL, NULL) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1492 CHECK( 0, pthread_join(thr, NULL) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1493 CHECK( 0, hf.ret );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1494
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1495 /* Test some simple functions */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1496
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1497 /* fd_cnx_getid */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1498 str = fd_cnx_getid(server_side);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1499 CHECK( 1, str ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1500 CHECK( 1, (str[0] != '\0') ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1501
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1502 /* fd_cnx_getproto */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1503 i = fd_cnx_getproto(server_side);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1504 CHECK( IPPROTO_TCP, i);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1505
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1506 /* fd_cnx_getTLS */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1507 i = fd_cnx_getTLS(server_side);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1508 CHECK( 1, i ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1509
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1510 /* fd_cnx_getcred */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1511 CHECK( 0, fd_cnx_getcred(server_side, &cert_list, &cert_list_size) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1512 CHECK( 1, (cert_list_size > 0) ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1513 /* We could also verify that the cert_list really contains the client_cert and ca certificates */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1514
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1515 /* fd_cnx_getremoteid */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1516 str = fd_cnx_getremoteid(server_side);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1517 CHECK( 1, str ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1518 CHECK( 1, (str[0] != '\0') ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1519
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1520 /* fd_cnx_recv_setaltfifo */
208
e1da03ba112f Force ordering of messages by using only stream 0 for link-local messages -- avoids issue of DWR arriving before CEA.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 141
diff changeset
1521 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz, 0));
767
c47c16436f71 Added a limit on fifo queues to avoid memory exaustion when messages are received faster than handled
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
1522 CHECK( 0, fd_fifo_new(&myfifo, 0) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1523 CHECK( 0, fd_cnx_recv_setaltfifo(server_side, myfifo) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1524 CHECK( 0, clock_gettime(CLOCK_REALTIME, &now) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1525 do {
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1526 CHECK( 0, fd_event_timedget(myfifo, &now, ETIMEDOUT, &ev_code, NULL, (void *)&rcv_buf) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1527 free(rcv_buf);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1528 } while (ev_code != FDEVP_CNX_MSG_RECV);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1529 fd_event_destroy(&myfifo, free);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1530
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1531 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1532 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1533 fd_cnx_destroy(server_side);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1534 CHECK( 0, pthread_join(thr, NULL) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1535
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1536 /* Free the credentials */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1537 gnutls_certificate_free_keys(hf.creds);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1538 gnutls_certificate_free_cas(hf.creds);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1539 gnutls_certificate_free_credentials(hf.creds);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1540 }
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1541
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1542 #ifndef DISABLE_SCTP
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1543 /* And re-test with a SCTP connection */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1544 {
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1545 struct connect_flags cf;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1546 struct handshake_flags hf;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1547 char * str;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1548 const gnutls_datum_t *cert_list;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1549 unsigned int cert_list_size;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1550 struct fifo * myfifo = NULL;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1551 struct timespec now;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1552 int ev_code;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1553
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1554 memset(&cf, 0, sizeof(cf));
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1555 cf.proto = IPPROTO_SCTP;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1556
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1557 memset(&hf, 0, sizeof(hf));
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1558
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1559 /* Initialize remote certificate */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1560 CHECK_GNUTLS_DO( ret = gnutls_certificate_allocate_credentials (&hf.creds), );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1561 CHECK( GNUTLS_E_SUCCESS, ret );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1562 /* Set the CA */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1563 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &ca, GNUTLS_X509_FMT_PEM), );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1564 CHECK( 1, ret );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1565 /* Set the key */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1566 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_key_mem( hf.creds, &client_cert, &client_priv, GNUTLS_X509_FMT_PEM), );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1567 CHECK( GNUTLS_E_SUCCESS, ret );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1568
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1569 /* Start the client thread */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1570 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1571
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1572 /* Accept the connection of the client */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1573 server_side = fd_cnx_serv_accept(listener_sctp);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1574 CHECK( 1, server_side ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1575
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1576 /* Retrieve the client connection object */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1577 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1578 CHECK( 1, client_side ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1579 hf.cnx = client_side;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1580
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1581 /* Start the handshake */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1582 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1583 CHECK( 0, fd_cnx_handshake(server_side, GNUTLS_SERVER, NULL, NULL) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1584 CHECK( 0, pthread_join(thr, NULL) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1585 CHECK( 0, hf.ret );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1586
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1587 /* Test some simple functions */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1588
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1589 /* fd_cnx_getid */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1590 str = fd_cnx_getid(server_side);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1591 CHECK( 1, str ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1592 CHECK( 1, (str[0] != '\0') ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1593
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1594 /* fd_cnx_getproto */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1595 i = fd_cnx_getproto(server_side);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1596 CHECK( IPPROTO_SCTP, i);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1597
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1598 /* fd_cnx_getTLS */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1599 i = fd_cnx_getTLS(server_side);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1600 CHECK( 1, i ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1601
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1602 /* fd_cnx_getcred */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1603 CHECK( 0, fd_cnx_getcred(server_side, &cert_list, &cert_list_size) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1604 CHECK( 1, (cert_list_size > 0) ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1605 /* We could also verify that the cert_list really contains the client_cert and ca certificates */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1606
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1607 /* fd_cnx_getremoteid */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1608 str = fd_cnx_getremoteid(server_side);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1609 CHECK( 1, str ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1610 CHECK( 1, (str[0] != '\0') ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1611
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1612 /* fd_cnx_recv_setaltfifo */
208
e1da03ba112f Force ordering of messages by using only stream 0 for link-local messages -- avoids issue of DWR arriving before CEA.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 141
diff changeset
1613 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz, 0));
767
c47c16436f71 Added a limit on fifo queues to avoid memory exaustion when messages are received faster than handled
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
1614 CHECK( 0, fd_fifo_new(&myfifo, 0) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1615 CHECK( 0, fd_cnx_recv_setaltfifo(server_side, myfifo) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1616 CHECK( 0, clock_gettime(CLOCK_REALTIME, &now) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1617 do {
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1618 CHECK( 0, fd_event_timedget(myfifo, &now, ETIMEDOUT, &ev_code, NULL, (void *)&rcv_buf) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1619 free(rcv_buf);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1620 } while (ev_code != FDEVP_CNX_MSG_RECV);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1621
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1622 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1623 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1624 fd_cnx_destroy(server_side);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1625 CHECK( 0, pthread_join(thr, NULL) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1626
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1627 fd_event_destroy(&myfifo, free);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1628
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1629 /* Free the credentials */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1630 gnutls_certificate_free_keys(hf.creds);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1631 gnutls_certificate_free_cas(hf.creds);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1632 gnutls_certificate_free_credentials(hf.creds);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1633 }
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1634 #endif /* DISABLE_SCTP */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1635
393
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1636
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1637 /* Destroy the servers */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1638 {
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1639 fd_cnx_destroy(listener);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1640 #ifndef DISABLE_SCTP
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1641 fd_cnx_destroy(listener_sctp);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1642 #endif /* DISABLE_SCTP */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1643 }
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1644
38
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1645 /* Check that connection attempt fails then */
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1646 {
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1647 struct connect_flags cf;
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1648
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1649 memset(&cf, 0, sizeof(cf));
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1650 cf.proto = IPPROTO_TCP;
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1651 cf.expect_failure = 1;
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1652
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1653 /* Start the client thread, that should fail */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1654 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
38
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1655 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1656 CHECK( 0, client_side ? 1 : 0 );
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1657 }
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1658
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1659 #ifndef DISABLE_SCTP
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1660 {
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1661 struct connect_flags cf;
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1662
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1663 memset(&cf, 0, sizeof(cf));
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1664 cf.proto = IPPROTO_SCTP;
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1665 cf.expect_failure = 1;
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1666
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1667 /* Start the client thread, that should fail */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1668 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
38
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1669 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1670 CHECK( 0, client_side ? 1 : 0 );
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1671 }
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1672 #endif /* DISABLE_SCTP */
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1673
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
1674
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1675 /* That's all for the tests yet */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1676 PASSTEST();
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1677 }
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1678
"Welcome to our mercurial repository"