annotate tests/testcnx.c @ 1554:566bb46cc73f

Updated copyright information
author Sebastien Decugis <sdecugis@freediameter.net>
date Tue, 06 Oct 2020 21:34:53 +0800
parents 407e0a889c7e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1 /*********************************************************************************************************
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
2 * Software License Agreement (BSD License) *
740
4a9f08d6b6ba Updated my mail address
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 729
diff changeset
3 * Author: Sebastien Decugis <sdecugis@freediameter.net> *
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
4 * *
1554
566bb46cc73f Updated copyright information
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1540
diff changeset
5 * Copyright (c) 2020, WIDE Project and NICT *
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
6 * All rights reserved. *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
7 * *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
8 * Redistribution and use of this software in source and binary forms, with or without modification, are *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
9 * permitted provided that the following conditions are met: *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
10 * *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
11 * * Redistributions of source code must retain the above *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
12 * copyright notice, this list of conditions and the *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
13 * following disclaimer. *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
14 * *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
15 * * Redistributions in binary form must reproduce the above *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
16 * copyright notice, this list of conditions and the *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
17 * following disclaimer in the documentation and/or other *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
18 * materials provided with the distribution. *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
19 * *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
20 * * Neither the name of the WIDE Project or NICT nor the *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
21 * names of its contributors may be used to endorse or *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
22 * promote products derived from this software without *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
23 * specific prior written permission of WIDE Project and *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
24 * NICT. *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
25 * *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
27 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
28 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
29 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
32 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
33 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
34 *********************************************************************************************************/
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
35
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
36 #include "tests.h"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
37
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
38 #ifndef TEST_PORT
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
39 #define TEST_PORT 3868
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
40 #endif /* TEST_PORT */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
41
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
42 #ifndef NB_STREAMS
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
43 #define NB_STREAMS 10
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
44 #endif /* NB_STREAMS */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
45
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
46 #ifndef GNUTLS_DEFAULT_PRIORITY
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
47 # define GNUTLS_DEFAULT_PRIORITY "NORMAL"
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
48 #endif /* GNUTLS_DEFAULT_PRIORITY */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
49
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
50 #ifndef GNUTLS_DEFAULT_DHBITS
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
51 # define GNUTLS_DEFAULT_DHBITS 1024
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
52 #endif /* GNUTLS_DEFAULT_DHBITS */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
53
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
54
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
55 /* The cryptographic data */
1399
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
56 static char ca_data[] = ""
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
57 "-----BEGIN CERTIFICATE-----\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
58 "MIIFljCCA36gAwIBAgIJAIicnqmf2SGHMA0GCSqGSIb3DQEBCwUAMF8xFzAVBgNV\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
59 "BAMMDmNhLmxvY2FsZG9tYWluMQswCQYDVQQGEwJGUjEMMAoGA1UECAwDQmRSMQww\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
60 "CgYDVQQHDANBaXgxCzAJBgNVBAoMAmZEMQ4wDAYDVQQLDAVUZXN0czAgFw0xOTEx\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
61 "MjQxNzA2NDNaGA8yMTE5MTAzMTE3MDY0M1owXzEXMBUGA1UEAwwOY2EubG9jYWxk\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
62 "b21haW4xCzAJBgNVBAYTAkZSMQwwCgYDVQQIDANCZFIxDDAKBgNVBAcMA0FpeDEL\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
63 "MAkGA1UECgwCZkQxDjAMBgNVBAsMBVRlc3RzMIICIjANBgkqhkiG9w0BAQEFAAOC\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
64 "Ag8AMIICCgKCAgEAyj+ATbTTOkXkhnMgp4PQOcN8AppX8yKYFyWKlYfaoq1CGWhR\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
65 "zMuvlgKymGPmuYDwI2ap5z9GbMeQzhq/lnz2jg37E0aWhgPEbMDknjMMgrS5N0m0\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
66 "Z7Lqhj/JVcuhxKWTtPPbAaNMZFNJ+MZkI3tGPXNaih6qNGQKFplkv22HsIdvnvlB\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
67 "RQ0blcaJ9KYEaDeBjjX8fjkUsxw7gHNw2Gi3O0XiftNqNywrYrLzyuKZ6T3Tq9Xp\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
68 "KilwhymC3b/MiqXHeYSAHLRw3qCoaPAx01NESgr1sGoMcKyxoAkzvXsVw0fIpO5n\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
69 "pShEeOf+/ID+tWJ7EG1G13fsYXTiawsNMjHcnhrtr7lYC43/xiyjAr4V5Uf51Dt4\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
70 "aQWbEGOGJr4jniFt0Wis8MFrAYRekyV5ytJ6YCWt5nRs6Aujs8yjD89cGBddixfr\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
71 "7NfwR/dZsv7h5cufdfh8W2jzMt9DeAHM5WANIwFhrI4rfMCKS4bG9BFCAD1wEbhg\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
72 "7k/wcyOBXDIR1W1yP3SmrQRL/JiOW5jU76VQAURnmqnM9ayUdWKfROhoWuoMRIMT\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
73 "IHLxkotlQUECbGZX8gzkvlnxeogPH8KVul99USpDGU66H+RUxVOUNIPGhiZUy6KU\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
74 "nFQUHXXF1PB5U8JfhdOp5ODHDY0quUDG3FXpyf0NsNcbYzb8WWssLreIthcCAwEA\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
75 "AaNTMFEwHQYDVR0OBBYEFFYkMOz0TqjaKeuXQMYy7Q+H9fYAMB8GA1UdIwQYMBaA\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
76 "FFYkMOz0TqjaKeuXQMYy7Q+H9fYAMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcN\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
77 "AQELBQADggIBAHV7IfJgmmxvsal+C6m3exoeQwlwQP5+5xF8L+FpUyJj0TWukteM\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
78 "JurAESZL7SRqBHt3XGXnNf+ghs+/hkWIoYoFj7cermN3sDqZgSqB0eOUlWEuT+bR\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
79 "NUxjb1W890ok7CqN0m7qs72oYSN53De1526sfkdpc8xEiy2UGjiwIdc/3uZ3md+I\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
80 "LOpRHoXUrw1rurmi2/F/oyDjmm9ABicNb4B8e7u1gyrdKB2H5z2HRgUbI1sf/l9I\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
81 "7u17zrieJQ7wcBlfGfjee+Iop6/ZhZdhyF5grv7OA/YgNgTl3C3MBH22912tHj4o\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
82 "3Sxpqt2q0x80Lv4nhrlnVywwp5s1tyDG8LTcOcPpjQwI8zuCTOAZIzgTarFF0/G6\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
83 "NN+ZSl+RUdPNN3g0Eo2KB7QxPsSEsHmgS00I/YPhGp6kHcD8WRij253A9odXxKL+\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
84 "P4nCbgIP/YGdHbRTTzlVMjHHSWbtWwEYzTIcn+2bHFXBQB7TE0MrlqaN4h+3UZ2r\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
85 "YCt0qyql/RJQ+txHAp43WoEg3i8regit3F6h9plDtXpodVacMREofeWlyv1zG5nD\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
86 "fjXqkb27a0tcY19OOrOU4QBks3bYLPjr4RReOvI6DSKtcXyptbjxMNihrsNpzfhH\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
87 "CQ6aE6Uebc0z+DEH5g9cc7l+RlQkeOmTEXhNIuR9JVt1H4O5YXDwKZ86\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
88 "-----END CERTIFICATE-----\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
89 ;
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
90
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
91 /* Client:
1399
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
92 Certificate:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
93 Data:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
94 Version: 3 (0x2)
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
95 Serial Number: 1 (0x1)
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
96 Signature Algorithm: sha256WithRSAEncryption
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
97 Issuer: CN=ca.localdomain, C=FR, ST=BdR, L=Aix, O=fD, OU=Tests
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
98 Validity
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
99 Not Before: Nov 24 17:06:43 2019 GMT
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
100 Not After : Oct 31 17:06:43 2119 GMT
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
101 Subject: C=FR, ST=BdR, O=fD, OU=Tests, CN=client.test
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
102 Subject Public Key Info:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
103 Public Key Algorithm: rsaEncryption
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
104 Public-Key: (2048 bit)
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
105 Modulus:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
106 00:c2:e8:d6:a4:27:56:e5:cb:c9:c1:cb:8e:19:f2:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
107 79:35:96:ca:f2:54:ac:3e:8f:be:8e:77:44:13:c3:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
108 fd:74:21:45:bb:9e:65:f1:9d:46:af:cc:1e:af:fa:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
109 d5:93:91:38:32:0e:3c:b7:5b:a3:9c:7d:4c:94:0a:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
110 66:3a:5d:0c:8e:1f:22:59:0d:dd:a6:de:c1:91:0a:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
111 8c:70:c0:c6:2c:c1:6f:68:29:45:b4:d5:14:74:8d:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
112 31:bb:74:1e:2d:b6:78:74:0b:95:bd:96:35:1d:24:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
113 1f:7d:c9:d5:fa:5a:b6:27:87:38:cc:f4:8d:a3:98:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
114 d9:ff:32:a3:53:db:eb:b5:e5:69:a9:2b:f4:da:ec:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
115 bd:96:f0:80:46:0d:f9:48:03:39:25:4b:a3:2f:7b:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
116 59:81:8b:6e:17:67:2e:3b:84:e9:ff:ac:33:7c:60:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
117 34:10:00:c9:7b:1f:11:e6:b7:a1:57:01:46:44:ae:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
118 2d:8c:ba:d6:08:3d:5d:98:d3:66:74:d8:15:fe:75:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
119 09:61:24:5c:a2:a2:b3:0b:bd:b6:ef:98:b4:07:8d:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
120 86:ae:29:87:7b:98:3a:3f:ef:4f:f6:c2:ab:40:32:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
121 91:06:eb:8e:c8:9d:36:45:84:d4:d3:f5:85:89:ed:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
122 2f:6f:e0:40:a3:d9:0b:e2:a7:80:b1:04:ef:27:70:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
123 9a:f1
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
124 Exponent: 65537 (0x10001)
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
125 X509v3 extensions:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
126 X509v3 Basic Constraints:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
127 CA:FALSE
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
128 Netscape Comment:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
129 OpenSSL Generated Certificate
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
130 X509v3 Subject Key Identifier:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
131 52:E8:18:E1:33:09:C4:AF:65:24:25:C4:72:A8:07:BB:B7:3B:C0:31
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
132 X509v3 Authority Key Identifier:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
133 keyid:56:24:30:EC:F4:4E:A8:DA:29:EB:97:40:C6:32:ED:0F:87:F5:F6:00
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
134
1399
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
135 Signature Algorithm: sha256WithRSAEncryption
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
136 7c:1f:50:97:70:ee:43:3c:e6:3e:ec:17:f5:78:d8:32:d4:73:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
137 e9:bd:e2:9a:b4:47:d7:c8:e5:0f:38:d3:14:a8:18:ac:fa:8e:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
138 8e:68:80:95:8e:0b:5b:09:25:d4:83:b6:65:ca:8e:d7:a4:31:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
139 c1:86:00:cc:1f:c1:60:0f:c2:f1:84:fe:30:9b:f1:d1:1a:96:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
140 d8:ae:e2:eb:28:87:7d:59:07:84:fe:c5:86:e8:41:12:98:a2:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
141 d9:d3:bd:ce:63:79:43:62:bd:13:74:fa:a4:24:48:7a:f5:e9:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
142 d9:d5:07:2e:33:f0:f5:0a:ab:49:41:ae:94:5c:06:bd:2e:5d:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
143 e8:b3:72:e4:76:13:3e:36:0d:a0:bc:f5:a2:b0:17:da:75:0b:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
144 ec:bd:0b:5b:86:a9:5f:b4:e3:3a:fa:ab:cd:4e:03:06:16:a8:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
145 50:10:65:56:60:bb:c4:96:e3:64:b3:7d:e6:5c:92:23:5c:18:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
146 cf:e7:f7:a1:0f:ac:99:25:b1:9b:67:63:44:30:ab:01:5b:73:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
147 6d:09:80:60:c3:4b:80:04:b9:d2:47:17:ac:b7:93:58:f6:7c:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
148 7c:fe:79:07:4d:20:57:68:c1:33:70:65:48:b5:c2:ac:9b:10:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
149 67:63:1d:d1:28:0b:6e:07:c5:95:bd:d9:5c:42:f2:33:fa:38:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
150 b1:02:3d:e2:91:b0:2c:04:66:21:35:86:68:70:06:88:a3:e3:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
151 43:b1:11:24:bc:33:ea:11:45:29:b0:7c:4c:25:62:7e:75:07:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
152 6f:58:4d:33:25:57:d8:8f:40:11:f2:66:8f:8d:6c:c6:9d:b6:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
153 d6:b5:96:75:09:b7:57:b0:6f:ed:ac:f7:9f:42:58:ce:cf:2f:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
154 3c:65:6d:eb:c2:d6:ae:ed:b5:37:03:24:ed:dd:bd:53:c5:93:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
155 e2:64:b3:8f:8f:8b:37:bf:fd:e4:de:b5:48:7e:64:6c:a1:a6:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
156 c6:af:72:5c:d0:46:ee:0d:82:18:c9:bb:3e:39:f7:49:90:0c:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
157 73:ae:23:a4:2f:f3:ff:dd:99:d0:ea:66:d8:f0:97:e9:88:05:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
158 48:83:3d:18:a5:0c:7c:5d:17:9d:9c:cc:4d:3c:cb:46:a9:dc:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
159 d0:69:5f:c0:73:50:2e:ea:42:f7:a1:41:e8:09:fa:56:54:15:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
160 f4:71:e1:bd:99:07:73:94:88:2e:fb:2e:f4:b6:5d:af:a6:81:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
161 42:3e:4c:b5:da:ab:52:6b:36:9b:66:a1:01:09:ec:c9:d9:1b:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
162 b0:18:8f:c1:de:7f:fa:a9:83:9f:f0:9d:b0:84:80:83:f6:0e:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
163 25:a7:82:55:af:63:e1:e5:85:9b:ef:ee:d7:12:ff:09:fc:41:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
164 ed:ae:f5:25:c9:e6:cd:73
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
165 */
1399
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
166 static char client_cert_data[] = ""
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
167 "-----BEGIN CERTIFICATE-----\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
168 "MIIEpTCCAo2gAwIBAgIBATANBgkqhkiG9w0BAQsFADBfMRcwFQYDVQQDDA5jYS5s\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
169 "b2NhbGRvbWFpbjELMAkGA1UEBhMCRlIxDDAKBgNVBAgMA0JkUjEMMAoGA1UEBwwD\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
170 "QWl4MQswCQYDVQQKDAJmRDEOMAwGA1UECwwFVGVzdHMwIBcNMTkxMTI0MTcwNjQz\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
171 "WhgPMjExOTEwMzExNzA2NDNaME4xCzAJBgNVBAYTAkZSMQwwCgYDVQQIDANCZFIx\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
172 "CzAJBgNVBAoMAmZEMQ4wDAYDVQQLDAVUZXN0czEUMBIGA1UEAwwLY2xpZW50LnRl\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
173 "c3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDC6NakJ1bly8nBy44Z\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
174 "8nk1lsryVKw+j76Od0QTw/10IUW7nmXxnUavzB6v+tWTkTgyDjy3W6OcfUyUCmY6\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
175 "XQyOHyJZDd2m3sGRCoxwwMYswW9oKUW01RR0jTG7dB4ttnh0C5W9ljUdJB99ydX6\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
176 "WrYnhzjM9I2jmNn/MqNT2+u15WmpK/Ta7L2W8IBGDflIAzklS6Mve1mBi24XZy47\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
177 "hOn/rDN8YDQQAMl7HxHmt6FXAUZEri2MutYIPV2Y02Z02BX+dQlhJFyiorMLvbbv\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
178 "mLQHjYauKYd7mDo/70/2wqtAMpEG647InTZFhNTT9YWJ7S9v4ECj2Qvip4CxBO8n\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
179 "cJrxAgMBAAGjezB5MAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wg\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
180 "R2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBRS6BjhMwnEr2UkJcRyqAe7\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
181 "tzvAMTAfBgNVHSMEGDAWgBRWJDDs9E6o2inrl0DGMu0Ph/X2ADANBgkqhkiG9w0B\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
182 "AQsFAAOCAgEAfB9Ql3DuQzzmPuwX9XjYMtRz6b3imrRH18jlDzjTFKgYrPqOjmiA\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
183 "lY4LWwkl1IO2ZcqO16QxwYYAzB/BYA/C8YT+MJvx0RqW2K7i6yiHfVkHhP7FhuhB\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
184 "Epii2dO9zmN5Q2K9E3T6pCRIevXp2dUHLjPw9QqrSUGulFwGvS5d6LNy5HYTPjYN\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
185 "oLz1orAX2nUL7L0LW4apX7TjOvqrzU4DBhaoUBBlVmC7xJbjZLN95lySI1wYz+f3\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
186 "oQ+smSWxm2djRDCrAVtzbQmAYMNLgAS50kcXrLeTWPZ8fP55B00gV2jBM3BlSLXC\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
187 "rJsQZ2Md0SgLbgfFlb3ZXELyM/o4sQI94pGwLARmITWGaHAGiKPjQ7ERJLwz6hFF\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
188 "KbB8TCVifnUHb1hNMyVX2I9AEfJmj41sxp221rWWdQm3V7Bv7az3n0JYzs8vPGVt\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
189 "68LWru21NwMk7d29U8WT4mSzj4+LN7/95N61SH5kbKGmxq9yXNBG7g2CGMm7Pjn3\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
190 "SZAMc64jpC/z/92Z0Opm2PCX6YgFSIM9GKUMfF0XnZzMTTzLRqnc0GlfwHNQLupC\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
191 "96FB6An6VlQV9HHhvZkHc5SILvsu9LZdr6aBQj5MtdqrUms2m2ahAQnsydkbsBiP\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
192 "wd5/+qmDn/CdsISAg/YOJaeCVa9j4eWFm+/u1xL/CfxB7a71JcnmzXM=\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
193 "-----END CERTIFICATE-----\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
194 ;
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
195 static char client_priv_data[] = ""
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
196 "-----BEGIN RSA PRIVATE KEY-----\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
197 "MIIEpAIBAAKCAQEAwujWpCdW5cvJwcuOGfJ5NZbK8lSsPo++jndEE8P9dCFFu55l\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
198 "8Z1Gr8wer/rVk5E4Mg48t1ujnH1MlApmOl0Mjh8iWQ3dpt7BkQqMcMDGLMFvaClF\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
199 "tNUUdI0xu3QeLbZ4dAuVvZY1HSQffcnV+lq2J4c4zPSNo5jZ/zKjU9vrteVpqSv0\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
200 "2uy9lvCARg35SAM5JUujL3tZgYtuF2cuO4Tp/6wzfGA0EADJex8R5rehVwFGRK4t\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
201 "jLrWCD1dmNNmdNgV/nUJYSRcoqKzC72275i0B42GrimHe5g6P+9P9sKrQDKRBuuO\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
202 "yJ02RYTU0/WFie0vb+BAo9kL4qeAsQTvJ3Ca8QIDAQABAoIBAG0X+hvDUSYqHHF2\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
203 "R8FKMIHINyvQLOCPgG8pXldZ2eFIRkmvbQwBpfD75SlG0ohYPgX2ZhGTH06V62jp\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
204 "MTL1pfNehdEmq6uc/ub56oWpwMKIOp0ojLWclmhuJynu4n1fpqf9XADTtELtVxsG\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
205 "/9ezMkWJsEc3kpfBFDN82mIztAkItp+p/pChvc48p725AdOf8ZLlXW0rYKfv1J6l\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
206 "4VGb2iYwokQJkx0FcgP1uo1m6Pk2xbKW6acn4g8hsvoOZ6MeJ1/Gh6hJjaQ6hw2i\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
207 "Xs2effT8ZH0kDq/GikC+U+QJa3lvUdph9rtIYEL1z0WCUk+t7AsjtfqVPzuqYFO2\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
208 "UKqteGECgYEA768K7sD0q+bH/P8tFALd+Ynj1bPdBOTsqPCaRiQeC8omoYpovI3z\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
209 "bKEqehQA4OQ4PERrysOCQU4G+n/XV20LbvdfNx655swFhNLwbNbPfp6p6eLzfks3\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
210 "52FP8B10scM7OCheHiGhyvxObTZjeVZ15eUYx8OaLCRiU9tPAuuo/5UCgYEA0C2E\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
211 "bf+56XY+fxnRR6sNkVL4ztjWRku+zKTAikxu7GA9ueNBmkXSBVcTL1rj0aErOc+Z\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
212 "IcUmCVoH67txmXed54NhTx7F7R+K1MBSfFS9WPMuOHfoOO0B4pH2V03bZf14WaAJ\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
213 "a14WNRCHhp7bgkGPzJINi+X810dIXxw0/fBkhu0CgYBeaF4wCMTW6QIg/wnsdeyl\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
214 "G9EoHb6S7PDi4lKCCjvjfO6WdoQmsOsPALRQfYyTCJG1+2VR6oxl2KwbAzv47bSx\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
215 "MrLIbUvgQsBxvvyAgmQchbZ7r68lMc+FTelEtPWAB1xOFGhuCeVGpPbnQaMQ6iNq\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
216 "OED4fm09sd8hFKMcjWJ1uQKBgQCxgw6YaWXS4EP8RzyAGyiPkaudXaKhAHeqspWH\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
217 "mBNBtfMMbe8DqKOkcBJo39zBZOeh/RY7iIudj8qPRR9h2HCp+Api1/+36ZyNO41a\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
218 "fTuT/JCeEAjRea+Qzhu7aCU7+33DFsbRacIP749QyGau1E7VBnlMoIkP3LWmfDvn\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
219 "iTN/JQKBgQC2va9Ou4NNWu1VyFMO1BOo0Tw3FSPCqsZ+5iPHztw/b98EIkM72Ran\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
220 "kcMwgXOMTnBN5GuGdvTARVs/PvYaHkcD7YPFR32yT1JVSOtRt6AQ+EJkVj9trPzM\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
221 "Q6TrU0XBPpoXkOSDi0tLFbzdLbJLLbtIDGJfvETYNq4lTKMnvJ2hBQ==\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
222 "-----END RSA PRIVATE KEY-----\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
223 ;
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
224
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
225 /* Server:
1399
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
226 Certificate:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
227 Data:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
228 Version: 3 (0x2)
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
229 Serial Number: 2 (0x2)
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
230 Signature Algorithm: sha256WithRSAEncryption
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
231 Issuer: CN=ca.localdomain, C=FR, ST=BdR, L=Aix, O=fD, OU=Tests
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
232 Validity
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
233 Not Before: Nov 24 17:06:43 2019 GMT
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
234 Not After : Oct 31 17:06:43 2119 GMT
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
235 Subject: C=FR, ST=BdR, O=fD, OU=Tests, CN=server.test
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
236 Subject Public Key Info:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
237 Public Key Algorithm: rsaEncryption
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
238 Public-Key: (2048 bit)
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
239 Modulus:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
240 00:a4:d4:cf:09:7c:35:02:38:34:ee:80:fd:bf:a0:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
241 d2:f9:37:c2:3f:1c:3e:74:ac:38:c4:53:ce:f6:c2:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
242 03:31:b8:2c:8e:b0:b5:f5:58:34:4b:ef:1d:ef:b6:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
243 f0:66:1e:48:54:f1:b7:d5:53:13:98:81:00:a0:60:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
244 84:f8:f2:bd:d1:d0:74:95:d8:eb:41:77:c2:ec:48:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
245 5c:fa:fe:0c:ab:af:75:47:18:fa:96:27:cb:06:d8:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
246 01:af:05:67:cc:10:ae:71:36:7b:6b:d7:fb:c9:c7:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
247 e3:6a:e3:20:c3:2f:9e:5e:ef:68:2c:a5:80:c1:77:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
248 85:ef:c0:0b:d4:00:57:07:e9:c4:fc:b1:df:93:64:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
249 eb:1f:36:e3:81:74:e7:8c:91:8a:3d:09:60:dd:f5:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
250 9c:93:21:49:9c:45:6f:6f:3a:d3:39:5c:5c:54:ed:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
251 8c:d5:d8:28:d4:58:46:e7:6b:b2:93:09:62:8a:9c:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
252 c7:23:dc:7f:71:93:8b:7e:11:67:73:52:3f:99:ea:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
253 ec:9f:0e:6b:d3:0a:be:48:c2:c9:6b:05:a3:f4:d7:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
254 20:73:83:43:f3:7b:17:1a:fb:73:36:7e:22:a0:68:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
255 bc:63:ea:02:0f:7c:05:92:15:8b:b2:dc:89:a9:3d:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
256 ac:31:d5:29:4b:0d:95:b7:2c:8e:6a:61:7b:f4:c5:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
257 cf:cf
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
258 Exponent: 65537 (0x10001)
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
259 X509v3 extensions:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
260 X509v3 Basic Constraints:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
261 CA:FALSE
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
262 Netscape Comment:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
263 OpenSSL Generated Certificate
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
264 X509v3 Subject Key Identifier:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
265 79:F6:AB:D6:1F:AF:03:E0:02:90:D8:EB:0E:D2:D4:0F:01:60:43:33
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
266 X509v3 Authority Key Identifier:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
267 keyid:56:24:30:EC:F4:4E:A8:DA:29:EB:97:40:C6:32:ED:0F:87:F5:F6:00
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
268
1399
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
269 Signature Algorithm: sha256WithRSAEncryption
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
270 c8:69:0d:53:52:2c:5f:d9:8a:e9:96:98:27:8f:88:51:df:51:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
271 d2:fb:5c:7a:25:bb:4f:80:7a:8a:e9:f7:16:c0:d6:7e:8a:4c:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
272 78:81:2b:63:8f:bf:98:f2:91:fc:a7:a0:81:64:f3:c9:20:ab:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
273 52:fc:68:24:05:59:3e:ae:47:7b:c0:e1:97:7c:25:73:6b:a0:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
274 34:bd:90:61:62:51:67:1e:6c:1e:2d:8c:e1:bd:d6:a6:ba:d9:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
275 a9:8b:7a:c8:76:d0:25:83:28:5f:9c:1d:d5:ab:40:ce:0c:8e:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
276 96:8c:95:ba:bd:2f:fc:f3:81:80:15:5c:7d:5f:d2:28:bd:ea:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
277 68:3e:df:95:df:4a:1c:f3:fc:4d:f4:87:25:f1:4b:b2:7d:f3:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
278 ba:17:4a:2d:be:6d:a6:d6:f5:b0:cf:fc:2c:ec:5f:70:b5:30:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
279 3d:2c:c3:dc:33:b8:c8:2e:90:7e:62:2c:51:51:bf:91:80:a8:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
280 b6:f7:8d:3d:69:03:f4:07:ca:8c:8a:75:f0:4b:1b:44:eb:d1:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
281 76:fd:61:e1:7d:f7:35:6e:04:3b:5e:c9:a9:f1:d9:7b:ee:43:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
282 31:84:74:66:18:71:b6:b6:c7:98:3a:42:a6:03:ac:a6:b7:56:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
283 8c:76:a5:13:33:71:31:0c:43:b8:27:17:7c:c8:3c:0f:3d:16:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
284 86:0e:13:87:00:5b:af:9c:c3:e3:e7:37:fc:3e:07:54:63:53:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
285 af:d6:91:dd:1d:e2:25:d8:57:b0:bc:db:a8:2a:f8:23:e9:15:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
286 1e:01:f3:e3:37:e4:21:85:48:35:66:d0:6e:72:96:ca:09:d7:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
287 26:99:d5:5d:fa:b2:39:94:15:d6:29:45:e7:5c:c6:ea:61:8f:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
288 4d:6a:68:32:93:b1:1d:b2:28:8a:b0:43:b7:17:c4:81:eb:4e:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
289 ef:91:ed:ca:d9:d8:fa:b2:e1:c8:9b:21:27:cf:77:83:98:10:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
290 af:54:09:9f:ce:6b:63:bd:f9:f8:00:97:3f:53:89:50:dc:6d:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
291 e9:45:42:18:46:91:3d:b5:60:45:9d:17:b1:69:71:a4:69:5e:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
292 18:65:cf:06:90:df:5b:db:60:57:ed:de:5c:ef:e8:05:d4:a7:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
293 10:c9:13:32:e3:b3:c3:70:fc:4e:2f:22:a4:40:e1:e3:8f:aa:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
294 fc:f6:d6:d6:1d:9a:54:32:9c:01:11:68:69:e7:2a:9f:ca:57:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
295 60:f8:6c:bd:ff:5c:d4:0a:e4:45:f7:6a:3c:40:cc:27:e3:d0:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
296 ae:9f:24:de:cc:5d:70:0e:b2:31:a5:62:65:6e:cd:0a:1c:41:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
297 f4:45:ec:bb:47:f8:2d:80:0c:6f:62:42:8e:12:90:5a:98:56:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
298 bc:b8:2f:0e:31:d4:f8:f3
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
299 */
1399
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
300 static char server_cert_data[] = ""
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
301 "-----BEGIN CERTIFICATE-----\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
302 "MIIEpTCCAo2gAwIBAgIBAjANBgkqhkiG9w0BAQsFADBfMRcwFQYDVQQDDA5jYS5s\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
303 "b2NhbGRvbWFpbjELMAkGA1UEBhMCRlIxDDAKBgNVBAgMA0JkUjEMMAoGA1UEBwwD\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
304 "QWl4MQswCQYDVQQKDAJmRDEOMAwGA1UECwwFVGVzdHMwIBcNMTkxMTI0MTcwNjQz\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
305 "WhgPMjExOTEwMzExNzA2NDNaME4xCzAJBgNVBAYTAkZSMQwwCgYDVQQIDANCZFIx\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
306 "CzAJBgNVBAoMAmZEMQ4wDAYDVQQLDAVUZXN0czEUMBIGA1UEAwwLc2VydmVyLnRl\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
307 "c3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCk1M8JfDUCODTugP2/\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
308 "oNL5N8I/HD50rDjEU872wgMxuCyOsLX1WDRL7x3vtvBmHkhU8bfVUxOYgQCgYIT4\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
309 "8r3R0HSV2OtBd8LsSFz6/gyrr3VHGPqWJ8sG2AGvBWfMEK5xNntr1/vJx+Nq4yDD\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
310 "L55e72gspYDBd4XvwAvUAFcH6cT8sd+TZOsfNuOBdOeMkYo9CWDd9ZyTIUmcRW9v\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
311 "OtM5XFxU7YzV2CjUWEbna7KTCWKKnMcj3H9xk4t+EWdzUj+Z6uyfDmvTCr5Iwslr\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
312 "BaP01yBzg0Pzexca+3M2fiKgaLxj6gIPfAWSFYuy3ImpPawx1SlLDZW3LI5qYXv0\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
313 "xc/PAgMBAAGjezB5MAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wg\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
314 "R2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBR59qvWH68D4AKQ2OsO0tQP\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
315 "AWBDMzAfBgNVHSMEGDAWgBRWJDDs9E6o2inrl0DGMu0Ph/X2ADANBgkqhkiG9w0B\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
316 "AQsFAAOCAgEAyGkNU1IsX9mK6ZaYJ4+IUd9R0vtceiW7T4B6iun3FsDWfopMeIEr\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
317 "Y4+/mPKR/KeggWTzySCrUvxoJAVZPq5He8Dhl3wlc2ugNL2QYWJRZx5sHi2M4b3W\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
318 "prrZqYt6yHbQJYMoX5wd1atAzgyOloyVur0v/POBgBVcfV/SKL3qaD7fld9KHPP8\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
319 "TfSHJfFLsn3zuhdKLb5tptb1sM/8LOxfcLUwPSzD3DO4yC6QfmIsUVG/kYCotveN\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
320 "PWkD9AfKjIp18EsbROvRdv1h4X33NW4EO17JqfHZe+5DMYR0ZhhxtrbHmDpCpgOs\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
321 "prdWjHalEzNxMQxDuCcXfMg8Dz0Whg4ThwBbr5zD4+c3/D4HVGNTr9aR3R3iJdhX\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
322 "sLzbqCr4I+kVHgHz4zfkIYVINWbQbnKWygnXJpnVXfqyOZQV1ilF51zG6mGPTWpo\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
323 "MpOxHbIoirBDtxfEgetO75HtytnY+rLhyJshJ893g5gQr1QJn85rY735+ACXP1OJ\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
324 "UNxt6UVCGEaRPbVgRZ0XsWlxpGleGGXPBpDfW9tgV+3eXO/oBdSnEMkTMuOzw3D8\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
325 "Ti8ipEDh44+q/PbW1h2aVDKcARFoaecqn8pXYPhsvf9c1ArkRfdqPEDMJ+PQrp8k\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
326 "3sxdcA6yMaViZW7NChxB9EXsu0f4LYAMb2JCjhKQWphWvLgvDjHU+PM=\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
327 "-----END CERTIFICATE-----\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
328 ;
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
329 static char server_priv_data[] = ""
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
330 "-----BEGIN RSA PRIVATE KEY-----\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
331 "MIIEogIBAAKCAQEApNTPCXw1Ajg07oD9v6DS+TfCPxw+dKw4xFPO9sIDMbgsjrC1\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
332 "9Vg0S+8d77bwZh5IVPG31VMTmIEAoGCE+PK90dB0ldjrQXfC7Ehc+v4Mq691Rxj6\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
333 "lifLBtgBrwVnzBCucTZ7a9f7ycfjauMgwy+eXu9oLKWAwXeF78AL1ABXB+nE/LHf\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
334 "k2TrHzbjgXTnjJGKPQlg3fWckyFJnEVvbzrTOVxcVO2M1dgo1FhG52uykwliipzH\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
335 "I9x/cZOLfhFnc1I/mersnw5r0wq+SMLJawWj9Ncgc4ND83sXGvtzNn4ioGi8Y+oC\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
336 "D3wFkhWLstyJqT2sMdUpSw2VtyyOamF79MXPzwIDAQABAoIBAC6uushD7jtnsc4O\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
337 "qE8afEXq/c+j7yhaEmXAGrCWOBNfxvbOo2oOBhmvajoXBLTXRMMSBm+bbMRXXNcP\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
338 "Hvnmvc3rjOlXmyFaitEimXrYcrw5ICz3rRjTwlN439ky3bfUzaLwvDnJ3NzECOuf\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
339 "0gqVtPPMOCPU58djU4KYUIFFa2Co5v474RKBKNv18QuxGg6NWkPZhMAp1S0uAm+w\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
340 "lwnpSXzS5X0qDC/EklZ9JLlGvvLZKreoWbk+sMv0x/jykwxI567hQq6hRoQ32YM+\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
341 "+d/hBDSm69zf0om/XTFMzUSs5ss3TZyVujTTquTKktXzIT3gX+e7SMrt/fJi5ofr\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
342 "39ijMRECgYEA2Ye77hHLEf57hf/tTK4gV4KUhatQTI5Rfa1WD1Z+jr99H/hiJw8f\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
343 "dKeu8KUkU5REYFznu0fU/hSHXAxQf6Ae2NtM7uYbTEUgbuUKfG+8CT0UqWHkTtIB\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
344 "egUc8ZD580VcM/WkK1A7if688COvwGYqrilq3kJYPwDmYsQBrJ/9uWcCgYEAwfs7\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
345 "Kbt/g3Y7xaSyvLTTMgWrUGHSRV70vOPYe9qOEkU1HdMKhFQxbUfolfXEHq/gK/G5\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
346 "KjxghUkN86T4h7xOXaiM1uYCioVmfIfV2ye95n9jdMvAz+W2z6chYLQs33R0AW7D\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
347 "wI+yk7S0EeeAbygL5GtDLz1NNUYsAe4zA/g07VkCgYBznUC096AGoErmnW9yIdnu\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
348 "qOhnYvX6uml1cnsbC82X8Q5/v3Prbo45YiYIoLz97v+od7hyQWti32ZR9fmS23eJ\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
349 "qoTpNEOt9c+XIQTBvmEiR+SDYhQGEHfYcn8/pN4z/dlThGsM2kfKwCmLOGxgxexJ\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
350 "RJoYJwrf8YqBU8vQA/jGYQKBgFzZ7sXZE/5PN+kxHsUpIPaOtCPzzvyZqThJL7SJ\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
351 "NvwT2IsAG8afrlEK3I/7ZfbyZLFkMSfAYssp3t3DF5uRTUmThmbPDmRT2my9cGZI\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
352 "raOJUofzh8V7xXe8HkP1uozzZxvQcy7XGbmOA6uWTmnml1qs5SnVhAF+J059QDok\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
353 "MuFxAoGAQAwkelYrjyHFIxCX4/5/o36FsSKWRnvzGVhPlUZ6lPMVSsBYuTqfNDZv\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
354 "K3UFwXsqiepM4Mso1TNEmoj5OhlJRkUi2WQPcvCzhuNZOBrtENxeLvjzMkIv3QfN\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
355 "PtGTm8nE7MyIChUCfsGwh1yfhGfT9s1yeRUpYCjGkD2lC2/fmmI=\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
356 "-----END RSA PRIVATE KEY-----\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
357 ;
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
358
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
359 /* Expired:
1399
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
360 Certificate:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
361 Data:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
362 Version: 3 (0x2)
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
363 Serial Number: 3 (0x3)
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
364 Signature Algorithm: sha256WithRSAEncryption
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
365 Issuer: CN=ca.localdomain, C=FR, ST=BdR, L=Aix, O=fD, OU=Tests
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
366 Validity
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
367 Not Before: Nov 23 17:29:33 2019 GMT
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
368 Not After : Nov 24 17:29:33 2019 GMT
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
369 Subject: C=FR, ST=BdR, O=fD, OU=Tests, CN=expired.test
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
370 Subject Public Key Info:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
371 Public Key Algorithm: rsaEncryption
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
372 Public-Key: (2048 bit)
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
373 Modulus:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
374 00:e8:11:78:5c:1a:9f:60:46:dc:0a:f7:71:6c:39:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
375 0c:b7:5d:b9:08:92:d8:a7:aa:b5:34:26:a6:07:18:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
376 65:f9:77:16:31:f4:d9:fd:fe:88:3e:d1:10:9b:e3:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
377 f0:15:cc:ea:4e:1f:33:7d:a0:06:5c:65:41:db:d0:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
378 99:ce:99:4d:22:8d:bf:0d:aa:f1:30:f8:43:19:02:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
379 9d:2d:14:90:db:08:55:92:f4:7e:4d:46:fa:3a:39:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
380 43:c2:a6:6a:75:a7:52:f1:92:ba:2d:df:ba:ca:c8:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
381 fb:53:e1:3b:fd:b6:6f:50:7a:bf:de:4b:24:13:52:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
382 31:de:a0:1f:35:2e:02:12:bd:15:70:51:8a:62:61:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
383 74:41:16:aa:22:41:ac:83:dd:a1:2b:bc:62:ab:e3:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
384 6d:1c:53:73:2e:70:55:f5:f0:54:27:2d:b4:31:41:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
385 90:b9:4b:3b:15:b8:16:dc:67:cb:4f:ea:2a:fe:69:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
386 13:7f:22:df:a8:96:6d:eb:42:cb:ca:ad:8b:18:5f:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
387 b4:a3:4e:96:80:c4:33:8b:7b:0c:11:86:7d:22:9f:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
388 3e:ed:7d:ca:e8:e0:1a:fa:80:b0:8d:58:c9:ef:37:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
389 5a:a1:d4:df:1f:ac:45:5b:66:7d:92:be:25:53:ef:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
390 1b:e4:68:77:66:36:9c:87:c9:82:20:64:dc:f5:1a:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
391 64:77
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
392 Exponent: 65537 (0x10001)
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
393 X509v3 extensions:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
394 X509v3 Basic Constraints:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
395 CA:FALSE
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
396 Netscape Comment:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
397 OpenSSL Generated Certificate
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
398 X509v3 Subject Key Identifier:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
399 03:44:CB:35:55:E0:87:7B:6F:3F:A5:06:19:70:99:F2:21:B1:C2:48
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
400 X509v3 Authority Key Identifier:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
401 keyid:56:24:30:EC:F4:4E:A8:DA:29:EB:97:40:C6:32:ED:0F:87:F5:F6:00
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
402
1399
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
403 Signature Algorithm: sha256WithRSAEncryption
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
404 9c:d1:af:3c:6c:41:1c:fe:dd:e2:60:b0:af:0b:f4:ea:64:e0:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
405 e3:13:54:ee:23:93:fb:61:88:a8:9d:9e:21:e8:6b:68:b0:3f:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
406 82:5b:95:22:ac:7b:06:d9:b4:49:b6:bd:4f:2e:4b:4a:cc:97:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
407 b3:c4:1b:31:fd:60:ae:ca:54:aa:1f:a1:0b:f0:84:66:5f:02:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
408 83:cf:bc:43:aa:5f:f6:fb:17:52:9d:f0:0e:2a:d7:f3:76:63:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
409 ca:59:ce:20:84:c5:c9:3a:bb:e7:8e:d8:04:95:4e:84:76:52:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
410 6d:fb:e1:fb:ae:23:64:a9:a1:34:c2:a2:8a:62:69:31:1d:88:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
411 ef:f1:e3:ba:d3:23:8f:e3:93:0d:a8:5e:51:ce:fa:af:2c:68:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
412 52:40:66:84:f0:4d:cc:1b:6f:dc:fc:c7:ee:85:18:4c:ec:96:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
413 31:4f:36:69:ba:05:ed:27:a2:bb:b1:51:de:e9:46:ea:22:67:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
414 8d:ee:85:60:19:f7:5b:0e:cb:4b:04:cc:ea:17:c9:59:dd:c0:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
415 59:03:9d:4a:94:fa:97:47:51:95:34:a3:1e:c2:f1:ff:af:d9:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
416 04:48:bd:6e:6c:01:ab:5f:76:77:a3:42:3d:24:9c:00:32:1f:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
417 f1:65:38:78:da:c8:5d:65:df:5f:9c:26:18:51:2e:56:33:73:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
418 7d:d3:dc:dc:3b:7a:d2:28:cb:58:92:13:bb:f8:a2:96:c0:64:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
419 27:c1:06:03:c3:41:28:3e:ee:c3:a6:aa:f2:20:1b:4b:78:6a:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
420 14:a7:eb:c5:60:ba:06:fb:1d:d5:68:c7:03:62:72:e2:dd:27:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
421 a8:5a:dc:e8:c2:12:ba:66:9a:72:ce:a8:a3:c2:dc:b4:20:13:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
422 65:68:c4:bc:40:06:2a:ed:a8:95:70:9e:be:7f:d8:59:8f:bc:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
423 14:6a:37:9e:84:c0:c2:fb:bd:18:5d:d1:2a:25:8d:10:e1:51:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
424 48:66:1e:8a:c4:0f:e5:0f:46:af:e3:5c:5e:a7:45:4b:3b:e3:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
425 1b:bd:f9:b7:75:05:b4:39:3b:38:69:00:04:86:e7:fa:6d:20:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
426 5d:e7:ff:39:a5:73:5c:9c:0b:50:1d:d2:76:20:b9:28:3b:a5:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
427 e1:24:e8:a0:85:94:39:15:8b:c8:d4:76:9e:79:82:46:56:4f:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
428 f4:3c:18:54:2a:77:82:9b:17:0c:4f:aa:e1:28:53:19:1c:1e:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
429 92:f9:8d:06:82:c5:5a:40:46:79:a4:68:54:82:d0:5f:33:1e:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
430 e1:83:dd:c2:57:ac:88:5a:31:71:b7:45:23:89:99:d6:8c:33:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
431 96:72:2f:6c:ee:46:31:24:ed:68:48:1d:05:b7:a2:d7:a8:5b:
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
432 41:1b:1d:15:39:14:69:79
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
433 */
1399
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
434 static char expired_cert_data[]= ""
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
435 "-----BEGIN CERTIFICATE-----\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
436 "MIIEpDCCAoygAwIBAgIBAzANBgkqhkiG9w0BAQsFADBfMRcwFQYDVQQDDA5jYS5s\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
437 "b2NhbGRvbWFpbjELMAkGA1UEBhMCRlIxDDAKBgNVBAgMA0JkUjEMMAoGA1UEBwwD\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
438 "QWl4MQswCQYDVQQKDAJmRDEOMAwGA1UECwwFVGVzdHMwHhcNMTkxMTIzMTcyOTMz\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
439 "WhcNMTkxMTI0MTcyOTMzWjBPMQswCQYDVQQGEwJGUjEMMAoGA1UECAwDQmRSMQsw\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
440 "CQYDVQQKDAJmRDEOMAwGA1UECwwFVGVzdHMxFTATBgNVBAMMDGV4cGlyZWQudGVz\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
441 "dDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOgReFwan2BG3Ar3cWw5\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
442 "DLdduQiS2KeqtTQmpgcYZfl3FjH02f3+iD7REJvj8BXM6k4fM32gBlxlQdvQmc6Z\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
443 "TSKNvw2q8TD4QxkCnS0UkNsIVZL0fk1G+jo5Q8KmanWnUvGSui3fusrI+1PhO/22\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
444 "b1B6v95LJBNSMd6gHzUuAhK9FXBRimJhdEEWqiJBrIPdoSu8YqvjbRxTcy5wVfXw\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
445 "VCcttDFBkLlLOxW4Ftxny0/qKv5pE38i36iWbetCy8qtixhftKNOloDEM4t7DBGG\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
446 "fSKfPu19yujgGvqAsI1Yye83WqHU3x+sRVtmfZK+JVPvG+Rod2Y2nIfJgiBk3PUa\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
447 "ZHcCAwEAAaN7MHkwCQYDVR0TBAIwADAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBH\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
448 "ZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFANEyzVV4Id7bz+lBhlwmfIh\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
449 "scJIMB8GA1UdIwQYMBaAFFYkMOz0TqjaKeuXQMYy7Q+H9fYAMA0GCSqGSIb3DQEB\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
450 "CwUAA4ICAQCc0a88bEEc/t3iYLCvC/TqZODjE1TuI5P7YYionZ4h6GtosD+CW5Ui\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
451 "rHsG2bRJtr1PLktKzJezxBsx/WCuylSqH6EL8IRmXwKDz7xDql/2+xdSnfAOKtfz\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
452 "dmPKWc4ghMXJOrvnjtgElU6EdlJt++H7riNkqaE0wqKKYmkxHYjv8eO60yOP45MN\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
453 "qF5RzvqvLGhSQGaE8E3MG2/c/MfuhRhM7JYxTzZpugXtJ6K7sVHe6UbqImeN7oVg\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
454 "GfdbDstLBMzqF8lZ3cBZA51KlPqXR1GVNKMewvH/r9kESL1ubAGrX3Z3o0I9JJwA\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
455 "Mh/xZTh42shdZd9fnCYYUS5WM3N909zcO3rSKMtYkhO7+KKWwGQnwQYDw0EoPu7D\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
456 "pqryIBtLeGoUp+vFYLoG+x3VaMcDYnLi3SeoWtzowhK6Zppyzqijwty0IBNlaMS8\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
457 "QAYq7aiVcJ6+f9hZj7wUajeehMDC+70YXdEqJY0Q4VFIZh6KxA/lD0av41xep0VL\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
458 "O+Mbvfm3dQW0OTs4aQAEhuf6bSBd5/85pXNcnAtQHdJ2ILkoO6XhJOighZQ5FYvI\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
459 "1HaeeYJGVk/0PBhUKneCmxcMT6rhKFMZHB6S+Y0GgsVaQEZ5pGhUgtBfMx7hg93C\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
460 "V6yIWjFxt0UjiZnWjDOWci9s7kYxJO1oSB0Ft6LXqFtBGx0VORRpeQ==\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
461 "-----END CERTIFICATE-----\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
462
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
463 ;
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
464 static char expired_priv_data[]= ""
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
465 "-----BEGIN RSA PRIVATE KEY-----\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
466 "MIIEowIBAAKCAQEA6BF4XBqfYEbcCvdxbDkMt125CJLYp6q1NCamBxhl+XcWMfTZ\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
467 "/f6IPtEQm+PwFczqTh8zfaAGXGVB29CZzplNIo2/DarxMPhDGQKdLRSQ2whVkvR+\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
468 "TUb6OjlDwqZqdadS8ZK6Ld+6ysj7U+E7/bZvUHq/3kskE1Ix3qAfNS4CEr0VcFGK\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
469 "YmF0QRaqIkGsg92hK7xiq+NtHFNzLnBV9fBUJy20MUGQuUs7FbgW3GfLT+oq/mkT\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
470 "fyLfqJZt60LLyq2LGF+0o06WgMQzi3sMEYZ9Ip8+7X3K6OAa+oCwjVjJ7zdaodTf\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
471 "H6xFW2Z9kr4lU+8b5Gh3Zjach8mCIGTc9RpkdwIDAQABAoIBADS9c6sK6dmJgQyE\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
472 "+6PquzcY96o5JT/FjfTSK71FEDfHlqW3zarpo7ES9kFXZgKuVTl34c3VBl0NLhB0\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
473 "sd+/+0W1DQxgIvxMD4OpkmriV6FPnZMOOX36eXet9/ZOt7cRVcpM3D78r4jScDu5\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
474 "3lZklZumqeAtF3/EmEzN+wms8Q+stltBR3xo7pbvmllI41Igq0UAHmbAodKBhsXc\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
475 "RorKLGsVsE4EeM5tTw1Ca5wmLZ2FvJC30eAkCzB5VkdAEiRfwooT+lwM9BjMJ8he\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
476 "2cVGMRcYW+52t9WMUG8z4zbvHg3WsBwKHgc6AQ9A6al7bh/end6rowiqUKRgo1a0\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
477 "3cKIznECgYEA98eWvy0JIUp6kb4FzfCC3moyIroPCloadgQfPCFDpC88zK4K6LQg\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
478 "qdGpWWCyNpz/MsEr8moWo9UXZo9kxoMQXS+siR8MzEff2QMHH646ZOHmODvneTL6\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
479 "pOWbcCKUofJDPXB+jk9Jbeqcq3eaTxE72girt2Fc28Z2WTqyQ03M2hsCgYEA78Rx\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
480 "dNxNpncsdBeWglxr4/gbDYi5QMZ/GDIRXEMCkqiHsGmW/7LVSfWwU/kDsBFKtMA0\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
481 "qZdNApSuhhgSP6Sae3bwoJE6iLSSzZ2eIpAOR6uBQA20UxS85cdEtRNx4HgTmoQc\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
482 "fl+zPiKeAnd0sllxzzD/uFkMm3q6dx1Qnq7JhNUCgYA1FezlLqfrGwLhoL2rnqDb\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
483 "OBNfv08jn6RVrpJmlpXgYkJ7c7pgmt74ozPOM1pbOw2t+RcKS9Jn7WqjDYvAwCnM\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
484 "XT9w7VcXmTqLSwvGrNRT8tYZLDRukg6DL7I6tx3zCG2Bh02F/dS0mPRSBEDqOb4B\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
485 "+6OWmWSEraODgIDazJtcCwKBgE7whU4tTh91cxxRu8r1tMvcnsOI9T0fXS7RJSgU\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
486 "I9+3Pt1VFlLfRRvRmRk8jftE5iy2b2A6oS8tVnxtpmxvvDDUCwtCZVwm34J012CX\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
487 "vyvXinlVSb5kwICCZ9uaKE74GbQwtNTimzfk29MCE1i43CCUCE1gfCcgdA3NiAKG\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
488 "l3B1AoGBANpEOZLSVd/XfBfw8dwPdtC9wjMqHcKTOuaqaCXSiKKMn2vnaSRIs08U\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
489 "rhj3Qzm6p33Hsxm3WibwcW7pBTC2vsa9DBv6ZJcXeB2qmmDxpIydVn64yd6WD3+M\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
490 "bvEZZHKFcDcjAeoP6RJiFb+wppk3byqxjjSUr1JhKg1NtWriOSo7\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
491 "-----END RSA PRIVATE KEY-----\n"
eff5bb332b5a Fix testcnx expired CA data
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1186
diff changeset
492 ;
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
493
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
494 /* Unknown CA certificate :
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
495 Certificate:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
496 Data:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
497 Version: 3 (0x2)
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
498 Serial Number: 1 (0x1)
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
499 Signature Algorithm: sha1WithRSAEncryption
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
500 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
501 Validity
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
502 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
503 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
504 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
505 Subject Public Key Info:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
506 Public Key Algorithm: rsaEncryption
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
507 RSA Public Key: (1024 bit)
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
508 Modulus (1024 bit):
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
509 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
510 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
511 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
512 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
513 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
514 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
515 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
516 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
517 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
518 Exponent: 65537 (0x10001)
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
519 X509v3 extensions:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
520 X509v3 Basic Constraints:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
521 CA:FALSE
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
522 Netscape Comment:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
523 OpenSSL Generated Certificate
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
524 X509v3 Subject Key Identifier:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
525 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
526 X509v3 Authority Key Identifier:
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
527 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
528
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
529 Signature Algorithm: sha1WithRSAEncryption
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
530 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
531 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
532 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
533 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
534 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
535 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
536 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
537 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
538 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
539 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
540 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
541 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
542 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
543 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
544 cc:ee:73:6f
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
545 */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
546 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
547 "MIIEqjCCA5KgAwIBAgIJAP3UMghSlH9PMA0GCSqGSIb3DQEBBQUAMIGUMQswCQYD\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
548 "VQQGEwJKUDEOMAwGA1UECAwFVG9reW8xEDAOBgNVBAcMB0tvZ2FuZWkxDTALBgNV\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
549 "BAoMBFdJREUxDzANBgNVBAsMBkFBQSBXRzEfMB0GA1UEAwwWY2hhdnJvdXguY293\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
550 "YWRkaWN0Lm9yZzEiMCAGCSqGSIb3DQEJARYTc2RlY3VnaXNAbmljdC5nby5qcDAe\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
551 "Fw0wOTEwMjgwODAzNDRaFw0xOTEwMjYwODAzNDRaMIGUMQswCQYDVQQGEwJKUDEO\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
552 "MAwGA1UECAwFVG9reW8xEDAOBgNVBAcMB0tvZ2FuZWkxDTALBgNVBAoMBFdJREUx\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
553 "DzANBgNVBAsMBkFBQSBXRzEfMB0GA1UEAwwWY2hhdnJvdXguY293YWRkaWN0Lm9y\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
554 "ZzEiMCAGCSqGSIb3DQEJARYTc2RlY3VnaXNAbmljdC5nby5qcDCCASIwDQYJKoZI\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
555 "hvcNAQEBBQADggEPADCCAQoCggEBALKW9iSUggF5mbvYe1Xk128Csfiijx+fwH5y\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
556 "ZqWrHNt0YG/tZSwyCDMWBLXTeuYsntg5y0mcpsrN8v02tvrPiCzDfRPyz3mG68us\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
557 "DPEEgQ1kqL2Gsti2DUcsdyZcDM+4rgsWRivgOTVyoNimv5f+xgmPYoElkgelLwZK\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
558 "WxGt1VCebOxP3qZA3hSHWE1hJgL4svful7RD1PbwPzidxJKITyAiJoPKWQA9cjSa\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
559 "gVzRQ7S4vmYALJn7xe+dMFRcfAK8RMv7/gJF6Rw7zufW0DIZK98KZs6aL0lmMPVk\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
560 "f31N2uvndf+cjy0n4luwEoXY+TeJZY205lbwHrzR0rH75FSm0RsCAwEAAaOB/DCB\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
561 "+TAdBgNVHQ4EFgQUUsWkY7jbrPKSNC9yVnHIEY525t8wgckGA1UdIwSBwTCBvoAU\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
562 "UsWkY7jbrPKSNC9yVnHIEY525t+hgZqkgZcwgZQxCzAJBgNVBAYTAkpQMQ4wDAYD\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
563 "VQQIDAVUb2t5bzEQMA4GA1UEBwwHS29nYW5laTENMAsGA1UECgwEV0lERTEPMA0G\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
564 "A1UECwwGQUFBIFdHMR8wHQYDVQQDDBZjaGF2cm91eC5jb3dhZGRpY3Qub3JnMSIw\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
565 "IAYJKoZIhvcNAQkBFhNzZGVjdWdpc0BuaWN0LmdvLmpwggkA/dQyCFKUf08wDAYD\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
566 "VR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEACANo6IR3OQlQaXHJaprVVDvl\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
567 "oMJC0FRbVCK503sbmWTJL98UqxRdsTZNIL07gXlK0oUKyiNijIXiLG8d5IlUrDxF\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
568 "H/Vsu6s8k3/PpAUVeiO2oygWqvU5NGvt0jg54MrOJKhYYPWrzbmHty+cAXyoNzOR\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
569 "+W5RX6HRQgxvZWQq2Ok46VX622R1nNjFmCBYT7I7/gWG+hkbIAoH6d9sULLjpC+B\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
570 "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
571 "tWFVXZnx58odaU3M4t9/ZQnkZdx9YJIroETbN0PoqlnSagBjgUvbWwn4YCotCA==\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
572 "-----END CERTIFICATE-----\n";
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
573
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
574 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
575 "MIIDhjCCAm6gAwIBAgIBATANBgkqhkiG9w0BAQUFADCBlDELMAkGA1UEBhMCSlAx\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
576 "DjAMBgNVBAgMBVRva3lvMRAwDgYDVQQHDAdLb2dhbmVpMQ0wCwYDVQQKDARXSURF\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
577 "MQ8wDQYDVQQLDAZBQUEgV0cxHzAdBgNVBAMMFmNoYXZyb3V4LmNvd2FkZGljdC5v\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
578 "cmcxIjAgBgkqhkiG9w0BCQEWE3NkZWN1Z2lzQG5pY3QuZ28uanAwHhcNMDkxMDI4\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
579 "MDgwNDQwWhcNMTAxMDI4MDgwNDQwWjB/MQswCQYDVQQGEwJKUDEOMAwGA1UECAwF\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
580 "VG9reW8xEDAOBgNVBAcMB0tvZ2FuZWkxDTALBgNVBAoMBFdJREUxDzANBgNVBAsM\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
581 "BkFBQSBXRzETMBEGA1UEAwwKdW5rbm93bi5jczEZMBcGCSqGSIb3DQEJARYKdW5r\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
582 "bm93bkBjYTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA5jrVihTIFdDwXAPD\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
583 "rzNRLBe3ZaxF6EgtrnD9fHk6x4DIUFPQGdg6JqgWTUwEFwnfaZtZK4nI4GC7HTeC\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
584 "0j8XOcmPXXbhD24Imo8WSuqDhvm9FRRWaId5BflfZhG9IkYmZL5XFlFmQVCs8rHK\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
585 "0DgRS0yy7iU2btO5Y3LEhIIcKycCAwEAAaN7MHkwCQYDVR0TBAIwADAsBglghkgB\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
586 "hvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYE\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
587 "FLpandKwS3LWHwARC7V7Wd8IOIG+MB8GA1UdIwQYMBaAFFLFpGO426zykjQvclZx\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
588 "yBGOdubfMA0GCSqGSIb3DQEBBQUAA4IBAQCQjzu946HKapKm/fBkrkaDMjVhgFeL\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
589 "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
590 "JOz9e9L9UD7lYU91Ua7GSuzfz6pzpQj385pAZkjwjptDsTDz48g2P2g2ahyqFkBJ\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
591 "tHOacfEXbAvT4ae3QN4sPDZ81N3WlMnXX/WuNVbozGWcuz3oesoO7XgDQcv9gIHe\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
592 "+d6yFEuBJDbeKcEGEYaMqbAMx1fPeac6hAwn3IZty0QtJtx++xfWsj0xA9Pxq12R\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
593 "XZTklIhwlrN8DxX+yMZNmTerCQzaurYO+l67S84EIQYJqSwnhnbM7nNv\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
594 "-----END CERTIFICATE-----\n";
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
595 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
596 "MIICXQIBAAKBgQDmOtWKFMgV0PBcA8OvM1EsF7dlrEXoSC2ucP18eTrHgMhQU9AZ\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
597 "2DomqBZNTAQXCd9pm1kricjgYLsdN4LSPxc5yY9dduEPbgiajxZK6oOG+b0VFFZo\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
598 "h3kF+V9mEb0iRiZkvlcWUWZBUKzyscrQOBFLTLLuJTZu07ljcsSEghwrJwIDAQAB\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
599 "AoGAeRec1SGVE5Rvt5XrSK0vFofq2DlCE6hTDpszWFLTDbe4pDdRDybhfw+Nm15O\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
600 "EGgK8BrbTcEMvKdkAzv9POQeLDE8JImgesHZFxN3jnkK+b762BGRDt57DzvMJsfj\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
601 "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
602 "1SFywgs+eQPQ8g0OoTLxzqo6YhW8FtwLjoRCZx2TNQS5gYBuQrixd/yE0Spfv9aS\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
603 "UtlAaOc1AkEA6bVufggHVHcgiWqS8CHzb6g/GRxQixVshOsoVLMkCSz04zlwIfXF\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
604 "c03hh5RJVv7jmuBmhHbayujMgvinw75oawJAQb9oXUDt5Wgj1FTgeYi5YbovEoRo\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
605 "fw3ruDsHCl2UCQt0ptarCJzVixFhf/ORRi3C9RGxFfdqMrhS+qb62N4AmQJBALYU\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
606 "T1BLiwJoiWXmLTJ/EP0V9Irov2uMtm5cE6DhrJqlduksz8r1gu7RZ3tMsVLg5Iy+\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
607 "dcCQJOffNa54caQUTZ8CQQDTs/70Nr6F6ktrtmtU/S7lIitpQJCu9u/SPyBYPmFZ\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
608 "9Axy6Ee66Php+eWDNP4Ln4axrapD0732wD8DcmGDVHij\n"
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
609 "-----END RSA PRIVATE KEY-----\n";
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
610
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
611 /* Diffie-Hellman parameters, generated with GNUTLS certtool:
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
612 certtool --generate-dh-params
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
613 Generator: 06
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
614
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
615 Prime: ea:c3:75:0b:32:cf:d9:17:98:5c:da:d1
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
616 e0:1d:b9:7c:be:29:60:b0:6f:68:a9:f6
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
617 8d:75:05:59:69:04:ae:39:7c:2b:74:04
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
618 3c:e2:da:28:8a:9b:93:aa:67:05:a7:3e
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
619 06:3e:0d:31:63:88:55:ad:5a:bd:41:22
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
620 b7:58:a7:45:b3:d5:03:ad:de:3c:8d:69
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
621 42:bf:84:3d:c1:90:e7:39:6a:4b:87:01
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
622 19:e5:f3:a4:e5:8e:e2:45:d5:0c:6b:17
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
623 22:2b:2e:50:83:91:0c:5b:82:fc:72:27
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
624 49:3b:9f:29:11:53:c7:90:b8:8d:87:73
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
625 1a:7b:05:ab:cb:30:59:16:71:30:60:1b
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
626 4c:80:15:3a:a2:d3:47:b7:4a:61:de:64
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
627 7e:79:de:88:53:b7:7a:c6:a2:9a:bb:55
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
628 40:2d:7a:71:c7:41:b5:29:df:d7:5c:fb
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
629 42:e4:d8:5e:0b:99:d3:3c:93:0f:33:51
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
630 8b:f4:60:e4:c5:b5:58:21:c0:51:c4:43
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
631 25:7c:37:fe:5c:d3:62:6c:2a:af:a7:2a
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
632 82:d5:d3:e2:bb:5d:ad:84:15:f6:78:d9
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
633 d5:a8:f7:f0:48:5c:8d:e0:3d:04:ac:cf
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
634 aa:34:3f:5d:f2:0d:3d:ee:ec:b8:d8:e8
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
635 ad:dc:d3:40:59:a0:fd:45:62:47:63:c0
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
636 bd:f5:df:8b
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
637 */
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
638 static char dh_params_data[] = "-----BEGIN DH PARAMETERS-----\n"
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
639 "MIIBCAKCAQEA6sN1CzLP2ReYXNrR4B25fL4pYLBvaKn2jXUFWWkErjl8K3QEPOLa\n"
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
640 "KIqbk6pnBac+Bj4NMWOIVa1avUEit1inRbPVA63ePI1pQr+EPcGQ5zlqS4cBGeXz\n"
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
641 "pOWO4kXVDGsXIisuUIORDFuC/HInSTufKRFTx5C4jYdzGnsFq8swWRZxMGAbTIAV\n"
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
642 "OqLTR7dKYd5kfnneiFO3esaimrtVQC16ccdBtSnf11z7QuTYXguZ0zyTDzNRi/Rg\n"
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
643 "5MW1WCHAUcRDJXw3/lzTYmwqr6cqgtXT4rtdrYQV9njZ1aj38EhcjeA9BKzPqjQ/\n"
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
644 "XfINPe7suNjordzTQFmg/UViR2PAvfXfiwIBBg==\n"
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
645 "-----END DH PARAMETERS-----\n";
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
646
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
647
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
648 /* List server endpoints */
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
649 static struct fd_list eps = FD_LIST_INITIALIZER(eps);
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
650
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
651 /* Pass parameters to the connect thread */
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
652 struct connect_flags {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
653 int proto;
38
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
654 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
655 };
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
656
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
657 /* Client's side of the connection established from a separate thread */
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
658 static void * connect_thr(void * arg)
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
659 {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
660 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
661 struct cnxctx * cnx = NULL;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
662
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
663 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
664
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
665 /* Connect to the server */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
666 switch (cf->proto) {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
667 case IPPROTO_TCP:
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 struct fd_endpoint * ep = (struct fd_endpoint *)(eps.next);
246
6418a188c1b5 getnameinfo is also more sensitive on freeBSD
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 208
diff changeset
670 cnx = fd_cnx_cli_connect_tcp( &ep->sa, sSAlen(&ep->ss) );
38
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
671 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
672 }
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
673 break;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
674 #ifndef DISABLE_SCTP
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
675 case IPPROTO_SCTP:
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
676 {
1540
407e0a889c7e SCTP ConnectPeer: sctp_bindx() to local endpoints
Luke Mewburn <luke@mewburn.net>
parents: 1399
diff changeset
677 cnx = fd_cnx_cli_connect_sctp(0, TEST_PORT, &eps, NULL);
38
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
678 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
679 }
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
680 break;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
681 #endif /* DISABLE_SCTP */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
682 default:
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
683 CHECK( 0, 1 );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
684 }
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
685
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
686 /* exit */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
687 return cnx;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
688 }
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
689
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
690 /* Parameters to the handshake thread */
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
691 struct handshake_flags {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
692 struct cnxctx * cnx;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
693 gnutls_certificate_credentials_t creds;
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
694 int algo;
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
695 int ret;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
696 };
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
697
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
698 /* Handshake the client's side */
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
699 static void * handshake_thr(void * arg)
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
700 {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
701 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
702 fd_log_threadname ( "testcnx:handshake" );
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
703 hf->ret = fd_cnx_handshake(hf->cnx, GNUTLS_CLIENT, hf->algo, NULL, hf->creds);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
704 return NULL;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
705 }
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
706
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
707 /* Terminate the client's connection side */
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
708 static void * destroy_thr(void * arg)
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
709 {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
710 struct cnxctx * cnx = arg;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
711 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
712 fd_cnx_destroy(cnx);
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
713 return NULL;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
714 }
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
715
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
716 /* Main test routine */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
717 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
718 {
403
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 393
diff changeset
719 gnutls_datum_t ca = { (uint8_t *)ca_data, sizeof(ca_data) };
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 393
diff changeset
720 gnutls_datum_t server_cert = { (uint8_t *)server_cert_data, sizeof(server_cert_data) };
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 393
diff changeset
721 gnutls_datum_t server_priv = { (uint8_t *)server_priv_data, sizeof(server_priv_data) };
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 393
diff changeset
722 gnutls_datum_t client_cert = { (uint8_t *)client_cert_data, sizeof(client_cert_data) };
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 393
diff changeset
723 gnutls_datum_t client_priv = { (uint8_t *)client_priv_data, sizeof(client_priv_data) };
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 393
diff changeset
724 gnutls_datum_t expired_cert = { (uint8_t *)expired_cert_data, sizeof(expired_cert_data) };
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 393
diff changeset
725 gnutls_datum_t expired_priv = { (uint8_t *)expired_priv_data, sizeof(expired_priv_data) };
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 393
diff changeset
726 gnutls_datum_t notrust_ca = { (uint8_t *)notrust_ca_data, sizeof(notrust_ca_data) };
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 393
diff changeset
727 gnutls_datum_t notrust_cert = { (uint8_t *)notrust_cert_data, sizeof(notrust_cert_data) };
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 393
diff changeset
728 gnutls_datum_t notrust_priv = { (uint8_t *)notrust_priv_data, sizeof(notrust_priv_data) };
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
729 gnutls_datum_t dh_params = { (uint8_t *)dh_params_data, sizeof(dh_params_data) };
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
730
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
731 /* Listening socket, server side */
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
732 struct cnxctx * listener;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
733 #ifndef DISABLE_SCTP
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
734 struct cnxctx * listener_sctp;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
735 #endif /* DISABLE_SCTP */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
736
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
737 /* Server & client connected sockets */
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
738 struct cnxctx * server_side;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
739 struct cnxctx * client_side;
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
740
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
741 pthread_t thr;
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
742 int ret, i;
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
743 uint8_t * cer_buf;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
744 size_t cer_sz;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
745 uint8_t * rcv_buf;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
746 size_t rcv_sz;
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 /* 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
749 INIT_FD();
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
750
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
751 /* Restrain the # of streams */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
752 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
753
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
754 /* 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
755 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
756 &ca,
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
757 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
807
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
760 #ifdef GNUTLS_VERSION_300
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
761 {
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
762 /* We import these CA in the trust list */
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
763 gnutls_x509_crt_t * calist;
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
764 unsigned int cacount = 0;
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
765
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
766 CHECK_GNUTLS_DO( ret = gnutls_x509_crt_list_import2(&calist, &cacount, &ca, GNUTLS_X509_FMT_PEM,
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
767 GNUTLS_X509_CRT_LIST_FAIL_IF_UNSORTED), );
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
768 CHECK( 1, cacount );
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
769
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
770 CHECK_GNUTLS_DO( ret = gnutls_x509_trust_list_add_cas (fd_g_config->cnf_sec_data.trustlist, calist, cacount, 0), );
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
771 CHECK( 1, ret );
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
772 }
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
773
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
774 /* Use certificate verification during the handshake */
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
775 gnutls_certificate_set_verify_function (fd_g_config->cnf_sec_data.credentials, fd_tls_verify_credentials_2);
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
776
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
777 #endif /* GNUTLS_VERSION_300 */
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
778
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
779
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
780 /* 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
781 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
782 &server_cert,
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
783 &server_priv,
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
784 GNUTLS_X509_FMT_PEM), );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
785 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
786
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
787 /* Set the default priority */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
788 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
789 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
790
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
791 /* Set default DH params */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
792 CHECK_GNUTLS_DO( ret = gnutls_dh_params_import_pkcs3( fd_g_config->cnf_sec_data.dh_cache, &dh_params, GNUTLS_X509_FMT_PEM), );
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
793 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
794
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
795
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
796 /* Initialize the server address (this should give a safe loopback address + port, even on non-standard configs) */
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
797 {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
798 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
799 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
800 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
801 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
802 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
803 aip = ai;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
804 while (aip) {
140
34e47f4addf8 Fix broken test
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 38
diff changeset
805 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
806 aip = aip->ai_next;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
807 };
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
808 freeaddrinfo(ai);
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
809
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
810 CHECK( 0, FD_IS_LIST_EMPTY(&eps) ? 1 : 0 );
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
811 }
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
812
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
813 /* Start the server(s) */
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 /* TCP server */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
816 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
817 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
818
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
819 /* Accept incoming clients */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
820 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
821
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
822 #ifndef DISABLE_SCTP
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
823 /* SCTP server */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
824 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
825 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
826
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
827 /* Accept incoming clients */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
828 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
829 #endif /* DISABLE_SCTP */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
830
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
831 }
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 /* Initialize the CER message */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
834 {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
835 struct msg * cer;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
836 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
837 struct avp * oh;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
838 union avp_value value;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
839
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
840 /* 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
841 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
842
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
843 /* Create the instance */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
844 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
845
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
846 /* 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
847 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
848
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
849 /* Create the instance */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
850 CHECK( 0, fd_msg_avp_new ( model, 0, &oh ) );
403
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 393
diff changeset
851 value.os.data = (uint8_t *)"Client.side";
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 393
diff changeset
852 value.os.len = strlen((char *)value.os.data);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
853 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
854
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
855 /* Add the AVP */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
856 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
857
688
8c3dc8584dab Prepared capability for messages logging to separate files / folders
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 662
diff changeset
858 #if 0
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
859 /* For debug: dump the object */
974
2091bf698fb1 Remove newlines from fd_log_debug, TRACE_DEBUG, TRACE_ERROR, and TRACE_DEBUG_ERROR
Thomas Klausner <tk@giga.or.at>
parents: 859
diff changeset
860 fd_log_debug("Dumping CER");
1088
1d1a20a0779d Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents: 974
diff changeset
861 fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, cer, fd_g_config->cnf_dict, 0, 1));
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
862 #endif
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
863
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
864 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
865 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
866 }
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
867
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
868 /* 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
869 {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
870 struct connect_flags cf;
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 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
873 cf.proto = IPPROTO_TCP;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
874
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
875 /* Start the client thread */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
876 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
877
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
878 /* 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
879 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
880 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
881 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
882
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
883 /* 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
884 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
885 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
886 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
887
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
888 /* Send a message and receive it */
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
889 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz));
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
890 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
891 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
892 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
893 free(rcv_buf);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
894
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
895 /* Do it in the other direction */
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
896 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz));
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
897 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
898 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
899 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
900 free(rcv_buf);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
901
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
902 /* Now close the connections */
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
903 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
904 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
905 }
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
906
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
907 #ifndef DISABLE_SCTP
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
908 /* 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
909 {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
910 struct connect_flags cf;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
911
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
912 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
913 cf.proto = IPPROTO_SCTP;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
914
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
915 /* Start the client thread */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
916 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
917
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
918 /* 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
919 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
920 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
921
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
922 /* 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
923 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
924 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
925
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
926 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
927
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
928 /* Send a message and receive it */
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
929 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz));
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
930 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
931 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
932 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
933 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
934 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
935 free(rcv_buf);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
936
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
937 /* Do it in the other direction */
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
938 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz));
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
939 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
940 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
941 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
942 free(rcv_buf);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
943
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
944 /* Do it one more time to use another stream */
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
945 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz));
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
946 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
947 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
948 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
949 free(rcv_buf);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
950
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
951 /* Now close the connection */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
952 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
953 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
954 }
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
955 #endif /* DISABLE_SCTP */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
956
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
957 /* 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
958 {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
959 struct connect_flags cf;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
960 struct handshake_flags hf;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
961
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
962 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
963 cf.proto = IPPROTO_TCP;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
964
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
965 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
966
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
967 /* Initialize remote certificate */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
968 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
969 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
970 /* Set the CA */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
971 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
972 CHECK( 1, ret );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
973 /* Set the key */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
974 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
975 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
976
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
977 /* Start the client thread */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
978 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
979
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
980 /* 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
981 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
982 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
983
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
984 /* 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
985 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
986 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
987 hf.cnx = client_side;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
988
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
989 /* 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
990
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
991 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
992 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
993
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
994 /* Send a message and receive it */
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
995 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz));
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
996 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
997 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
998 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
999 free(rcv_buf);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1000
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1001 /* And the supposed reply */
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
1002 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz));
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1003 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
1004 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
1005 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
1006 free(rcv_buf);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1007
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1008 /* At this point in legacy Diameter we start the handshake */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1009 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1010 CHECK( 0, fd_cnx_handshake(server_side, GNUTLS_SERVER, ALGO_HANDSHAKE_DEFAULT /* No impact on TCP */, NULL, NULL) );
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1011 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
1012 CHECK( 0, hf.ret );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1013
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1014 /* 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
1015 for (i = 0; i < 2 * NB_STREAMS; i++) {
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
1016 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz));
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1017 CHECK( 0, fd_cnx_receive(client_side, NULL, &rcv_buf, &rcv_sz));
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1018 CHECK( cer_sz, rcv_sz );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1019 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
1020 free(rcv_buf);
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1021
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
1022 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz));
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1023 CHECK( 0, fd_cnx_receive(server_side, NULL, &rcv_buf, &rcv_sz));
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1024 CHECK( cer_sz, rcv_sz );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1025 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
1026 free(rcv_buf);
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1027 }
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1028
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1029
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1030 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1031 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1032 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
1033 CHECK( 0, pthread_join(thr, NULL) );
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1034
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1035 /* Free the credentials */
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1036 gnutls_certificate_free_keys(hf.creds);
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1037 gnutls_certificate_free_cas(hf.creds);
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1038 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
1039 }
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1040
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1041 #ifndef DISABLE_SCTP
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1042 /* 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
1043 {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1044 struct connect_flags cf;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1045 struct handshake_flags hf;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1046
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1047 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
1048 cf.proto = IPPROTO_SCTP;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1049
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1050 memset(&hf, 0, sizeof(hf));
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1051 hf.algo = ALGO_HANDSHAKE_3436; /* this is mandatory for old TLS mechanism */
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1052
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1053 /* Initialize remote certificate */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1054 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
1055 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
1056 /* Set the CA */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1057 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
1058 CHECK( 1, ret );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1059 /* Set the key */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1060 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
1061 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
1062
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1063 /* Start the client thread */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1064 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1065
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1066 /* 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
1067 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
1068 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
1069
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1070 /* 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
1071 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
1072 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
1073 hf.cnx = client_side;
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1074
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1075 /* 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
1076
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1077 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
1078 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
1079
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1080 /* Send a message and receive it */
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
1081 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz));
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1082 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
1083 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
1084 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
1085 free(rcv_buf);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1086
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1087 /* And the supposed reply */
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
1088 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz));
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1089 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
1090 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
1091 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1092 free(rcv_buf);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1093
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1094 /* At this point in legacy Diameter we start the handshake */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1095 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1096 CHECK( 0, fd_cnx_handshake(server_side, GNUTLS_SERVER, ALGO_HANDSHAKE_3436, NULL, NULL) );
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1097 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
1098 CHECK( 0, hf.ret );
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1099
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1100 /* 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
1101 for (i = 0; i < 2 * NB_STREAMS; i++) {
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
1102 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz));
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1103 CHECK( 0, fd_cnx_receive(client_side, NULL, &rcv_buf, &rcv_sz));
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1104 CHECK( cer_sz, rcv_sz );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1105 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
1106 free(rcv_buf);
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1107
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
1108 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz));
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1109 CHECK( 0, fd_cnx_receive(server_side, NULL, &rcv_buf, &rcv_sz));
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1110 CHECK( cer_sz, rcv_sz );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1111 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
1112 free(rcv_buf);
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1113 }
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1114
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1115
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1116 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1117 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1118 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
1119 CHECK( 0, pthread_join(thr, NULL) );
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1120
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1121 /* Free the credentials */
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1122 gnutls_certificate_free_keys(hf.creds);
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1123 gnutls_certificate_free_cas(hf.creds);
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1124 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
1125 }
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1126 #endif /* DISABLE_SCTP */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1127
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1128 /* TCP Client / server emulating new Diameter behavior (handshake at connection directly) */
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1129 {
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1130 struct connect_flags cf;
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1131 struct handshake_flags hf;
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1132
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1133 memset(&cf, 0, sizeof(cf));
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1134 cf.proto = IPPROTO_TCP;
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1135
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1136 memset(&hf, 0, sizeof(hf));
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1137
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1138 /* Initialize remote certificate */
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1139 CHECK_GNUTLS_DO( ret = gnutls_certificate_allocate_credentials (&hf.creds), );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1140 CHECK( GNUTLS_E_SUCCESS, ret );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1141 /* Set the CA */
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1142 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &ca, GNUTLS_X509_FMT_PEM), );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1143 CHECK( 1, ret );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1144 /* Set the key */
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1145 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_key_mem( hf.creds, &client_cert, &client_priv, GNUTLS_X509_FMT_PEM), );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1146 CHECK( GNUTLS_E_SUCCESS, ret );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1147
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1148 /* Start the client thread */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1149 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1150
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1151 /* Accept the connection of the client */
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1152 server_side = fd_cnx_serv_accept(listener);
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1153 CHECK( 1, server_side ? 1 : 0 );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1154
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1155 /* Retrieve the client connection object */
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1156 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1157 CHECK( 1, client_side ? 1 : 0 );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1158 hf.cnx = client_side;
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1159
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1160 /* Start the handshake directly */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1161 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1162 CHECK( 0, fd_cnx_handshake(server_side, GNUTLS_SERVER, ALGO_HANDSHAKE_DEFAULT, NULL, NULL) );
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1163 CHECK( 0, pthread_join(thr, NULL) );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1164 CHECK( 0, hf.ret );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1165
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1166 /* 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
1167 for (i = 0; i < 2 * NB_STREAMS; i++) {
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
1168 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz));
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1169 CHECK( 0, fd_cnx_receive(client_side, NULL, &rcv_buf, &rcv_sz));
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1170 CHECK( cer_sz, rcv_sz );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1171 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
1172 free(rcv_buf);
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1173
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
1174 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz));
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1175 CHECK( 0, fd_cnx_receive(server_side, NULL, &rcv_buf, &rcv_sz));
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1176 CHECK( cer_sz, rcv_sz );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1177 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
1178 free(rcv_buf);
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1179 }
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1180
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1181 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1182 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
30
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1183 fd_cnx_destroy(server_side);
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1184 CHECK( 0, pthread_join(thr, NULL) );
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1185
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1186 /* Free the credentials */
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1187 gnutls_certificate_free_keys(hf.creds);
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1188 gnutls_certificate_free_cas(hf.creds);
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1189 gnutls_certificate_free_credentials(hf.creds);
bca243c65b56 Fix some segfaults
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 29
diff changeset
1190 }
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1191
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1192 #ifndef DISABLE_SCTP
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1193
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1194
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1195 /* SCTP Client / server emulating new Diameter behavior (DTLS handshake at connection directly) */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1196 TODO("Enabled after DTLS implementation");
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1197 if (0)
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1198 {
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1199 struct connect_flags cf;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1200 struct handshake_flags hf;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1201
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1202 memset(&cf, 0, sizeof(cf));
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1203 cf.proto = IPPROTO_SCTP;
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 memset(&hf, 0, sizeof(hf));
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1206
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1207 /* Initialize remote certificate */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1208 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
1209 CHECK( GNUTLS_E_SUCCESS, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1210 /* Set the CA */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1211 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
1212 CHECK( 1, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1213 /* Set the key */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1214 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
1215 CHECK( GNUTLS_E_SUCCESS, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1216
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1217 /* Start the client thread */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1218 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1219
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1220 /* 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
1221 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
1222 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
1223
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1224 /* Retrieve the client connection object */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1225 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
1226 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
1227 hf.cnx = client_side;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1228
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1229 /* Start the handshake directly */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1230 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1231 CHECK( 0, fd_cnx_handshake(server_side, GNUTLS_SERVER, ALGO_HANDSHAKE_DEFAULT, NULL, NULL) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1232 CHECK( 0, pthread_join(thr, NULL) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1233 CHECK( 0, hf.ret );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1234
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1235 /* Send a few TLS protected messages, and replies */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1236 for (i = 0; i < 2 * NB_STREAMS; i++) {
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
1237 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz));
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1238 CHECK( 0, fd_cnx_receive(client_side, NULL, &rcv_buf, &rcv_sz));
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1239 CHECK( cer_sz, rcv_sz );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1240 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1241 free(rcv_buf);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1242
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
1243 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz));
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1244 CHECK( 0, fd_cnx_receive(server_side, NULL, &rcv_buf, &rcv_sz));
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1245 CHECK( cer_sz, rcv_sz );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1246 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1247 free(rcv_buf);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1248 }
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1249
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1250
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1251 /* Now close the connection */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1252 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1253 fd_cnx_destroy(server_side);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1254 CHECK( 0, pthread_join(thr, NULL) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1255
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1256 /* Free the credentials */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1257 gnutls_certificate_free_keys(hf.creds);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1258 gnutls_certificate_free_cas(hf.creds);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1259 gnutls_certificate_free_credentials(hf.creds);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1260 }
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1261
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1262 /* SCTP Client / server emulating old intermediary Diameter behavior (TLS handshake at connection directly) */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1263 {
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1264 struct connect_flags cf;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1265 struct handshake_flags hf;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1266
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1267 memset(&cf, 0, sizeof(cf));
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1268 cf.proto = IPPROTO_SCTP;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1269
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1270 memset(&hf, 0, sizeof(hf));
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1271 hf.algo = ALGO_HANDSHAKE_3436; /* this is mandatory for old TLS mechanism */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1272
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1273 /* Initialize remote certificate */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1274 CHECK_GNUTLS_DO( ret = gnutls_certificate_allocate_credentials (&hf.creds), );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1275 CHECK( GNUTLS_E_SUCCESS, ret );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1276 /* Set the CA */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1277 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &ca, GNUTLS_X509_FMT_PEM), );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1278 CHECK( 1, ret );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1279 /* Set the key */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1280 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_key_mem( hf.creds, &client_cert, &client_priv, GNUTLS_X509_FMT_PEM), );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1281 CHECK( GNUTLS_E_SUCCESS, ret );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1282
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1283 /* Start the client thread */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1284 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1285
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1286 /* Accept the connection of the client */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1287 server_side = fd_cnx_serv_accept(listener_sctp);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1288 CHECK( 1, server_side ? 1 : 0 );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1289
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1290 /* Retrieve the client connection object */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1291 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1292 CHECK( 1, client_side ? 1 : 0 );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1293 hf.cnx = client_side;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1294
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1295 /* Start the handshake directly */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1296 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1297 CHECK( 0, fd_cnx_handshake(server_side, GNUTLS_SERVER, ALGO_HANDSHAKE_3436, NULL, NULL) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1298 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
1299 CHECK( 0, hf.ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1300
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1301 /* Send a few TLS protected messages, and replies */
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1302 for (i = 0; i < 2 * NB_STREAMS; i++) {
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
1303 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz));
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1304 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
1305 CHECK( cer_sz, rcv_sz );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1306 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
1307 free(rcv_buf);
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1308
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
1309 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz));
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1310 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
1311 CHECK( cer_sz, rcv_sz );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1312 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
1313 free(rcv_buf);
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1314 }
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1315
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1316
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1317 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1318 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1319 fd_cnx_destroy(server_side);
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1320 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
1321
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1322 /* Free the credentials */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1323 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
1324 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
1325 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
1326 }
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1327 #endif /* DISABLE_SCTP */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1328
393
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1329 /* Test with different number of streams between server and client */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1330 #ifndef DISABLE_SCTP
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1331 /* DTLS / SCTP style */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1332 TODO("Enabled after DTLS implementation");
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1333 if (0)
393
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1334 {
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1335 struct connect_flags cf;
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1336 struct handshake_flags hf;
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1337
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1338 memset(&cf, 0, sizeof(cf));
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1339 cf.proto = IPPROTO_SCTP;
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1340
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1341 memset(&hf, 0, sizeof(hf));
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1342
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1343 /* Initialize remote certificate */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1344 CHECK_GNUTLS_DO( ret = gnutls_certificate_allocate_credentials (&hf.creds), );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1345 CHECK( GNUTLS_E_SUCCESS, ret );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1346 /* Set the CA */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1347 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &ca, GNUTLS_X509_FMT_PEM), );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1348 CHECK( 1, ret );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1349 /* Set the key */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1350 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_key_mem( hf.creds, &client_cert, &client_priv, GNUTLS_X509_FMT_PEM), );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1351 CHECK( GNUTLS_E_SUCCESS, ret );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1352
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1353 /* Start the client thread with more streams than the server */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1354 fd_g_config->cnf_sctp_str = 2 * NB_STREAMS;
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1355 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
393
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1356
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1357 /* Accept the connection of the client */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1358 server_side = fd_cnx_serv_accept(listener_sctp);
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1359 CHECK( 1, server_side ? 1 : 0 );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1360
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1361 /* Retrieve the client connection object */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1362 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1363 CHECK( 1, client_side ? 1 : 0 );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1364 hf.cnx = client_side;
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1365
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1366 /* Start the handshake directly */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1367 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1368 CHECK( 0, fd_cnx_handshake(server_side, GNUTLS_SERVER, ALGO_HANDSHAKE_DEFAULT, NULL, NULL) );
393
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1369 CHECK( 0, pthread_join(thr, NULL) );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1370 CHECK( 0, hf.ret );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1371
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1372 /* Send a few TLS protected message, and replies */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1373 for (i = 0; i < 4 * NB_STREAMS; i++) {
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
1374 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz));
393
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1375 CHECK( 0, fd_cnx_receive(client_side, NULL, &rcv_buf, &rcv_sz));
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1376 CHECK( cer_sz, rcv_sz );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1377 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1378 free(rcv_buf);
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1379
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
1380 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz));
393
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1381 CHECK( 0, fd_cnx_receive(server_side, NULL, &rcv_buf, &rcv_sz));
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1382 CHECK( cer_sz, rcv_sz );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1383 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1384 free(rcv_buf);
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1385 }
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1386
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1387 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1388 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
393
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1389 fd_cnx_destroy(server_side);
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1390 CHECK( 0, pthread_join(thr, NULL) );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1391
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1392 /* Do the same test but with more streams on the server this time */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1393 fd_g_config->cnf_sctp_str = NB_STREAMS / 2;
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1394 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
393
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1395
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1396 /* Accept the connection of the client */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1397 server_side = fd_cnx_serv_accept(listener_sctp);
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1398 CHECK( 1, server_side ? 1 : 0 );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1399
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1400 /* Retrieve the client connection object */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1401 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1402 CHECK( 1, client_side ? 1 : 0 );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1403 hf.cnx = client_side;
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1404
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1405 /* Start the handshake directly */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1406 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1407 CHECK( 0, fd_cnx_handshake(server_side, GNUTLS_SERVER, ALGO_HANDSHAKE_DEFAULT, NULL, NULL) );
393
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1408 CHECK( 0, pthread_join(thr, NULL) );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1409 CHECK( 0, hf.ret );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1410
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1411 /* Send a few TLS protected message, and replies */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1412 for (i = 0; i < 2 * NB_STREAMS; i++) {
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
1413 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz));
393
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1414 CHECK( 0, fd_cnx_receive(client_side, NULL, &rcv_buf, &rcv_sz));
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1415 CHECK( cer_sz, rcv_sz );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1416 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1417 free(rcv_buf);
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1418
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
1419 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz));
393
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1420 CHECK( 0, fd_cnx_receive(server_side, NULL, &rcv_buf, &rcv_sz));
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1421 CHECK( cer_sz, rcv_sz );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1422 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1423 free(rcv_buf);
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1424 }
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1425
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1426 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1427 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
393
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1428 fd_cnx_destroy(server_side);
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1429 CHECK( 0, pthread_join(thr, NULL) );
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1430
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1431
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1432 /* Free the credentials */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1433 gnutls_certificate_free_keys(hf.creds);
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1434 gnutls_certificate_free_cas(hf.creds);
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1435 gnutls_certificate_free_credentials(hf.creds);
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1436 }
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1437
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1438 /* TLS / SCTP style */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1439 {
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1440 struct connect_flags cf;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1441 struct handshake_flags hf;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1442
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1443 memset(&cf, 0, sizeof(cf));
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1444 cf.proto = IPPROTO_SCTP;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1445
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1446 memset(&hf, 0, sizeof(hf));
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1447 hf.algo = ALGO_HANDSHAKE_3436;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1448
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1449 /* Initialize remote certificate */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1450 CHECK_GNUTLS_DO( ret = gnutls_certificate_allocate_credentials (&hf.creds), );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1451 CHECK( GNUTLS_E_SUCCESS, ret );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1452 /* Set the CA */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1453 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &ca, GNUTLS_X509_FMT_PEM), );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1454 CHECK( 1, ret );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1455 /* Set the key */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1456 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_key_mem( hf.creds, &client_cert, &client_priv, GNUTLS_X509_FMT_PEM), );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1457 CHECK( GNUTLS_E_SUCCESS, ret );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1458
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1459 /* Start the client thread with more streams than the server */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1460 fd_g_config->cnf_sctp_str = 2 * NB_STREAMS;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1461 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1462
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1463 /* Accept the connection of the client */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1464 server_side = fd_cnx_serv_accept(listener_sctp);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1465 CHECK( 1, server_side ? 1 : 0 );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1466
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1467 /* Retrieve the client connection object */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1468 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1469 CHECK( 1, client_side ? 1 : 0 );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1470 hf.cnx = client_side;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1471
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1472 /* Start the handshake directly */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1473 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1474 CHECK( 0, fd_cnx_handshake(server_side, GNUTLS_SERVER, ALGO_HANDSHAKE_3436, NULL, NULL) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1475 CHECK( 0, pthread_join(thr, NULL) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1476 CHECK( 0, hf.ret );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1477
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1478 /* Send a few TLS protected message, and replies */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1479 for (i = 0; i < 4 * NB_STREAMS; i++) {
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
1480 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz));
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1481 CHECK( 0, fd_cnx_receive(client_side, NULL, &rcv_buf, &rcv_sz));
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1482 CHECK( cer_sz, rcv_sz );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1483 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1484 free(rcv_buf);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1485
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
1486 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz));
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1487 CHECK( 0, fd_cnx_receive(server_side, NULL, &rcv_buf, &rcv_sz));
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1488 CHECK( cer_sz, rcv_sz );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1489 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1490 free(rcv_buf);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1491 }
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1492
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1493 /* Now close the connection */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1494 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1495 fd_cnx_destroy(server_side);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1496 CHECK( 0, pthread_join(thr, NULL) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1497
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1498 /* Do the same test but with more streams on the server this time */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1499 fd_g_config->cnf_sctp_str = NB_STREAMS / 2;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1500 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1501
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1502 /* Accept the connection of the client */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1503 server_side = fd_cnx_serv_accept(listener_sctp);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1504 CHECK( 1, server_side ? 1 : 0 );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1505
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1506 /* Retrieve the client connection object */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1507 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1508 CHECK( 1, client_side ? 1 : 0 );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1509 hf.cnx = client_side;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1510
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1511 /* Start the handshake directly */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1512 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1513 CHECK( 0, fd_cnx_handshake(server_side, GNUTLS_SERVER, ALGO_HANDSHAKE_3436, NULL, NULL) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1514 CHECK( 0, pthread_join(thr, NULL) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1515 CHECK( 0, hf.ret );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1516
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1517 /* Send a few TLS protected message, and replies */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1518 for (i = 0; i < 2 * NB_STREAMS; i++) {
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
1519 CHECK( 0, fd_cnx_send(server_side, cer_buf, cer_sz));
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1520 CHECK( 0, fd_cnx_receive(client_side, NULL, &rcv_buf, &rcv_sz));
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1521 CHECK( cer_sz, rcv_sz );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1522 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1523 free(rcv_buf);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1524
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
1525 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz));
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1526 CHECK( 0, fd_cnx_receive(server_side, NULL, &rcv_buf, &rcv_sz));
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1527 CHECK( cer_sz, rcv_sz );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1528 CHECK( 0, memcmp( rcv_buf, cer_buf, cer_sz ) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1529 free(rcv_buf);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1530 }
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1531
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1532 /* Now close the connection */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1533 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1534 fd_cnx_destroy(server_side);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1535 CHECK( 0, pthread_join(thr, NULL) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1536
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1537
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1538 /* Free the credentials */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1539 gnutls_certificate_free_keys(hf.creds);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1540 gnutls_certificate_free_cas(hf.creds);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1541 gnutls_certificate_free_credentials(hf.creds);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1542 }
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1543
393
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1544 #endif /* DISABLE_SCTP */
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1545
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
1546
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1547 /* Basic operation tested successfully, now test we detect error conditions */
807
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
1548
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1549 /* Untrusted certificate, TCP */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1550 {
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1551 struct connect_flags cf;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1552 struct handshake_flags hf;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1553
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1554 memset(&cf, 0, sizeof(cf));
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1555 cf.proto = IPPROTO_TCP;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1556
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1557 memset(&hf, 0, sizeof(hf));
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1558
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1559 /* Initialize remote certificate */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1560 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
1561 CHECK( GNUTLS_E_SUCCESS, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1562 /* Set the CA */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1563 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &notrust_ca, GNUTLS_X509_FMT_PEM), );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1564 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
1565 CHECK( 1, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1566 /* Set the key */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1567 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_key_mem( hf.creds, &notrust_cert, &notrust_priv, GNUTLS_X509_FMT_PEM), );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1568 CHECK( GNUTLS_E_SUCCESS, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1569
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1570 /* Start the client thread */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1571 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1572
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1573 /* 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
1574 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
1575 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
1576
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1577 /* Retrieve the client connection object */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1578 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
1579 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
1580 hf.cnx = client_side;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1581
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1582 /* Start the handshake directly */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1583 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1584 CHECK( EINVAL, fd_cnx_handshake(server_side, GNUTLS_SERVER, ALGO_HANDSHAKE_DEFAULT, NULL, NULL) );
807
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
1585 fd_cnx_destroy(server_side);
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
1586
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1587 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
1588
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1589 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1590 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1591 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
1592
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1593 /* Free the credentials */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1594 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
1595 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
1596 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
1597 }
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1598
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1599 /* Same in SCTP */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1600 #ifndef DISABLE_SCTP
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1601 /* DTLS */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1602 TODO("Enabled after DTLS implementation");
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1603 if (0)
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1604 {
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1605 struct connect_flags cf;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1606 struct handshake_flags hf;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1607
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1608 memset(&cf, 0, sizeof(cf));
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1609 cf.proto = IPPROTO_SCTP;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1610
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1611 memset(&hf, 0, sizeof(hf));
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1612
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1613 /* Initialize remote certificate */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1614 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
1615 CHECK( GNUTLS_E_SUCCESS, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1616 /* Set the CA */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1617 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &notrust_ca, GNUTLS_X509_FMT_PEM), );
807
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
1618 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &ca, GNUTLS_X509_FMT_PEM), );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1619 CHECK( 1, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1620 /* Set the key */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1621 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_key_mem( hf.creds, &notrust_cert, &notrust_priv, GNUTLS_X509_FMT_PEM), );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1622 CHECK( GNUTLS_E_SUCCESS, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1623
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1624 /* Start the client thread */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1625 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1626
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1627 /* 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
1628 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
1629 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
1630
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1631 /* Retrieve the client connection object */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1632 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
1633 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
1634 hf.cnx = client_side;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1635
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1636 /* Start the handshake directly */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1637 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1638 CHECK( EINVAL, fd_cnx_handshake(server_side, GNUTLS_SERVER, ALGO_HANDSHAKE_DEFAULT, NULL, NULL) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1639 fd_cnx_destroy(server_side);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1640 CHECK( 0, pthread_join(thr, NULL) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1641
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1642 /* Now close the connection */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1643 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1644 CHECK( 0, pthread_join(thr, NULL) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1645
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1646 /* Free the credentials */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1647 gnutls_certificate_free_keys(hf.creds);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1648 gnutls_certificate_free_cas(hf.creds);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1649 gnutls_certificate_free_credentials(hf.creds);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1650 }
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1651
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1652 /* TLS */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1653 {
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1654 struct connect_flags cf;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1655 struct handshake_flags hf;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1656
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1657 memset(&cf, 0, sizeof(cf));
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1658 cf.proto = IPPROTO_SCTP;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1659
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1660 memset(&hf, 0, sizeof(hf));
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1661 hf.algo = ALGO_HANDSHAKE_3436;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1662
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1663 /* Initialize remote certificate */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1664 CHECK_GNUTLS_DO( ret = gnutls_certificate_allocate_credentials (&hf.creds), );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1665 CHECK( GNUTLS_E_SUCCESS, ret );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1666 /* Set the CA */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1667 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &notrust_ca, GNUTLS_X509_FMT_PEM), );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1668 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &ca, GNUTLS_X509_FMT_PEM), );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1669 CHECK( 1, ret );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1670 /* Set the key */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1671 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_key_mem( hf.creds, &notrust_cert, &notrust_priv, GNUTLS_X509_FMT_PEM), );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1672 CHECK( GNUTLS_E_SUCCESS, ret );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1673
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1674 /* Start the client thread */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1675 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1676
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1677 /* Accept the connection of the client */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1678 server_side = fd_cnx_serv_accept(listener_sctp);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1679 CHECK( 1, server_side ? 1 : 0 );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1680
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1681 /* Retrieve the client connection object */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1682 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1683 CHECK( 1, client_side ? 1 : 0 );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1684 hf.cnx = client_side;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1685
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1686 /* Start the handshake directly */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1687 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1688 CHECK( EINVAL, fd_cnx_handshake(server_side, GNUTLS_SERVER, ALGO_HANDSHAKE_3436, NULL, NULL) );
807
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
1689 fd_cnx_destroy(server_side);
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1690 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
1691
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1692 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1693 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1694 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
1695
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1696 /* Free the credentials */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1697 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
1698 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
1699 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
1700 }
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1701 #endif /* DISABLE_SCTP */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1702
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1703 /* Expired certificate */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1704 {
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1705 struct connect_flags cf;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1706 struct handshake_flags hf;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1707
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1708 memset(&cf, 0, sizeof(cf));
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1709 cf.proto = IPPROTO_TCP;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1710
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1711 memset(&hf, 0, sizeof(hf));
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1712
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1713 /* Initialize remote certificate */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1714 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
1715 CHECK( GNUTLS_E_SUCCESS, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1716 /* Set the CA */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1717 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
1718 CHECK( 1, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1719 /* Set the key */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1720 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
1721 CHECK( GNUTLS_E_SUCCESS, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1722
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1723 /* Start the client thread */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1724 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1725
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1726 /* 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
1727 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
1728 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
1729
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1730 /* Retrieve the client connection object */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1731 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
1732 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
1733 hf.cnx = client_side;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1734
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1735 /* Start the handshake directly */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1736 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1737 CHECK( EINVAL, fd_cnx_handshake(server_side, GNUTLS_SERVER, ALGO_HANDSHAKE_DEFAULT, NULL, NULL) );
807
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
1738 fd_cnx_destroy(server_side);
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1739 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
1740
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1741 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1742 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1743 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
1744
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1745 /* Free the credentials */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1746 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
1747 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
1748 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
1749 }
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1750
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1751 /* Non matching hostname */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1752
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1753 {
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1754 struct connect_flags cf;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1755 struct handshake_flags hf;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1756
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1757 memset(&cf, 0, sizeof(cf));
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1758 cf.proto = IPPROTO_TCP;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1759
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1760 memset(&hf, 0, sizeof(hf));
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1761
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1762 /* Initialize remote certificate */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1763 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
1764 CHECK( GNUTLS_E_SUCCESS, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1765 /* Set the CA */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1766 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
1767 CHECK( 1, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1768 /* Set the key */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1769 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
1770 CHECK( GNUTLS_E_SUCCESS, ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1771
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1772 /* Start the client thread */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1773 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1774
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1775 /* 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
1776 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
1777 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
1778
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1779 /* Retrieve the client connection object */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1780 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
1781 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
1782 hf.cnx = client_side;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1783
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1784 /* 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
1785 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
1786
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1787 /* Start the handshake, check it is successful */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1788 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1789 CHECK( 0, fd_cnx_handshake(server_side, GNUTLS_SERVER, ALGO_HANDSHAKE_DEFAULT, NULL, NULL) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1790 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
1791 CHECK( 0, hf.ret );
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1792
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1793 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1794 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1795 fd_cnx_destroy(server_side);
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1796 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
1797
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1798 /* Do it again with an invalid hostname */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1799 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1800
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1801 /* 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
1802 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
1803 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
1804
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1805 /* Retrieve the client connection object */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1806 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
1807 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
1808 hf.cnx = client_side;
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1809
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1810 /* 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
1811 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
1812
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1813 /* Start the handshake, check it is successful */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1814 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1815 CHECK( EINVAL, fd_cnx_handshake(server_side, GNUTLS_SERVER, ALGO_HANDSHAKE_DEFAULT, NULL, NULL) );
807
09f8f0c4f4a4 Several changes to support GnuTLS 3.x in a more efficient way
Sebastien Decugis <sdecugis@freediameter.net>
parents: 795
diff changeset
1816 fd_cnx_destroy(server_side);
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1817 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
1818
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1819 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1820 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
31
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1821 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
1822
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1823 /* Free the credentials */
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1824 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
1825 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
1826 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
1827 }
26685c67d387 Completed the test and fixed a couple issues
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 30
diff changeset
1828
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1829 /* Test the other functions of the module */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1830 {
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1831 struct connect_flags cf;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1832 struct handshake_flags hf;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1833 char * str;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1834 const gnutls_datum_t *cert_list;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1835 unsigned int cert_list_size;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1836 struct fifo * myfifo = NULL;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1837 struct timespec now;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1838 int ev_code;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1839
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1840 memset(&cf, 0, sizeof(cf));
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1841 cf.proto = IPPROTO_TCP;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1842
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1843 memset(&hf, 0, sizeof(hf));
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1844
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1845 /* Initialize remote certificate */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1846 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
1847 CHECK( GNUTLS_E_SUCCESS, ret );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1848 /* Set the CA */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1849 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
1850 CHECK( 1, ret );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1851 /* Set the key */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1852 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
1853 CHECK( GNUTLS_E_SUCCESS, ret );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1854
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1855 /* Start the client thread */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1856 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1857
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1858 /* Accept the connection of the client */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1859 server_side = fd_cnx_serv_accept(listener);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1860 CHECK( 1, server_side ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1861
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1862 /* Retrieve the client connection object */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1863 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1864 CHECK( 1, client_side ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1865 hf.cnx = client_side;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1866
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1867 /* Start the handshake */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1868 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1869 CHECK( 0, fd_cnx_handshake(server_side, GNUTLS_SERVER, ALGO_HANDSHAKE_DEFAULT, NULL, NULL) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1870 CHECK( 0, pthread_join(thr, NULL) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1871 CHECK( 0, hf.ret );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1872
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1873 /* Test some simple functions */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1874
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1875 /* fd_cnx_getid */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1876 str = fd_cnx_getid(server_side);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1877 CHECK( 1, str ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1878 CHECK( 1, (str[0] != '\0') ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1879
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1880 /* fd_cnx_getproto */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1881 i = fd_cnx_getproto(server_side);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1882 CHECK( IPPROTO_TCP, i);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1883
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1884 /* fd_cnx_getTLS */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1885 i = fd_cnx_getTLS(server_side);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1886 CHECK( 1, i ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1887
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1888 /* fd_cnx_getcred */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1889 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
1890 CHECK( 1, (cert_list_size > 0) ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1891 /* 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
1892
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1893 /* fd_cnx_getremoteid */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1894 str = fd_cnx_getremoteid(server_side);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1895 CHECK( 1, str ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1896 CHECK( 1, (str[0] != '\0') ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1897
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1898 /* fd_cnx_recv_setaltfifo */
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
1899 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz));
767
c47c16436f71 Added a limit on fifo queues to avoid memory exaustion when messages are received faster than handled
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
1900 CHECK( 0, fd_fifo_new(&myfifo, 0) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1901 CHECK( 0, fd_cnx_recv_setaltfifo(server_side, myfifo) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1902 CHECK( 0, clock_gettime(CLOCK_REALTIME, &now) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1903 do {
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1904 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
1905 free(rcv_buf);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1906 } while (ev_code != FDEVP_CNX_MSG_RECV);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1907
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1908 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1909 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1910 fd_cnx_destroy(server_side);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1911 CHECK( 0, pthread_join(thr, NULL) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1912
859
10f6ce479e1c In Debug builds, this test was failing randomly
Sebastien Decugis <sdecugis@freediameter.net>
parents: 808
diff changeset
1913 fd_event_destroy(&myfifo, free);
10f6ce479e1c In Debug builds, this test was failing randomly
Sebastien Decugis <sdecugis@freediameter.net>
parents: 808
diff changeset
1914
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1915 /* Free the credentials */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1916 gnutls_certificate_free_keys(hf.creds);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1917 gnutls_certificate_free_cas(hf.creds);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1918 gnutls_certificate_free_credentials(hf.creds);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1919 }
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1920
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1921 #ifndef DISABLE_SCTP
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1922 /* And re-test with a SCTP connection */
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1923 TODO("Enabled after DTLS implementation");
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1924 if (0)
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1925 {
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1926 struct connect_flags cf;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1927 struct handshake_flags hf;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1928 char * str;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1929 const gnutls_datum_t *cert_list;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1930 unsigned int cert_list_size;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1931 struct fifo * myfifo = NULL;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1932 struct timespec now;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1933 int ev_code;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1934
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1935 memset(&cf, 0, sizeof(cf));
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1936 cf.proto = IPPROTO_SCTP;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1937
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1938 memset(&hf, 0, sizeof(hf));
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1939
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1940 /* Initialize remote certificate */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1941 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
1942 CHECK( GNUTLS_E_SUCCESS, ret );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1943 /* Set the CA */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1944 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
1945 CHECK( 1, ret );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1946 /* Set the key */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1947 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
1948 CHECK( GNUTLS_E_SUCCESS, ret );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1949
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1950 /* Start the client thread */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1951 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1952
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1953 /* Accept the connection of the client */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1954 server_side = fd_cnx_serv_accept(listener_sctp);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1955 CHECK( 1, server_side ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1956
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1957 /* Retrieve the client connection object */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1958 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1959 CHECK( 1, client_side ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1960 hf.cnx = client_side;
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1961
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
1962 /* Start the handshake */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
1963 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1964 CHECK( 0, fd_cnx_handshake(server_side, GNUTLS_SERVER, ALGO_HANDSHAKE_DEFAULT, NULL, NULL) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1965 CHECK( 0, pthread_join(thr, NULL) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1966 CHECK( 0, hf.ret );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1967
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1968 /* Test some simple functions */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1969
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1970 /* fd_cnx_getid */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1971 str = fd_cnx_getid(server_side);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1972 CHECK( 1, str ? 1 : 0 );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1973 CHECK( 1, (str[0] != '\0') ? 1 : 0 );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1974
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1975 /* fd_cnx_getproto */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1976 i = fd_cnx_getproto(server_side);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1977 CHECK( IPPROTO_SCTP, i);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1978
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1979 /* fd_cnx_getTLS */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1980 i = fd_cnx_getTLS(server_side);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1981 CHECK( 1, i ? 1 : 0 );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1982
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1983 /* fd_cnx_getcred */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1984 CHECK( 0, fd_cnx_getcred(server_side, &cert_list, &cert_list_size) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1985 CHECK( 1, (cert_list_size > 0) ? 1 : 0 );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1986 /* We could also verify that the cert_list really contains the client_cert and ca certificates */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1987
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1988 /* fd_cnx_getremoteid */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1989 str = fd_cnx_getremoteid(server_side);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1990 CHECK( 1, str ? 1 : 0 );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1991 CHECK( 1, (str[0] != '\0') ? 1 : 0 );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1992
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1993 /* fd_cnx_recv_setaltfifo */
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
1994 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz));
1181
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1995 CHECK( 0, fd_fifo_new(&myfifo, 0) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1996 CHECK( 0, fd_cnx_recv_setaltfifo(server_side, myfifo) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1997 CHECK( 0, clock_gettime(CLOCK_REALTIME, &now) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1998 do {
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
1999 CHECK( 0, fd_event_timedget(myfifo, &now, ETIMEDOUT, &ev_code, NULL, (void *)&rcv_buf) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2000 free(rcv_buf);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2001 } while (ev_code != FDEVP_CNX_MSG_RECV);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2002
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2003 /* Now close the connection */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2004 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2005 fd_cnx_destroy(server_side);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2006 CHECK( 0, pthread_join(thr, NULL) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2007
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2008 fd_event_destroy(&myfifo, free);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2009
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2010 /* Free the credentials */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2011 gnutls_certificate_free_keys(hf.creds);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2012 gnutls_certificate_free_cas(hf.creds);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2013 gnutls_certificate_free_credentials(hf.creds);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2014 }
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2015
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2016 /* TLS */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2017 {
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2018 struct connect_flags cf;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2019 struct handshake_flags hf;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2020 char * str;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2021 const gnutls_datum_t *cert_list;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2022 unsigned int cert_list_size;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2023 struct fifo * myfifo = NULL;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2024 struct timespec now;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2025 int ev_code;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2026
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2027 memset(&cf, 0, sizeof(cf));
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2028 cf.proto = IPPROTO_SCTP;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2029
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2030 memset(&hf, 0, sizeof(hf));
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2031 hf.algo = ALGO_HANDSHAKE_3436;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2032
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2033 /* Initialize remote certificate */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2034 CHECK_GNUTLS_DO( ret = gnutls_certificate_allocate_credentials (&hf.creds), );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2035 CHECK( GNUTLS_E_SUCCESS, ret );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2036 /* Set the CA */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2037 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &ca, GNUTLS_X509_FMT_PEM), );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2038 CHECK( 1, ret );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2039 /* Set the key */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2040 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_key_mem( hf.creds, &client_cert, &client_priv, GNUTLS_X509_FMT_PEM), );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2041 CHECK( GNUTLS_E_SUCCESS, ret );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2042
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2043 /* Start the client thread */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2044 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2045
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2046 /* Accept the connection of the client */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2047 server_side = fd_cnx_serv_accept(listener_sctp);
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2048 CHECK( 1, server_side ? 1 : 0 );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2049
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2050 /* Retrieve the client connection object */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2051 CHECK( 0, pthread_join( thr, (void *)&client_side ) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2052 CHECK( 1, client_side ? 1 : 0 );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2053 hf.cnx = client_side;
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2054
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2055 /* Start the handshake */
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2056 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) );
22de21feec64 Preparing for DTLS support
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1127
diff changeset
2057 CHECK( 0, fd_cnx_handshake(server_side, GNUTLS_SERVER, ALGO_HANDSHAKE_3436, NULL, NULL) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2058 CHECK( 0, pthread_join(thr, NULL) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2059 CHECK( 0, hf.ret );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2060
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2061 /* Test some simple functions */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2062
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2063 /* fd_cnx_getid */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2064 str = fd_cnx_getid(server_side);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2065 CHECK( 1, str ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2066 CHECK( 1, (str[0] != '\0') ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2067
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2068 /* fd_cnx_getproto */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2069 i = fd_cnx_getproto(server_side);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2070 CHECK( IPPROTO_SCTP, i);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2071
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2072 /* fd_cnx_getTLS */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2073 i = fd_cnx_getTLS(server_side);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2074 CHECK( 1, i ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2075
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2076 /* fd_cnx_getcred */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2077 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
2078 CHECK( 1, (cert_list_size > 0) ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2079 /* 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
2080
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2081 /* fd_cnx_getremoteid */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2082 str = fd_cnx_getremoteid(server_side);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2083 CHECK( 1, str ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2084 CHECK( 1, (str[0] != '\0') ? 1 : 0 );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2085
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2086 /* fd_cnx_recv_setaltfifo */
1186
56c36d1007b4 Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1181
diff changeset
2087 CHECK( 0, fd_cnx_send(client_side, cer_buf, cer_sz));
767
c47c16436f71 Added a limit on fifo queues to avoid memory exaustion when messages are received faster than handled
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
2088 CHECK( 0, fd_fifo_new(&myfifo, 0) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2089 CHECK( 0, fd_cnx_recv_setaltfifo(server_side, myfifo) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2090 CHECK( 0, clock_gettime(CLOCK_REALTIME, &now) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2091 do {
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2092 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
2093 free(rcv_buf);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2094 } while (ev_code != FDEVP_CNX_MSG_RECV);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2095
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2096 /* Now close the connection */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
2097 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) );
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2098 fd_cnx_destroy(server_side);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2099 CHECK( 0, pthread_join(thr, NULL) );
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2100
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2101 fd_event_destroy(&myfifo, free);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2102
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2103 /* Free the credentials */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2104 gnutls_certificate_free_keys(hf.creds);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2105 gnutls_certificate_free_cas(hf.creds);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2106 gnutls_certificate_free_credentials(hf.creds);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2107 }
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2108 #endif /* DISABLE_SCTP */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2109
393
6d9ee5ab79e5 Added test case for ticket #6
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
2110
32
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2111 /* Destroy the servers */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2112 {
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2113 fd_cnx_destroy(listener);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2114 #ifndef DISABLE_SCTP
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2115 fd_cnx_destroy(listener_sctp);
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2116 #endif /* DISABLE_SCTP */
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2117 }
a5b507479a09 Tested remaining cnxctx functions
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
2118
38
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2119 /* Check that connection attempt fails then */
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2120 {
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2121 struct connect_flags cf;
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2122
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2123 memset(&cf, 0, sizeof(cf));
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2124 cf.proto = IPPROTO_TCP;
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2125 cf.expect_failure = 1;
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2126
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2127 /* Start the client thread, that should fail */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
2128 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
38
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2129 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
2130 CHECK( 0, client_side ? 1 : 0 );
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2131 }
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2132
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2133 #ifndef DISABLE_SCTP
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2134 {
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2135 struct connect_flags cf;
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2136
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2137 memset(&cf, 0, sizeof(cf));
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2138 cf.proto = IPPROTO_SCTP;
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2139 cf.expect_failure = 1;
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2140
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2141 /* Start the client thread, that should fail */
729
5d8ac5da7092 Fixed timeout handling + minor fixes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 688
diff changeset
2142 CHECK( 0, pthread_create(&thr, NULL, connect_thr, &cf) );
38
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2143 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
2144 CHECK( 0, client_side ? 1 : 0 );
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2145 }
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2146 #endif /* DISABLE_SCTP */
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2147
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 32
diff changeset
2148
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
2149 /* 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
2150 PASSTEST();
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
2151 }
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
2152
"Welcome to our mercurial repository"