Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmundell committed Mar 4, 2025
1 parent 7a9907c commit 10b0147
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions util/serverutils_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Ensure (serverutils, server_new_gnutls_set)
gnutls_x509_privkey_t privkey;
gnutls_x509_crt_t cert, *certs;
gnutls_datum_t privkey_data, cert_data;
unsigned char serial[] = { 0x99, 0x99, 0x99, 0x99 };
unsigned char serial[] = {0x99, 0x99, 0x99, 0x99};

// Setup credential.

Expand All @@ -51,18 +51,20 @@ Ensure (serverutils, server_new_gnutls_set)

chk (gnutls_x509_crt_set_version (cert, 3));
chk (gnutls_x509_crt_set_serial (cert, serial, sizeof (serial)));
chk (gnutls_x509_crt_set_dn_by_oid(cert, GNUTLS_OID_X520_COMMON_NAME,
0, "Eg", strlen ("Eg")));
chk (gnutls_x509_crt_set_dn_by_oid(cert, GNUTLS_OID_X520_COMMON_NAME, 0,
"Eg", strlen ("Eg")));
chk (gnutls_x509_crt_set_issuer_dn (cert, "CN=Self-Signed Certificate", 0));

chk (gnutls_x509_crt_set_activation_time (cert, time (NULL)));
chk (gnutls_x509_crt_set_expiration_time (cert, time (NULL) + 365 * 24 * 60 * 60));
chk (gnutls_x509_crt_set_expiration_time (cert,
time (NULL) + 365 * 24 * 60 * 60));

chk (gnutls_x509_crt_sign2 (cert, cert, privkey, GNUTLS_DIG_SHA256, 0));

chk (gnutls_init (&session, GNUTLS_CLIENT));

chk (gnutls_x509_privkey_export2 (privkey, GNUTLS_X509_FMT_PEM, &privkey_data));
chk (gnutls_x509_privkey_export2 (privkey,
GNUTLS_X509_FMT_PEM, &privkey_data));
chk (gnutls_x509_crt_export2 (cert, GNUTLS_X509_FMT_PEM, &cert_data));

chk (gnutls_certificate_set_x509_key_mem (cred, &cert_data, &privkey_data,
Expand Down

0 comments on commit 10b0147

Please sign in to comment.