nts: allow multiple server keys and certificates

Allow the ntsservercert and ntsserverkey directives to be specified
multiple times to enable the NTS-KE server to operate under multiple
names.
This commit is contained in:
Miroslav Lichvar
2021-02-11 12:26:35 +01:00
parent 80e627c86b
commit 90557cf1ba
8 changed files with 73 additions and 40 deletions

View File

@@ -163,19 +163,23 @@ void
test_unit(void)
{
NKSN_Credentials client_cred, server_cred;
const char *cert, *key;
int sock_fds[2], i;
LCL_Initialise();
TST_RegisterDummyDrivers();
cert = "nts_ke.crt";
key = "nts_ke.key";
for (i = 0; i < 50; i++) {
SCH_Initialise();
server = NKSN_CreateInstance(1, NULL, handle_request, NULL);
client = NKSN_CreateInstance(0, "test", handle_response, NULL);
server_cred = NKSN_CreateServerCertCredentials("nts_ke.crt", "nts_ke.key");
client_cred = NKSN_CreateClientCertCredentials("nts_ke.crt");
server_cred = NKSN_CreateServerCertCredentials(&cert, &key, 1);
client_cred = NKSN_CreateClientCertCredentials(cert);
TEST_CHECK(socketpair(AF_UNIX, SOCK_STREAM, 0, sock_fds) == 0);
TEST_CHECK(fcntl(sock_fds[0], F_SETFL, O_NONBLOCK) == 0);