Mercurial > hg > freeDiameter
annotate freeDiameter/tests/testcnx.c @ 140:34e47f4addf8
Fix broken test
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Wed, 16 Dec 2009 17:20:31 +0900 |
parents | 68c1890f7049 |
children | 4e671e8dcae8 |
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) * |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
3 * Author: Sebastien Decugis <sdecugis@nict.go.jp> * |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
4 * * |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
5 * Copyright (c) 2009, WIDE Project and NICT * |
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 | 84 /* Client: |
85 Certificate: | |
86 Data: | |
87 Version: 3 (0x2) | |
88 Serial Number: 5 (0x5) | |
89 Signature Algorithm: sha1WithRSAEncryption | |
90 Issuer: C=JP, ST=Tokyo, L=Koganei, O=WIDE, OU=AAA WG, CN=chavroux.cowaddict.org/emailAddress=sdecugis@nict.go.jp | |
91 Validity | |
92 Not Before: Oct 27 04:04:05 2009 GMT | |
93 Not After : Oct 25 04:04:05 2019 GMT | |
94 Subject: C=JP, ST=Tokyo, L=Koganei, O=WIDE, OU=AAA WG, CN=client.test/emailAddress=client@test | |
95 Subject Public Key Info: | |
96 Public Key Algorithm: rsaEncryption | |
97 RSA Public Key: (1024 bit) | |
98 Modulus (1024 bit): | |
99 00:bd:eb:50:1e:9d:7a:cd:9d:bb:e7:bc:4e:38:4a: | |
100 b2:cc:9e:b4:89:77:01:ef:d1:c6:19:29:00:fe:ce: | |
101 3c:62:05:13:b1:8c:ff:31:7a:0f:c1:2e:4b:3c:0c: | |
102 40:1e:36:4e:76:da:0a:64:43:fc:1e:ea:0c:97:b2: | |
103 57:9c:9c:8c:90:bd:eb:23:7b:b8:b7:5c:03:ed:6f: | |
104 48:55:8a:88:08:38:c5:cd:33:b7:ab:a8:3a:6f:7f: | |
105 13:10:65:a5:50:b9:f4:8b:cc:2e:e9:79:58:a6:11: | |
106 f0:58:45:41:ef:36:b3:35:cb:14:ec:82:0c:ad:11: | |
107 6a:ea:64:ef:28:a2:6e:47:45 | |
108 Exponent: 65537 (0x10001) | |
109 X509v3 extensions: | |
110 X509v3 Basic Constraints: | |
111 CA:FALSE | |
112 Netscape Comment: | |
113 OpenSSL Generated Certificate | |
114 X509v3 Subject Key Identifier: | |
115 BE:B3:89:4F:9D:8F:6C:20:C4:D0:3E:6A:05:11:82:50:54:49:70:A2 | |
116 X509v3 Authority Key Identifier: | |
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 | 119 Signature Algorithm: sha1WithRSAEncryption |
120 a3:88:f5:15:b5:ad:20:60:a1:85:19:3f:b9:5e:1e:be:31:7f: | |
121 84:7a:c2:18:3a:63:6a:67:1f:46:86:4d:10:d6:1d:ad:a2:c8: | |
122 0b:95:33:fa:e4:05:f4:b8:70:34:77:f7:85:6e:70:46:ac:39: | |
123 54:a9:5f:ea:5e:d1:33:bb:c9:a3:42:81:41:90:25:b5:92:8b: | |
124 e8:6e:3e:97:06:dd:9a:cc:29:61:34:5a:d3:1c:5d:ad:d1:a3: | |
125 eb:6a:47:b4:d0:c2:17:89:e1:e2:2d:36:18:50:1a:e7:d4:fc: | |
126 38:2e:47:0b:39:50:87:2f:aa:07:64:f8:9a:4d:47:01:da:10: | |
127 d8:97:c7:a6:13:bc:0e:ca:63:c1:f2:09:fb:f8:6a:a4:5f:08: | |
128 b5:ad:ed:4f:71:b9:89:7f:43:27:85:72:e7:8d:a8:4a:cc:f6: | |
129 36:ca:8a:ae:82:b5:a8:42:41:99:87:84:7c:f0:90:fd:ca:96: | |
130 37:a2:e0:d9:fa:dd:a4:c9:f1:50:b7:e5:e6:8f:af:83:8c:23: | |
131 b6:20:cc:66:e3:08:60:13:02:8f:42:3a:07:91:a7:38:b2:72: | |
132 16:fd:bd:a9:60:f0:e2:9f:23:f3:c0:99:e3:17:bc:00:7c:b3: | |
133 89:9c:ea:fa:3e:f6:69:a1:98:c2:ec:46:da:70:b6:f9:c3:93: | |
134 a7:fc:36:dd | |
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 | 173 /* Server: |
174 Certificate: | |
175 Data: | |
176 Version: 3 (0x2) | |
177 Serial Number: 4 (0x4) | |
178 Signature Algorithm: sha1WithRSAEncryption | |
179 Issuer: C=JP, ST=Tokyo, L=Koganei, O=WIDE, OU=AAA WG, CN=chavroux.cowaddict.org/emailAddress=sdecugis@nict.go.jp | |
180 Validity | |
181 Not Before: Oct 27 04:03:39 2009 GMT | |
182 Not After : Oct 25 04:03:39 2019 GMT | |
183 Subject: C=JP, ST=Tokyo, L=Koganei, O=WIDE, OU=AAA WG, CN=serv.test/emailAddress=serv@test | |
184 Subject Public Key Info: | |
185 Public Key Algorithm: rsaEncryption | |
186 RSA Public Key: (1024 bit) | |
187 Modulus (1024 bit): | |
188 00:a6:f7:1c:a9:90:5b:fa:c8:f6:a3:04:0c:d0:8b: | |
189 45:c3:90:f7:2d:c2:c9:d7:bd:66:8a:7c:1c:51:89: | |
190 40:9e:cd:70:57:cb:00:47:a3:e8:76:8b:00:b3:c9: | |
191 c3:0d:b1:b9:2a:08:9f:52:92:82:d3:18:c1:d8:d1: | |
192 b8:1e:fd:71:fe:23:ec:19:e9:6d:9d:fd:ae:88:bc: | |
193 39:44:7a:37:ad:c6:88:d1:64:7c:b1:d4:3c:a9:30: | |
194 c4:de:51:02:c4:48:4f:25:3e:2f:93:ae:25:32:66: | |
195 9a:dc:f4:44:45:ff:7f:12:49:97:0d:01:8d:13:9a: | |
196 d3:8f:9e:2d:62:95:02:0a:c7 | |
197 Exponent: 65537 (0x10001) | |
198 X509v3 extensions: | |
199 X509v3 Basic Constraints: | |
200 CA:FALSE | |
201 Netscape Comment: | |
202 OpenSSL Generated Certificate | |
203 X509v3 Subject Key Identifier: | |
204 0C:33:C4:7F:39:D0:34:FF:F8:61:A1:46:8B:49:1D:A3:57:B3:4D:58 | |
205 X509v3 Authority Key Identifier: | |
206 keyid:92:AA:55:9F:B3:77:82:68:89:ED:7E:73:43:66:E4:8B:EE:EA:BF:85 | |
207 | |
208 Signature Algorithm: sha1WithRSAEncryption | |
209 87:f5:49:a6:04:f9:98:9a:f1:1a:68:ce:06:ae:4c:0c:08:eb: | |
210 ba:98:e7:3f:df:22:7f:35:88:1d:b7:8a:f3:89:a3:68:0d:53: | |
211 45:eb:23:a1:dd:6b:dc:b0:80:58:0c:10:0b:49:74:ea:a8:b6: | |
212 8c:2e:c6:73:dc:7a:74:c7:59:3e:79:5a:d2:5c:15:0b:f1:d8: | |
213 19:37:2a:c0:22:75:10:3f:4c:e9:a1:e0:eb:b2:9e:09:70:3d: | |
214 2a:4c:fe:9c:99:36:4b:aa:6c:e1:8b:9c:aa:e1:29:1f:49:6b: | |
215 14:db:12:ae:cf:68:4a:dd:03:e1:3b:ad:79:b4:54:84:1d:bb: | |
216 ac:45:c4:85:f1:03:65:65:96:23:ae:e7:97:3c:5c:db:ce:55: | |
217 34:5d:c3:73:ec:cd:f6:0f:a5:81:5f:c2:ab:a3:42:fa:36:7f: | |
218 83:ef:db:0f:cd:62:0b:ea:d9:4f:73:35:68:5f:23:d5:0a:be: | |
219 ff:7f:23:9a:af:0d:a5:f8:3e:3a:f0:63:1c:e1:d2:96:81:cf: | |
220 7b:5a:6b:d0:9b:67:56:9e:aa:a9:e8:f1:6c:fb:54:2b:1a:f4: | |
221 ef:16:5a:be:1d:a9:c8:d6:cc:f7:42:8c:fe:83:2c:84:8c:80: | |
222 fb:1c:88:f6:35:1c:ae:43:72:fa:68:30:9c:25:8b:db:2c:84: | |
223 87:76:9d:b9 | |
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 | 262 /* Expired: |
263 Certificate: | |
264 Data: | |
265 Version: 3 (0x2) | |
266 Serial Number: 6 (0x6) | |
267 Signature Algorithm: sha1WithRSAEncryption | |
268 Issuer: C=JP, ST=Tokyo, L=Koganei, O=WIDE, OU=AAA WG, CN=chavroux.cowaddict.org/emailAddress=sdecugis@nict.go.jp | |
269 Validity | |
270 Not Before: Oct 27 04:06:35 2009 GMT | |
271 Not After : Oct 28 04:06:35 2009 GMT | |
272 Subject: C=JP, ST=Tokyo, L=Koganei, O=WIDE, OU=AAA WG, CN=expired.test/emailAddress=expired@test | |
273 Subject Public Key Info: | |
274 Public Key Algorithm: rsaEncryption | |
275 RSA Public Key: (1024 bit) | |
276 Modulus (1024 bit): | |
277 00:e3:17:15:54:85:dc:cf:c7:a0:32:4a:49:7d:55: | |
278 75:9b:29:15:db:7e:87:17:d9:0e:65:44:53:d7:19: | |
279 37:27:c7:c6:fe:c6:dc:72:2b:dc:86:1a:ff:24:6c: | |
280 63:3f:75:9c:0a:14:e1:70:06:79:d4:b9:26:d4:68: | |
281 4c:28:38:ba:34:60:56:02:3d:94:55:4a:1f:4e:5a: | |
282 f0:a5:71:4c:3e:71:69:39:ad:bc:aa:55:35:fb:73: | |
283 5b:5f:6c:30:71:8e:8a:b6:a5:06:cc:ee:dd:29:c7: | |
284 52:0d:a7:9c:0f:a1:ba:52:11:e2:1b:b9:74:6b:08: | |
285 87:11:d2:ec:a9:ac:63:63:4f | |
286 Exponent: 65537 (0x10001) | |
287 X509v3 extensions: | |
288 X509v3 Basic Constraints: | |
289 CA:FALSE | |
290 Netscape Comment: | |
291 OpenSSL Generated Certificate | |
292 X509v3 Subject Key Identifier: | |
293 1C:AF:66:42:5B:AD:AA:A5:9B:D9:AE:3A:C1:5A:AC:2F:CC:CE:22:6C | |
294 X509v3 Authority Key Identifier: | |
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 | 297 Signature Algorithm: sha1WithRSAEncryption |
298 60:8f:55:55:59:82:0f:64:cb:b8:11:c8:44:ce:bf:69:07:0d: | |
299 be:c2:34:be:42:6a:78:15:39:9f:be:8a:17:d6:43:42:c9:7c: | |
300 f1:6d:5d:aa:c3:1b:4d:b0:f0:b6:73:46:2a:87:cd:55:56:a3: | |
301 6d:cc:de:a8:28:6a:53:85:9e:e5:68:b7:3c:f5:72:13:7b:d0: | |
302 21:f2:91:49:35:e0:37:1e:28:19:d5:1b:cc:e1:32:1e:7f:b0: | |
303 86:df:43:a4:47:0f:29:0b:eb:51:60:9a:f5:ca:50:f4:2d:59: | |
304 cd:fc:50:9d:29:ed:45:98:de:a2:5c:d1:b5:7a:34:ad:7a:73: | |
305 48:8b:a2:9b:89:8e:4a:2e:2a:04:19:d6:62:6a:0d:f0:96:f2: | |
306 f0:d0:22:77:3b:7f:b1:2a:f4:3b:17:47:5e:38:07:09:65:ad: | |
307 1d:ea:46:69:6a:96:b6:6b:3b:5c:cc:6e:30:d7:cb:53:69:59: | |
308 c2:63:78:2b:03:d4:d4:f7:17:29:99:9a:43:ff:78:0a:af:42: | |
309 c5:b3:8d:09:38:5b:30:70:28:c1:97:ab:fd:7f:87:9a:ec:f2: | |
310 97:44:ff:f5:b9:41:30:d1:c6:32:98:69:34:c4:39:30:6f:e2: | |
311 d3:b2:70:97:66:ee:41:f5:ae:0f:09:f0:ed:60:96:67:a9:8a: | |
312 cd:d6:95:f2 | |
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 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
468 |
29
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
469 struct fd_list eps = FD_LIST_INITIALIZER(eps); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
470 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
471 struct connect_flags { |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
472 int proto; |
38
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
473 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
|
474 }; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
475 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
476 void * connect_thr(void * arg) |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
477 { |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
478 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
|
479 struct cnxctx * cnx = NULL; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
480 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
481 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
|
482 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
483 /* Connect to the server */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
484 switch (cf->proto) { |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
485 case IPPROTO_TCP: |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
486 { |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
487 struct fd_endpoint * ep = (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
|
488 cnx = fd_cnx_cli_connect_tcp( &ep->sa, sSSlen(&ep->ss) ); |
38
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
489 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
|
490 } |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
491 break; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
492 #ifndef DISABLE_SCTP |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
493 case IPPROTO_SCTP: |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
494 { |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
495 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
|
496 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
|
497 } |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
498 break; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
499 #endif /* DISABLE_SCTP */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
500 default: |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
501 CHECK( 0, 1 ); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
502 } |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
503 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
504 /* exit */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
505 return cnx; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
506 } |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
507 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
508 struct handshake_flags { |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
509 struct cnxctx * cnx; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
510 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
|
511 int ret; |
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 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
514 void * handshake_thr(void * arg) |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
515 { |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
516 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
|
517 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
|
518 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
|
519 return NULL; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
520 } |
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 void * destroy_thr(void * arg) |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
523 { |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
524 struct cnxctx * cnx = arg; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
525 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
|
526 fd_cnx_destroy(cnx); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
527 return NULL; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
528 } |
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 /* Main test routine */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
531 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
|
532 { |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
533 gnutls_datum_t ca = { ca_data, sizeof(ca_data) }; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
534 gnutls_datum_t server_cert = { server_cert_data, sizeof(server_cert_data) }; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
535 gnutls_datum_t server_priv = { server_priv_data, sizeof(server_priv_data) }; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
536 gnutls_datum_t client_cert = { client_cert_data, sizeof(client_cert_data) }; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
537 gnutls_datum_t client_priv = { client_priv_data, sizeof(client_priv_data) }; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
538 gnutls_datum_t expired_cert = { expired_cert_data, sizeof(expired_cert_data) }; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
539 gnutls_datum_t expired_priv = { expired_priv_data, sizeof(expired_priv_data) }; |
31
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
540 gnutls_datum_t notrust_ca = { notrust_ca_data, sizeof(notrust_ca_data) }; |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
541 gnutls_datum_t notrust_cert = { notrust_cert_data, sizeof(notrust_cert_data) }; |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
542 gnutls_datum_t notrust_priv = { notrust_priv_data, sizeof(notrust_priv_data) }; |
29
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
543 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
544 struct cnxctx * listener; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
545 #ifndef DISABLE_SCTP |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
546 struct cnxctx * listener_sctp; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
547 #endif /* DISABLE_SCTP */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
548 struct cnxctx * server_side; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
549 struct cnxctx * client_side; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
550 pthread_t thr; |
30 | 551 int ret, i; |
29
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
552 uint8_t * cer_buf; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
553 size_t cer_sz; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
554 uint8_t * rcv_buf; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
555 size_t rcv_sz; |
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 /* 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
|
558 INIT_FD(); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
559 |
31
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
560 /* Restrain the # of streams */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
561 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
|
562 |
29
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
563 /* 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
|
564 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
|
565 &ca, |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
566 GNUTLS_X509_FMT_PEM), ); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
567 CHECK( 1, ret ); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
568 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
569 /* 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
|
570 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
|
571 &server_cert, |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
572 &server_priv, |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
573 GNUTLS_X509_FMT_PEM), ); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
574 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
|
575 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
576 /* Set the default priority */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
577 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
|
578 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
|
579 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
580 /* Set default DH params */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
581 CHECK_GNUTLS_DO( ret = gnutls_dh_params_generate2( fd_g_config->cnf_sec_data.dh_cache, GNUTLS_DEFAULT_DHBITS), ); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
582 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
|
583 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
584 /* Initialize the server addresses */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
585 { |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
586 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
|
587 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
|
588 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
|
589 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
|
590 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
|
591 aip = ai; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
592 while (aip) { |
140 | 593 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
|
594 aip = aip->ai_next; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
595 }; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
596 freeaddrinfo(ai); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
597 } |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
598 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
599 /* Start the server(s) */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
600 { |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
601 /* TCP server */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
602 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
|
603 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
|
604 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
605 /* Accept incoming clients */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
606 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
|
607 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
608 #ifndef DISABLE_SCTP |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
609 /* SCTP server */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
610 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
|
611 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
|
612 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
613 /* Accept incoming clients */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
614 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
|
615 #endif /* DISABLE_SCTP */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
616 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
617 } |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
618 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
619 /* Initialize the CER message */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
620 { |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
621 struct msg * cer; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
622 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
|
623 struct avp * oh; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
624 union avp_value value; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
625 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
626 /* 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
|
627 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
|
628 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
629 /* Create the instance */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
630 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
|
631 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
632 /* 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
|
633 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
|
634 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
635 /* Create the instance */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
636 CHECK( 0, fd_msg_avp_new ( model, 0, &oh ) ); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
637 value.os.data = "Client.side"; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
638 value.os.len = strlen(value.os.data); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
639 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
|
640 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
641 /* Add the AVP */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
642 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
|
643 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
644 #if 1 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
645 /* 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
|
646 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
|
647 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
|
648 #endif |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
649 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
650 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
|
651 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
|
652 } |
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 /* 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
|
655 { |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
656 struct connect_flags cf; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
657 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
658 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
|
659 cf.proto = IPPROTO_TCP; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
660 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
661 /* Start the client thread */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
662 CHECK( 0, pthread_create(&thr, 0, connect_thr, &cf) ); |
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 /* 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
|
665 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
|
666 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
|
667 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
|
668 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
669 /* 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
|
670 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
|
671 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
|
672 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
|
673 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
674 /* Send a message and receive it */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
675 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz)); |
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_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
|
677 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
|
678 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
|
679 free(rcv_buf); |
29
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
680 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
681 /* Do it in the other direction */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
682 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz)); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
683 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
|
684 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
|
685 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
|
686 free(rcv_buf); |
29
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 /* Now close the connection */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
689 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
|
690 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
|
691 } |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
692 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
693 #ifndef DISABLE_SCTP |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
694 /* 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
|
695 { |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
696 struct connect_flags cf; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
697 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
698 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
|
699 cf.proto = IPPROTO_SCTP; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
700 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
701 /* Start the client thread */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
702 CHECK( 0, pthread_create(&thr, 0, connect_thr, &cf) ); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
703 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
704 /* 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
|
705 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
|
706 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
|
707 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
708 /* 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
|
709 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
|
710 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
|
711 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
712 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
|
713 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
714 /* Send a message and receive it */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
715 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz)); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
716 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
|
717 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
|
718 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
|
719 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
|
720 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
|
721 free(rcv_buf); |
29
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 /* Do it in the other direction */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
724 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz)); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
725 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
|
726 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
|
727 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
|
728 free(rcv_buf); |
29
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
729 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
730 /* Do it one more time to use another stream */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
731 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz)); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
732 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
|
733 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
|
734 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
|
735 free(rcv_buf); |
29
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
736 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
737 /* Now close the connection */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
738 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
|
739 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
|
740 } |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
741 #endif /* DISABLE_SCTP */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
742 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
743 /* 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
|
744 { |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
745 struct connect_flags cf; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
746 struct handshake_flags hf; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
747 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
748 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
|
749 cf.proto = IPPROTO_TCP; |
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 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
|
752 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
753 /* Initialize remote certificate */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
754 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
|
755 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
|
756 /* Set the CA */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
757 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
|
758 CHECK( 1, ret ); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
759 /* Set the key */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
760 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
|
761 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
|
762 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
763 /* Start the client thread */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
764 CHECK( 0, pthread_create(&thr, 0, connect_thr, &cf) ); |
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 /* 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
|
767 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
|
768 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
|
769 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
770 /* 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
|
771 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
|
772 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
|
773 hf.cnx = client_side; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
774 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
775 /* 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
|
776 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
777 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
|
778 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
|
779 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
780 /* Send a message and receive it */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
781 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz)); |
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_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
|
783 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
|
784 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
|
785 free(rcv_buf); |
29
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
786 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
787 /* And the supposed reply */ |
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_send(client_side, cer_buf, cer_sz)); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
789 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
|
790 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
|
791 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
|
792 free(rcv_buf); |
29
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
793 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
794 /* At this point in legacy Diameter we start the handshake */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
795 CHECK( 0, pthread_create(&thr, 0, handshake_thr, &hf) ); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
796 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
|
797 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
|
798 CHECK( 0, hf.ret ); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
799 |
30 | 800 /* 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
|
801 for (i = 0; i < 2 * NB_STREAMS; i++) { |
30 | 802 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz)); |
803 CHECK( 0, fd_cnx_receive(client_side, NULL, &rcv_buf, &rcv_sz)); | |
804 CHECK( cer_sz, rcv_sz ); | |
805 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
|
806 free(rcv_buf); |
30 | 807 |
808 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz)); | |
809 CHECK( 0, fd_cnx_receive(server_side, NULL, &rcv_buf, &rcv_sz)); | |
810 CHECK( cer_sz, rcv_sz ); | |
811 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
|
812 free(rcv_buf); |
30 | 813 } |
29
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 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
816 /* Now close the connection */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
817 CHECK( 0, pthread_create(&thr, 0, destroy_thr, client_side) ); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
818 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
|
819 CHECK( 0, pthread_join(thr, NULL) ); |
30 | 820 |
821 /* Free the credentials */ | |
822 gnutls_certificate_free_keys(hf.creds); | |
823 gnutls_certificate_free_cas(hf.creds); | |
824 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
|
825 } |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
826 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
827 #ifndef DISABLE_SCTP |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
828 /* 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
|
829 { |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
830 struct connect_flags cf; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
831 struct handshake_flags hf; |
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 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
|
834 cf.proto = IPPROTO_SCTP; |
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 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
|
837 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
838 /* Initialize remote certificate */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
839 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
|
840 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
|
841 /* Set the CA */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
842 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
|
843 CHECK( 1, ret ); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
844 /* Set the key */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
845 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
|
846 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
|
847 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
848 /* Start the client thread */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
849 CHECK( 0, pthread_create(&thr, 0, connect_thr, &cf) ); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
850 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
851 /* 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
|
852 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
|
853 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
|
854 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
855 /* 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
|
856 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
|
857 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
|
858 hf.cnx = client_side; |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
859 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
860 /* 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
|
861 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
862 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
|
863 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
|
864 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
865 /* Send a message and receive it */ |
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_send(server_side, cer_buf, cer_sz)); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
867 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
|
868 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
|
869 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
|
870 free(rcv_buf); |
29
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
871 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
872 /* And the supposed reply */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
873 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz)); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
874 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
|
875 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
|
876 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
|
877 free(rcv_buf); |
29
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
878 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
879 /* At this point in legacy Diameter we start the handshake */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
880 CHECK( 0, pthread_create(&thr, 0, handshake_thr, &hf) ); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
881 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
|
882 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
|
883 CHECK( 0, hf.ret ); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
884 |
30 | 885 /* 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
|
886 for (i = 0; i < 2 * NB_STREAMS; i++) { |
30 | 887 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz)); |
888 CHECK( 0, fd_cnx_receive(client_side, NULL, &rcv_buf, &rcv_sz)); | |
889 CHECK( cer_sz, rcv_sz ); | |
890 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
|
891 free(rcv_buf); |
30 | 892 |
893 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz)); | |
894 CHECK( 0, fd_cnx_receive(server_side, NULL, &rcv_buf, &rcv_sz)); | |
895 CHECK( cer_sz, rcv_sz ); | |
896 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
|
897 free(rcv_buf); |
30 | 898 } |
29
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 |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
901 /* Now close the connection */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
902 CHECK( 0, pthread_create(&thr, 0, destroy_thr, client_side) ); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
903 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
|
904 CHECK( 0, pthread_join(thr, NULL) ); |
30 | 905 |
906 /* Free the credentials */ | |
907 gnutls_certificate_free_keys(hf.creds); | |
908 gnutls_certificate_free_cas(hf.creds); | |
909 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
|
910 } |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
911 #endif /* DISABLE_SCTP */ |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
912 |
30 | 913 /* TCP Client / server emulating new Diameter behavior (handshake at connection directly) */ |
914 { | |
915 struct connect_flags cf; | |
916 struct handshake_flags hf; | |
917 | |
918 memset(&cf, 0, sizeof(cf)); | |
919 cf.proto = IPPROTO_TCP; | |
920 | |
921 memset(&hf, 0, sizeof(hf)); | |
922 | |
923 /* Initialize remote certificate */ | |
924 CHECK_GNUTLS_DO( ret = gnutls_certificate_allocate_credentials (&hf.creds), ); | |
925 CHECK( GNUTLS_E_SUCCESS, ret ); | |
926 /* Set the CA */ | |
927 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &ca, GNUTLS_X509_FMT_PEM), ); | |
928 CHECK( 1, ret ); | |
929 /* Set the key */ | |
930 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_key_mem( hf.creds, &client_cert, &client_priv, GNUTLS_X509_FMT_PEM), ); | |
931 CHECK( GNUTLS_E_SUCCESS, ret ); | |
932 | |
933 /* Start the client thread */ | |
934 CHECK( 0, pthread_create(&thr, 0, connect_thr, &cf) ); | |
935 | |
936 /* Accept the connection of the client */ | |
937 server_side = fd_cnx_serv_accept(listener); | |
938 CHECK( 1, server_side ? 1 : 0 ); | |
939 | |
940 /* Retrieve the client connection object */ | |
941 CHECK( 0, pthread_join( thr, (void *)&client_side ) ); | |
942 CHECK( 1, client_side ? 1 : 0 ); | |
943 hf.cnx = client_side; | |
944 | |
945 /* Start the handshake directly */ | |
946 CHECK( 0, pthread_create(&thr, 0, handshake_thr, &hf) ); | |
947 CHECK( 0, fd_cnx_handshake(server_side, GNUTLS_SERVER, NULL, NULL) ); | |
948 CHECK( 0, pthread_join(thr, NULL) ); | |
949 CHECK( 0, hf.ret ); | |
950 | |
951 /* 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
|
952 for (i = 0; i < 2 * NB_STREAMS; i++) { |
30 | 953 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz)); |
954 CHECK( 0, fd_cnx_receive(client_side, NULL, &rcv_buf, &rcv_sz)); | |
955 CHECK( cer_sz, rcv_sz ); | |
956 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
|
957 free(rcv_buf); |
30 | 958 |
959 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz)); | |
960 CHECK( 0, fd_cnx_receive(server_side, NULL, &rcv_buf, &rcv_sz)); | |
961 CHECK( cer_sz, rcv_sz ); | |
962 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
|
963 free(rcv_buf); |
30 | 964 } |
965 | |
966 /* Now close the connection */ | |
967 CHECK( 0, pthread_create(&thr, 0, destroy_thr, client_side) ); | |
968 fd_cnx_destroy(server_side); | |
969 CHECK( 0, pthread_join(thr, NULL) ); | |
970 | |
971 /* Free the credentials */ | |
972 gnutls_certificate_free_keys(hf.creds); | |
973 gnutls_certificate_free_cas(hf.creds); | |
974 gnutls_certificate_free_credentials(hf.creds); | |
975 } | |
29
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
976 |
31
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
977 #ifndef DISABLE_SCTP |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
978 /* 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
|
979 { |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
980 struct connect_flags cf; |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
981 struct handshake_flags hf; |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
982 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
983 memset(&cf, 0, sizeof(cf)); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
984 cf.proto = IPPROTO_SCTP; |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
985 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
986 memset(&hf, 0, sizeof(hf)); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
987 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
988 /* Initialize remote certificate */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
989 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
|
990 CHECK( GNUTLS_E_SUCCESS, ret ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
991 /* Set the CA */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
992 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
|
993 CHECK( 1, ret ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
994 /* Set the key */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
995 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
|
996 CHECK( GNUTLS_E_SUCCESS, ret ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
997 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
998 /* Start the client thread */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
999 CHECK( 0, pthread_create(&thr, 0, connect_thr, &cf) ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1000 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1001 /* 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
|
1002 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
|
1003 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
|
1004 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1005 /* Retrieve the client connection object */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1006 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
|
1007 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
|
1008 hf.cnx = client_side; |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1009 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1010 /* Start the handshake directly */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1011 CHECK( 0, pthread_create(&thr, 0, handshake_thr, &hf) ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1012 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
|
1013 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
|
1014 CHECK( 0, hf.ret ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1015 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1016 /* Send a few TLS protected message, and replies */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1017 for (i = 0; i < 2 * NB_STREAMS; i++) { |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1018 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz)); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1019 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
|
1020 CHECK( cer_sz, rcv_sz ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1021 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
|
1022 free(rcv_buf); |
31
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1023 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1024 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz)); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1025 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
|
1026 CHECK( cer_sz, rcv_sz ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1027 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
|
1028 free(rcv_buf); |
31
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1029 } |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1030 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1031 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1032 /* Now close the connection */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1033 CHECK( 0, pthread_create(&thr, 0, destroy_thr, client_side) ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1034 fd_cnx_destroy(server_side); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1035 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
|
1036 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1037 /* Free the credentials */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1038 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
|
1039 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
|
1040 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
|
1041 } |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1042 #endif /* DISABLE_SCTP */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1043 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1044 /* Basic operation tested successfully, now test we detect error conditions */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1045 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1046 /* Untrusted certificate, TCP */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1047 { |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1048 struct connect_flags cf; |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1049 struct handshake_flags hf; |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1050 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1051 memset(&cf, 0, sizeof(cf)); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1052 cf.proto = IPPROTO_TCP; |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1053 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1054 memset(&hf, 0, sizeof(hf)); |
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 /* Initialize remote certificate */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1057 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
|
1058 CHECK( GNUTLS_E_SUCCESS, ret ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1059 /* Set the CA */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1060 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, ¬rust_ca, GNUTLS_X509_FMT_PEM), ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1061 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
|
1062 CHECK( 1, ret ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1063 /* Set the key */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1064 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_key_mem( hf.creds, ¬rust_cert, ¬rust_priv, GNUTLS_X509_FMT_PEM), ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1065 CHECK( GNUTLS_E_SUCCESS, ret ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1066 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1067 /* Start the client thread */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1068 CHECK( 0, pthread_create(&thr, 0, connect_thr, &cf) ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1069 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1070 /* 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
|
1071 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
|
1072 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
|
1073 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1074 /* Retrieve the client connection object */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1075 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
|
1076 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
|
1077 hf.cnx = client_side; |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1078 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1079 /* Start the handshake directly */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1080 CHECK( 0, pthread_create(&thr, 0, handshake_thr, &hf) ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1081 CHECK( EINVAL, 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
|
1082 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
|
1083 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1084 /* Now close the connection */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1085 CHECK( 0, pthread_create(&thr, 0, destroy_thr, client_side) ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1086 fd_cnx_destroy(server_side); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1087 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
|
1088 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1089 /* Free the credentials */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1090 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
|
1091 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
|
1092 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
|
1093 } |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1094 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1095 /* Same in SCTP */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1096 #ifndef DISABLE_SCTP |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1097 { |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1098 struct connect_flags cf; |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1099 struct handshake_flags hf; |
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 memset(&cf, 0, sizeof(cf)); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1102 cf.proto = IPPROTO_SCTP; |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1103 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1104 memset(&hf, 0, sizeof(hf)); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1105 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1106 /* Initialize remote certificate */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1107 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
|
1108 CHECK( GNUTLS_E_SUCCESS, ret ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1109 /* Set the CA */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1110 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, ¬rust_ca, GNUTLS_X509_FMT_PEM), ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1111 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
|
1112 CHECK( 1, ret ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1113 /* Set the key */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1114 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_key_mem( hf.creds, ¬rust_cert, ¬rust_priv, GNUTLS_X509_FMT_PEM), ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1115 CHECK( GNUTLS_E_SUCCESS, ret ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1116 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1117 /* Start the client thread */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1118 CHECK( 0, pthread_create(&thr, 0, connect_thr, &cf) ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1119 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1120 /* 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
|
1121 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
|
1122 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
|
1123 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1124 /* Retrieve the client connection object */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1125 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
|
1126 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
|
1127 hf.cnx = client_side; |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1128 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1129 /* Start the handshake directly */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1130 CHECK( 0, pthread_create(&thr, 0, handshake_thr, &hf) ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1131 CHECK( EINVAL, 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
|
1132 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
|
1133 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1134 /* Now close the connection */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1135 CHECK( 0, pthread_create(&thr, 0, destroy_thr, client_side) ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1136 fd_cnx_destroy(server_side); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1137 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
|
1138 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1139 /* Free the credentials */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1140 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
|
1141 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
|
1142 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
|
1143 } |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1144 #endif /* DISABLE_SCTP */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1145 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1146 /* Expired certificate */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1147 { |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1148 struct connect_flags cf; |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1149 struct handshake_flags hf; |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1150 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1151 memset(&cf, 0, sizeof(cf)); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1152 cf.proto = IPPROTO_TCP; |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1153 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1154 memset(&hf, 0, sizeof(hf)); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1155 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1156 /* Initialize remote certificate */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1157 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
|
1158 CHECK( GNUTLS_E_SUCCESS, ret ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1159 /* Set the CA */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1160 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
|
1161 CHECK( 1, ret ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1162 /* Set the key */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1163 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
|
1164 CHECK( GNUTLS_E_SUCCESS, ret ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1165 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1166 /* Start the client thread */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1167 CHECK( 0, pthread_create(&thr, 0, connect_thr, &cf) ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1168 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1169 /* 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
|
1170 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
|
1171 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
|
1172 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1173 /* Retrieve the client connection object */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1174 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
|
1175 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
|
1176 hf.cnx = client_side; |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1177 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1178 /* Start the handshake directly */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1179 CHECK( 0, pthread_create(&thr, 0, handshake_thr, &hf) ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1180 CHECK( EINVAL, 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
|
1181 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
|
1182 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1183 /* Now close the connection */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1184 CHECK( 0, pthread_create(&thr, 0, destroy_thr, client_side) ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1185 fd_cnx_destroy(server_side); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1186 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
|
1187 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1188 /* Free the credentials */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1189 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
|
1190 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
|
1191 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
|
1192 } |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1193 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1194 /* Non matching hostname */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1195 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1196 { |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1197 struct connect_flags cf; |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1198 struct handshake_flags hf; |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1199 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1200 memset(&cf, 0, sizeof(cf)); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1201 cf.proto = IPPROTO_TCP; |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1202 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1203 memset(&hf, 0, sizeof(hf)); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1204 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1205 /* Initialize remote certificate */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1206 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
|
1207 CHECK( GNUTLS_E_SUCCESS, ret ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1208 /* Set the CA */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1209 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
|
1210 CHECK( 1, ret ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1211 /* Set the key */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1212 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
|
1213 CHECK( GNUTLS_E_SUCCESS, ret ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1214 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1215 /* Start the client thread */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1216 CHECK( 0, pthread_create(&thr, 0, connect_thr, &cf) ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1217 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1218 /* 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
|
1219 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
|
1220 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
|
1221 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1222 /* Retrieve the client connection object */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1223 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
|
1224 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
|
1225 hf.cnx = client_side; |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1226 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1227 /* 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
|
1228 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
|
1229 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1230 /* Start the handshake, check it is successful */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1231 CHECK( 0, pthread_create(&thr, 0, handshake_thr, &hf) ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1232 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
|
1233 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
|
1234 CHECK( 0, hf.ret ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1235 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1236 /* Now close the connection */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1237 CHECK( 0, pthread_create(&thr, 0, destroy_thr, client_side) ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1238 fd_cnx_destroy(server_side); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1239 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
|
1240 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1241 /* Do it again with an invalid hostname */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1242 CHECK( 0, pthread_create(&thr, 0, connect_thr, &cf) ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1243 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1244 /* 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
|
1245 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
|
1246 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
|
1247 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1248 /* Retrieve the client connection object */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1249 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
|
1250 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
|
1251 hf.cnx = client_side; |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1252 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1253 /* 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
|
1254 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
|
1255 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1256 /* Start the handshake, check it is successful */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1257 CHECK( 0, pthread_create(&thr, 0, handshake_thr, &hf) ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1258 CHECK( EINVAL, 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
|
1259 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
|
1260 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1261 /* Now close the connection */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1262 CHECK( 0, pthread_create(&thr, 0, destroy_thr, client_side) ); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1263 fd_cnx_destroy(server_side); |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1264 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
|
1265 |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1266 /* Free the credentials */ |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1267 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
|
1268 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
|
1269 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
|
1270 } |
26685c67d387
Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
30
diff
changeset
|
1271 |
32
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1272 /* Test the other functions of the module */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1273 { |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1274 struct connect_flags cf; |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1275 struct handshake_flags hf; |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1276 char * str; |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1277 const gnutls_datum_t *cert_list; |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1278 unsigned int cert_list_size; |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1279 struct fd_list local, remote; |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1280 struct fifo * myfifo = NULL; |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1281 struct timespec now; |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1282 int ev_code; |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1283 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1284 memset(&cf, 0, sizeof(cf)); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1285 cf.proto = IPPROTO_TCP; |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1286 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1287 memset(&hf, 0, sizeof(hf)); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1288 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1289 /* Initialize remote certificate */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1290 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
|
1291 CHECK( GNUTLS_E_SUCCESS, ret ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1292 /* Set the CA */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1293 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
|
1294 CHECK( 1, ret ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1295 /* Set the key */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1296 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
|
1297 CHECK( GNUTLS_E_SUCCESS, ret ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1298 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1299 /* Start the client thread */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1300 CHECK( 0, pthread_create(&thr, 0, connect_thr, &cf) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1301 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1302 /* Accept the connection of the client */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1303 server_side = fd_cnx_serv_accept(listener); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1304 CHECK( 1, server_side ? 1 : 0 ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1305 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1306 /* Retrieve the client connection object */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1307 CHECK( 0, pthread_join( thr, (void *)&client_side ) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1308 CHECK( 1, client_side ? 1 : 0 ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1309 hf.cnx = client_side; |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1310 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1311 /* Start the handshake */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1312 CHECK( 0, pthread_create(&thr, 0, handshake_thr, &hf) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1313 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
|
1314 CHECK( 0, pthread_join(thr, NULL) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1315 CHECK( 0, hf.ret ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1316 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1317 /* Test some simple functions */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1318 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1319 /* fd_cnx_getid */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1320 str = fd_cnx_getid(server_side); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1321 CHECK( 1, str ? 1 : 0 ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1322 CHECK( 1, (str[0] != '\0') ? 1 : 0 ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1323 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1324 /* fd_cnx_getproto */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1325 i = fd_cnx_getproto(server_side); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1326 CHECK( IPPROTO_TCP, i); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1327 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1328 /* fd_cnx_getTLS */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1329 i = fd_cnx_getTLS(server_side); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1330 CHECK( 1, i ? 1 : 0 ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1331 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1332 /* fd_cnx_getcred */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1333 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
|
1334 CHECK( 1, (cert_list_size > 0) ? 1 : 0 ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1335 /* 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
|
1336 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1337 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1338 /* fd_cnx_getendpoints */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1339 fd_list_init(&local, NULL); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1340 fd_list_init(&remote, NULL); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1341 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1342 /* Check the function provides the LL endpoint(s) */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1343 CHECK( 0, fd_cnx_getendpoints(server_side, &local, &remote) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1344 CHECK( 0, fd_ep_filter( &local, EP_FL_LL ) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1345 CHECK( 0, fd_ep_filter( &remote, EP_FL_LL ) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1346 CHECK( 0, FD_IS_LIST_EMPTY(&local) ? 1 : 0 ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1347 CHECK( 0, FD_IS_LIST_EMPTY(&remote) ? 1 : 0 ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1348 CHECK( 0, fd_ep_filter( &local, 0 ) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1349 CHECK( 0, fd_ep_filter( &remote, 0 ) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1350 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1351 /* Check the function provides 1 primary endpoint */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1352 CHECK( 0, fd_cnx_getendpoints(server_side, &local, &remote) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1353 CHECK( 0, fd_ep_filter( &local, EP_FL_PRIMARY ) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1354 CHECK( 0, fd_ep_filter( &remote, EP_FL_PRIMARY ) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1355 CHECK( 0, FD_IS_LIST_EMPTY(&local) ? 1 : 0 ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1356 CHECK( 0, FD_IS_LIST_EMPTY(&remote) ? 1 : 0 ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1357 CHECK( &local, local.next->next ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1358 CHECK( &remote, remote.next->next ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1359 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1360 /* fd_cnx_getremoteid */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1361 str = fd_cnx_getremoteid(server_side); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1362 CHECK( 1, str ? 1 : 0 ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1363 CHECK( 1, (str[0] != '\0') ? 1 : 0 ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1364 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1365 /* fd_cnx_recv_setaltfifo */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1366 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz)); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1367 CHECK( 0, fd_fifo_new(&myfifo) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1368 CHECK( 0, fd_cnx_recv_setaltfifo(server_side, myfifo) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1369 CHECK( 0, clock_gettime(CLOCK_REALTIME, &now) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1370 do { |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1371 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
|
1372 free(rcv_buf); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1373 } while (ev_code != FDEVP_CNX_MSG_RECV); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1374 fd_event_destroy(&myfifo, free); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1375 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1376 /* Now close the connection */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1377 CHECK( 0, pthread_create(&thr, 0, destroy_thr, client_side) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1378 fd_cnx_destroy(server_side); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1379 CHECK( 0, pthread_join(thr, NULL) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1380 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1381 /* Free the credentials */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1382 gnutls_certificate_free_keys(hf.creds); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1383 gnutls_certificate_free_cas(hf.creds); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1384 gnutls_certificate_free_credentials(hf.creds); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1385 } |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1386 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1387 #ifndef DISABLE_SCTP |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1388 /* And re-test with a SCTP connection */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1389 { |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1390 struct connect_flags cf; |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1391 struct handshake_flags hf; |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1392 char * str; |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1393 const gnutls_datum_t *cert_list; |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1394 unsigned int cert_list_size; |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1395 struct fd_list local, remote; |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1396 struct fifo * myfifo = NULL; |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1397 struct timespec now; |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1398 int ev_code; |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1399 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1400 memset(&cf, 0, sizeof(cf)); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1401 cf.proto = IPPROTO_SCTP; |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1402 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1403 memset(&hf, 0, sizeof(hf)); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1404 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1405 /* Initialize remote certificate */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1406 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
|
1407 CHECK( GNUTLS_E_SUCCESS, ret ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1408 /* Set the CA */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1409 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
|
1410 CHECK( 1, ret ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1411 /* Set the key */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1412 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
|
1413 CHECK( GNUTLS_E_SUCCESS, ret ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1414 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1415 /* Start the client thread */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1416 CHECK( 0, pthread_create(&thr, 0, connect_thr, &cf) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1417 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1418 /* Accept the connection of the client */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1419 server_side = fd_cnx_serv_accept(listener_sctp); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1420 CHECK( 1, server_side ? 1 : 0 ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1421 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1422 /* Retrieve the client connection object */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1423 CHECK( 0, pthread_join( thr, (void *)&client_side ) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1424 CHECK( 1, client_side ? 1 : 0 ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1425 hf.cnx = client_side; |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1426 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1427 /* Start the handshake */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1428 CHECK( 0, pthread_create(&thr, 0, handshake_thr, &hf) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1429 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
|
1430 CHECK( 0, pthread_join(thr, NULL) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1431 CHECK( 0, hf.ret ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1432 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1433 /* Test some simple functions */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1434 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1435 /* fd_cnx_getid */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1436 str = fd_cnx_getid(server_side); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1437 CHECK( 1, str ? 1 : 0 ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1438 CHECK( 1, (str[0] != '\0') ? 1 : 0 ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1439 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1440 /* fd_cnx_getproto */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1441 i = fd_cnx_getproto(server_side); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1442 CHECK( IPPROTO_SCTP, i); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1443 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1444 /* fd_cnx_getTLS */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1445 i = fd_cnx_getTLS(server_side); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1446 CHECK( 1, i ? 1 : 0 ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1447 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1448 /* fd_cnx_getcred */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1449 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
|
1450 CHECK( 1, (cert_list_size > 0) ? 1 : 0 ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1451 /* 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
|
1452 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1453 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1454 /* fd_cnx_getendpoints */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1455 fd_list_init(&local, NULL); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1456 fd_list_init(&remote, NULL); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1457 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1458 /* Check the function provides the LL endpoint(s) */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1459 CHECK( 0, fd_cnx_getendpoints(server_side, &local, &remote) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1460 CHECK( 0, fd_ep_filter( &local, EP_FL_LL ) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1461 CHECK( 0, fd_ep_filter( &remote, EP_FL_LL ) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1462 CHECK( 0, FD_IS_LIST_EMPTY(&local) ? 1 : 0 ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1463 CHECK( 0, FD_IS_LIST_EMPTY(&remote) ? 1 : 0 ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1464 CHECK( 0, fd_ep_filter( &local, 0 ) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1465 CHECK( 0, fd_ep_filter( &remote, 0 ) ); |
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 /* Check the function provides 1 primary endpoint */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1468 CHECK( 0, fd_cnx_getendpoints(server_side, &local, &remote) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1469 CHECK( 0, fd_ep_filter( &local, EP_FL_PRIMARY ) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1470 CHECK( 0, fd_ep_filter( &remote, EP_FL_PRIMARY ) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1471 CHECK( 0, FD_IS_LIST_EMPTY(&local) ? 1 : 0 ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1472 CHECK( 0, FD_IS_LIST_EMPTY(&remote) ? 1 : 0 ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1473 CHECK( &local, local.next->next ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1474 CHECK( &remote, remote.next->next ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1475 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1476 /* fd_cnx_getremoteid */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1477 str = fd_cnx_getremoteid(server_side); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1478 CHECK( 1, str ? 1 : 0 ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1479 CHECK( 1, (str[0] != '\0') ? 1 : 0 ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1480 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1481 /* fd_cnx_recv_setaltfifo */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1482 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz)); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1483 CHECK( 0, fd_fifo_new(&myfifo) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1484 CHECK( 0, fd_cnx_recv_setaltfifo(server_side, myfifo) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1485 CHECK( 0, clock_gettime(CLOCK_REALTIME, &now) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1486 do { |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1487 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
|
1488 free(rcv_buf); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1489 } while (ev_code != FDEVP_CNX_MSG_RECV); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1490 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1491 /* Now close the connection */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1492 CHECK( 0, pthread_create(&thr, 0, destroy_thr, client_side) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1493 fd_cnx_destroy(server_side); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1494 CHECK( 0, pthread_join(thr, NULL) ); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1495 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1496 fd_event_destroy(&myfifo, free); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1497 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1498 /* Free the credentials */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1499 gnutls_certificate_free_keys(hf.creds); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1500 gnutls_certificate_free_cas(hf.creds); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1501 gnutls_certificate_free_credentials(hf.creds); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1502 } |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1503 #endif /* DISABLE_SCTP */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1504 |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1505 /* Destroy the servers */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1506 { |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1507 fd_cnx_destroy(listener); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1508 #ifndef DISABLE_SCTP |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1509 fd_cnx_destroy(listener_sctp); |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1510 #endif /* DISABLE_SCTP */ |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1511 } |
a5b507479a09
Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
31
diff
changeset
|
1512 |
38
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1513 /* Check that connection attempt fails then */ |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1514 { |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1515 struct connect_flags cf; |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1516 |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1517 memset(&cf, 0, sizeof(cf)); |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1518 cf.proto = IPPROTO_TCP; |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1519 cf.expect_failure = 1; |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1520 |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1521 /* Start the client thread, that should fail */ |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1522 CHECK( 0, pthread_create(&thr, 0, connect_thr, &cf) ); |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1523 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
|
1524 CHECK( 0, client_side ? 1 : 0 ); |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1525 } |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1526 |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1527 #ifndef DISABLE_SCTP |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1528 { |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1529 struct connect_flags cf; |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1530 |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1531 memset(&cf, 0, sizeof(cf)); |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1532 cf.proto = IPPROTO_SCTP; |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1533 cf.expect_failure = 1; |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1534 |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1535 /* Start the client thread, that should fail */ |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1536 CHECK( 0, pthread_create(&thr, 0, connect_thr, &cf) ); |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1537 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
|
1538 CHECK( 0, client_side ? 1 : 0 ); |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1539 } |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1540 #endif /* DISABLE_SCTP */ |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1541 |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
32
diff
changeset
|
1542 |
29
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1543 /* 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
|
1544 PASSTEST(); |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1545 } |
5ba91682f0bc
Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1546 |