/* Socket operations
*/
listen_sd = socket(AF_INET, SOCK_STREAM, 0);
+ CHECK(listen_sd);
memset(&sa_serv, '\0', sizeof(sa_serv));
sa_serv.sin_family = AF_INET;
setsockopt(listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *)&optval,
sizeof(int));
- bind(listen_sd, (struct sockaddr *)&sa_serv, sizeof(sa_serv));
+ ret = bind(listen_sd, (struct sockaddr *)&sa_serv, sizeof(sa_serv));
+ CHECK(ret);
- listen(listen_sd, 1024);
+ ret = listen(listen_sd, 1024);
+ CHECK(ret);
printf("Server ready. Listening to port '%d'.\n\n", PORT);
close(fd);
}
}
+ if (listenfd >= 0) {
+ close(listenfd);
+ }
+
return 0;
}
{
while (1) {
static const struct option longopts[] = {
- { "connect", required_argument, 0, 'c' },
- { "listen", required_argument, 0, 'l' },
- { "key", required_argument, 0, 'K' },
- { "cert", required_argument, 0, 'C' },
- { "cacert", required_argument, 0, 'A' },
- { "hostname", required_argument, 0, 'H' },
- { "server", no_argument, 0, 's' },
- { "insecure", no_argument, 0, 'i' },
- { "nofork", no_argument, 0, 'n' },
- { "debug", no_argument, 0, 'd' },
- { "help", no_argument, 0, 'h' },
- { 0, 0, 0, 0 }
+ { "connect", required_argument, NULL, 'c' },
+ { "listen", required_argument, NULL, 'l' },
+ { "key", required_argument, NULL, 'K' },
+ { "cert", required_argument, NULL, 'C' },
+ { "cacert", required_argument, NULL, 'A' },
+ { "hostname", required_argument, NULL, 'H' },
+ { "server", no_argument, NULL, 's' },
+ { "insecure", no_argument, NULL, 'i' },
+ { "nofork", no_argument, NULL, 'n' },
+ { "debug", no_argument, NULL, 'd' },
+ { "help", no_argument, NULL, 'h' },
+ { NULL, 0, NULL, 0 }
};
int optidx = 0;
unsigned int *ecx, unsigned int *edx)
{
/* we avoid using __get_cpuid_count, because it is not available with gcc 4.8 */
- if (__get_cpuid_max(7, 0) < 7)
+ if (__get_cpuid_max(7, NULL) < 7)
return;
__cpuid_count(7, 0, *eax, *ebx, *ecx, *edx);
.blocksize = 1,
.keysize = 0,
.type = CIPHER_STREAM },
- { 0, 0, 0, 0, 0, 0, 0 }
+ { NULL, 0, 0, 0, 0, 0, 0 }
};
#define GNUTLS_CIPHER_LOOP(b) \
GNUTLS_VERSION_UNKNOWN, GNUTLS_MAC_STREEBOG_256),
#endif
- { 0, { 0, 0 }, 0, 0, 0, 0, 0, 0 }
+ { NULL, { 0, 0 }, NULL, 0, 0, 0, 0, 0 }
};
#define CIPHER_SUITE_LOOP(b) \
.supported = 1,
},
#endif
- { 0, 0, 0 }
+ { NULL, NULL, 0 }
};
#define GNUTLS_ECC_CURVE_LOOP(b) \
GNUTLS_GROUP_INVALID },
.tls_id = 0x11EC },
#endif
- { 0, 0, 0 }
+ { NULL, 0, NULL }
};
#define GNUTLS_GROUP_LOOP(b) \
* as priority strings, but they will be a no-op.
*/
{ "RSA-EXPORT", GNUTLS_KX_INVALID, NULL, 0, 0 },
- { 0, 0, 0, 0, 0 }
+ { NULL, 0, NULL, 0, 0 }
};
#define GNUTLS_KX_LOOP(b) \
.block_size = 16 },
{ .name = "PBMAC1", .id = GNUTLS_MAC_PBMAC1, .placeholder = 1 },
{ .name = "MAC-NULL", .id = GNUTLS_MAC_NULL },
- { 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+ { NULL, NULL, NULL, 0, 0, 0, 0, 0, 0 }
};
#define GNUTLS_HASH_LOOP(b) \
.only_extension = 0,
.tls_sig_sem = SIG_SEM_PRE_TLS12,
.false_start = 1 },
- { 0, 0, 0, 0, 0 }
+ { NULL, 0, 0, 0, 0 }
};
const version_entry_st *version_to_entry(gnutls_protocol_t version)
.oid = NULL,
.id = GNUTLS_PK_UNKNOWN,
.curve = GNUTLS_ECC_CURVE_INVALID },
- { 0, 0, 0, 0 }
+ { NULL, NULL, 0, 0 }
};
#define GNUTLS_PK_LOOP(b) \
.hash_output_size = 256,
.aid = { { 9, 6 }, SIG_SEM_TLS13 },
.flags = GNUTLS_SIGN_FLAG_TLS13_OK },
- { .name = 0,
- .oid = 0,
+ { .name = NULL,
+ .oid = NULL,
.id = 0,
.pk = 0,
.hash = 0,
time_t rtime, vtime, ntime, now;
int check_failed = 0;
- now = gnutls_time(0);
+ now = gnutls_time(NULL);
ret = gnutls_ocsp_resp_init(&resp);
if (ret < 0)
int _gnutls_check_resumed_params(gnutls_session_t session)
{
- time_t timestamp = gnutls_time(0);
+ time_t timestamp = gnutls_time(NULL);
const version_entry_st *vers;
/* check whether the session is expired */
"DTLS[%p]: Initializing timer for handshake state.\n",
session);
session->internals.dtls.async_term =
- gnutls_time(0) + MAX_DTLS_TIMEOUT / 1000;
+ gnutls_time(NULL) + MAX_DTLS_TIMEOUT / 1000;
} else {
_dtls_reset_hsk_state(session);
_gnutls_handshake_io_buffer_clear(session);
return;
if (session->internals.dtls.async_term != 0) {
- time_t _now = time(0);
+ time_t _now = time(NULL);
/* check if we need to expire the queued handshake data */
if (_now > session->internals.dtls.async_term) {
if (session->internals.selected_ocsp_length > 0) {
if (session->internals.selected_ocsp[0].response.data) {
if (session->internals.selected_ocsp[0].exptime != 0 &&
- (gnutls_time(0) >=
+ (gnutls_time(NULL) >=
session->internals.selected_ocsp[0].exptime)) {
gnutls_assert();
return 0;
int ret;
ssize_t r_size;
- resp->data = 0;
+ resp->data = NULL;
resp->size = 0;
/* minimum message is type (1) + response (3) + data */
goto fail;
}
}
- } while (next != 0);
+ } while (next != NULL);
va_end(args);
*/
memset(data, 0, datasize);
- now = gnutls_time(0);
+ now = gnutls_time(NULL);
/* We re-seed based on time in addition to output data. That is,
* to prevent a temporal state compromise to become permanent for low
_gnutls_debug_log("p11: Initializing module: %s\n", module_name);
- if (params && (p = strstr(params, "p11-kit:")) != 0) {
+ if (params && (p = strstr(params, "p11-kit:")) != NULL) {
reserved = (char *)(p + sizeof("p11-kit:") - 1);
}
provider->module_name = gnutls_strdup(module_name);
provider->init_args = args;
if (p11_kit_module_get_flags(module) & P11_KIT_MODULE_TRUSTED ||
- (params != NULL && strstr(params, "trusted") != 0))
+ (params != NULL && strstr(params, "trusted") != NULL))
provider->trusted = 1;
return 0;
else
tries = 1;
- now = gnutls_time(0);
+ now = gnutls_time(NULL);
for (i = 0; i < tries; i++) {
a_vals = 0;
class = CKO_CERTIFICATE;
{ CKA_DECRYPT, &tval, sizeof(tval) },
};
unsigned long attrs_len = sizeof(attrs) / sizeof(attrs[0]);
- gnutls_datum_t ec_point = { 0 };
+ gnutls_datum_t ec_point = { NULL, 0 };
struct ck_ecdh1_derive_params param = { 0 };
struct ck_mechanism mech = { CKM_ECDH1_DERIVE, ¶m, sizeof(param) };
* a token. */
inline static bool is_pkcs11_url_object(const char *url)
{
- if (strstr(url, "id=") != 0 || strstr(url, "object=") != 0)
+ if (strstr(url, "id=") != NULL || strstr(url, "object=") != NULL)
return 1;
return 0;
}
goto cleanup;
}
- obj->pk_algorithm = gnutls_pkcs11_privkey_get_pk_algorithm(pkey, 0);
+ obj->pk_algorithm = gnutls_pkcs11_privkey_get_pk_algorithm(pkey, NULL);
obj->type = GNUTLS_PKCS11_OBJ_PUBKEY;
pk_to_genmech(obj->pk_algorithm, &key_type);
/* receive headers */
ret = recv_headers(
session, record_params, type, htype, &record,
- (!(session->internals.flags & GNUTLS_NONBLOCK)) ? &ms : 0);
+ (!(session->internals.flags & GNUTLS_NONBLOCK)) ? &ms : NULL);
if (ret < 0) {
ret = gnutls_assert_val_fatal(ret);
goto recv_error;
*/
ret = _gnutls_io_read_buffered(
session, record.packet_size, record.type,
- (!(session->internals.flags & GNUTLS_NONBLOCK)) ? &ms : 0);
+ (!(session->internals.flags & GNUTLS_NONBLOCK)) ? &ms : NULL);
if (ret != record.packet_size) {
gnutls_assert();
goto recv_error;
.max_record_recv_size = DEFAULT_MAX_RECORD_SIZE;
session->internals.resumed_security_parameters.timestamp =
- gnutls_time(0);
+ gnutls_time(NULL);
- session->internals.resumed_security_parameters.grp = 0;
+ session->internals.resumed_security_parameters.grp = NULL;
session->internals.resumed_security_parameters.post_handshake_auth = 0;
**/
gnutls_kx_algorithm_t gnutls_kx_get(gnutls_session_t session)
{
- if (session->security_parameters.cs == 0)
+ if (session->security_parameters.cs == NULL)
return 0;
if (session->security_parameters.cs->kx_algorithm == 0) { /* TLS 1.3 */
session->internals.dtls.hsk_read_seq = 0;
session->internals.dtls.hsk_write_seq = 0;
- session->internals.cand_ec_group = 0;
- session->internals.cand_dh_group = 0;
+ session->internals.cand_ec_group = NULL;
+ session->internals.cand_dh_group = NULL;
session->internals.hrr_cs[0] = CS_INVALID_MAJOR;
session->internals.hrr_cs[1] = CS_INVALID_MINOR;
if (ctx->cert_index < session->internals.selected_ocsp_length) {
if ((session->internals.selected_ocsp[ctx->cert_index]
.exptime != 0 &&
- gnutls_time(0) >=
+ gnutls_time(NULL) >=
session->internals
.selected_ocsp[ctx->cert_index]
.exptime) ||
} else
return 0;
- if (ret == GNUTLS_E_NO_CERTIFICATE_STATUS || resp.data == 0) {
+ if (ret == GNUTLS_E_NO_CERTIFICATE_STATUS || resp.data == NULL) {
return 0;
} else if (ret < 0) {
return gnutls_assert_val(ret);
#include "gnutls/gnutls.h"
#include "ecdh_callbacks.h"
#include "datum.h"
-#include "mem.h"
#include <string.h>
#include <tss2/tss2_esys.h>
tpm_key->publicArea.unique.ecc.x.size };
gnutls_datum_t y = { tpm_key->publicArea.unique.ecc.y.buffer,
tpm_key->publicArea.unique.ecc.y.size };
- gnutls_datum_t shared = { 0 };
+ gnutls_datum_t shared = { NULL, 0 };
gnutls_ecc_curve_t curve = _gnutls_convert_tpm2_ecc_curve(
tpm_key->publicArea.parameters.eccDetail.curveID);
if (ret < 0)
goto fail;
- ret = gnutls_privkey_derive_secret(privkey, peerkey, 0, &shared, 0);
+ ret = gnutls_privkey_derive_secret(privkey, peerkey, NULL, &shared, 0);
if (ret < 0)
goto fail;
{
TSS2_RC rc;
- struct ESYS_CRYPTO_CALLBACKS callbacks = { 0 };
+ struct ESYS_CRYPTO_CALLBACKS callbacks = { NULL };
_gnutls_set_tss2_rsa_callbacks(&callbacks);
_gnutls_set_tss2_hash_callbacks(&callbacks);
}
gnutls_datum_t input = { .data = in_buffer, .size = in_size };
- gnutls_datum_t output = { 0 };
+ gnutls_datum_t output = { NULL, 0 };
ret = gnutls_pubkey_encrypt_data(pubkey, 0, &input, &output);
gnutls_pubkey_deinit(pubkey);
size_t line_size = 0;
int ret, l2, mismatch = 0;
size_t host_len = 0, service_len = 0;
- time_t now = gnutls_time(0);
+ time_t now = gnutls_time(NULL);
gnutls_datum_t b64key = { NULL, 0 };
ret = raw_pubkey_to_base64(pubkey, &b64key);
asn1_node dn = NULL;
gnutls_datum_t td;
- if (buf_size == 0) {
+ if (buf_size == NULL) {
return GNUTLS_E_INVALID_REQUEST;
}
int result;
asn1_node dn = NULL;
- if (buf_size == 0) {
+ if (buf_size == NULL) {
return GNUTLS_E_INVALID_REQUEST;
}
return GNUTLS_E_MALFORMED_CIDR;
}
- if (strchr(cidr, ':') != 0) { /* IPv6 */
+ if (strchr(cidr, ':') != NULL) { /* IPv6 */
iplength = 16;
} else { /* IPv4 */
iplength = 4;
return gnutls_assert_val(-1);
}
- now = gnutls_time(0);
+ now = gnutls_time(NULL);
if (ntime == -1) {
/* This is a problematic case, and there is no consensus on how
.desc = NULL,
.iv_name = NULL,
.decrypt_only = 0 },
- { 0, 0, 0, 0, 0 }
+ { 0, NULL, 0, 0, 0 }
};
#define PBES2_SCHEMA_LOOP(b) \
}
snprintf(name, sizeof(name), "%s.?LAST.values.?1", root);
- ret = _gnutls_x509_set_raw_time(c2, name, gnutls_time(0));
+ ret = _gnutls_x509_set_raw_time(c2, name, gnutls_time(NULL));
if (ret < 0) {
gnutls_assert();
return ret;
return (time_t)-1;
}
- if (strchr(ttime, 'Z') == 0) {
+ if (strchr(ttime, 'Z') == NULL) {
gnutls_assert();
/* required to be in GMT */
return (time_t)-1;
}
- if (strchr(ttime, '.') != 0) {
+ if (strchr(ttime, '.') != NULL) {
gnutls_assert();
/* no fractional seconds allowed */
return (time_t)-1;
#include "tls-sig.h"
#include "str.h"
#include "datum.h"
-#include <hash-pjw-bare.h>
#include "x509_int.h"
#include "common.h"
#include <gnutls/x509-ext.h>
#include "intprops.h"
#include "gl_linkedhash_list.h"
#include "gl_list.h"
+#include <hashcode-mem.h>
struct named_cert_st {
gnutls_x509_crt_t cert;
if (issuer == NULL) {
issuer = trusted_cas[i];
} else {
- time_t now = gnutls_time(0);
+ time_t now = gnutls_time(NULL);
if (now < gnutls_x509_crt_get_expiration_time(
trusted_cas[i]) &&
{
int i = 0, ret;
unsigned int status = 0, output;
- time_t now = gnutls_time(0);
+ time_t now = gnutls_time(NULL);
verify_state_st vparams;
if (clist_size > 1) {
unsigned int status = 0, i;
gnutls_x509_crt_t issuer = NULL;
gnutls_datum_t raw_issuer = { NULL, 0 };
- time_t now = gnutls_time(0);
+ time_t now = gnutls_time(NULL);
time_t distrust_after;
if (clist_size > 1) {
gnutls_datum_t crl_signature = { NULL, 0 };
gnutls_x509_crt_t issuer = NULL;
int result, sigalg;
- time_t now = gnutls_time(0);
+ time_t now = gnutls_time(NULL);
time_t nextu;
unsigned int usage;
#include "system-keys.h"
#include "gl_linkedhash_list.h"
#include "gl_list.h"
-#include "hash-pjw-bare.h"
+#include <hashcode-mem.h>
static int crt_reinit(gnutls_x509_crt_t crt)
{
int result;
gnutls_datum_t tmp;
- if (buf_size == 0 || cert == NULL) {
+ if (buf_size == NULL || cert == NULL) {
return GNUTLS_E_INVALID_REQUEST;
}
gnutls_pubkey_deinit(pubkey);
if (ret >= 0) {
- time_t now = gnutls_time(0);
+ time_t now = gnutls_time(NULL);
int res;
unsigned usage, i;
int ret, res;
p = strchr(str, '(');
- if (p != 0) {
+ if (p != NULL) {
if (strncmp(str, "octet_string", 12) == 0) {
action = ENCODE_OCTET_STRING;
} else {
}
for (i = 0; cfg.tls_features[i]; ++i) {
- feature = strtoul(cfg.tls_features[i], 0, 10);
+ feature = strtoul(cfg.tls_features[i], NULL, 10);
ret = gnutls_x509_tlsfeatures_add(features, feature);
if (ret < 0) {
fprintf(stderr,
}
bits = info_bits;
} else {
- if (info_sec_param == 0) {
+ if (info_sec_param == NULL) {
/* For ECDSA keys use 256 bits or better, as they are widely supported */
info_sec_param = "HIGH";
}
cinfo->password = "";
}
- if (gnutls_x509_privkey_get_seed(key, NULL, NULL, 0) !=
+ if (gnutls_x509_privkey_get_seed(key, NULL, NULL, NULL) !=
GNUTLS_E_INVALID_REQUEST) {
if (cinfo->verbose)
fprintf(stderr,
ret = gnutls_x509_crt_get_dn3(cert, &name, 0);
if (ret < 0) {
if (ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) {
- name.data = 0;
+ name.data = NULL;
name.size = 0;
} else {
fprintf(stderr, "gnutls_x509_crt_get_dn: %s\n",
}
if (memmem(pem.data, pem.size,
- "BEGIN CERTIFICATE", 16) != 0 ||
+ "BEGIN CERTIFICATE", 16) != NULL ||
memmem(pem.data, pem.size, "BEGIN X509",
- 10) != 0) {
+ 10) != NULL) {
ret = gnutls_x509_crt_init(&crt);
if (ret < 0) {
fprintf(stderr,
gnutls_pubkey_t pubkey;
pubkey = find_pubkey(crt, cinfo);
- if (pubkey == 0) {
+ if (pubkey == NULL) {
fprintf(stderr, "find public key error\n");
app_exit(1);
}
unsigned flags;
pubkey = find_pubkey(NULL, cinfo);
- if (pubkey == 0) {
+ if (pubkey == NULL) {
fprintf(stderr, "find public key error\n");
app_exit(1);
}
}
if ((flags & P_WAIT_FOR_CERT) &&
- gnutls_certificate_get_ours(session) == 0)
+ gnutls_certificate_get_ours(session) == NULL)
log_msg(stdout, "- No certificate was sent to peer\n");
if (flags & P_PRINT_CERT)
{
int len = strlen(hostname);
- if (strchr(hostname, ':') != 0)
+ if (strchr(hostname, ':') != NULL)
return 1;
else if (len > 2 && c_isdigit(hostname[0]) &&
c_isdigit(hostname[len - 1]))
gl_list_t accepted_list = gl_list_create_empty(
GL_LINKED_LIST, NULL, NULL, NULL, true);
fd_set rd, wr;
- time_t now = time(0);
+ time_t now = time(NULL);
#ifndef _WIN32
int val;
#endif
perror("accept()");
} else {
char timebuf[SIMPLE_CTIME_BUF_SIZE];
- time_t tt = time(0);
+ time_t tt = time(NULL);
char *ctt;
listener_item *jj;
static int wrap_db_store(void *dbf, gnutls_datum_t key, gnutls_datum_t data)
{
int i;
- time_t now = time(0);
+ time_t now = time(NULL);
void *ptr = NULL;
if (key.size > SESSION_ID_SIZE)
static gnutls_datum_t wrap_db_fetch(void *dbf, gnutls_datum_t key)
{
gnutls_datum_t res = { NULL, 0 };
- time_t now = time(0);
+ time_t now = time(NULL);
int i;
for (i = 0; i < cache_db_ptr; i++) {
static int anti_replay_db_add(void *dbf, time_t exp, const gnutls_datum_t *key,
const gnutls_datum_t *data)
{
- time_t now = time(0);
+ time_t now = time(NULL);
int i;
for (i = 0; i < cache_db_ptr; i++) {
if (cert_list_size == 1)
return TEST_SUCCEED;
- p = 0;
+ p = NULL;
p_size = 0;
pos = NULL;
for (i = 0; i < cert_list_size; i++) {
ret = gnutls_x509_crt_get_dn3(cert, &name, 0);
if (ret < 0) {
if (ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) {
- name.data = 0;
+ name.data = NULL;
name.size = 0;
} else {
fprintf(stderr, "gnutls_x509_crt_get_dn: %s\n",
&& d->d_type == DT_REG
#endif
) {
- if (strstr(d->d_name, ".der") == 0)
+ if (strstr(d->d_name, ".der") == NULL)
continue;
- if (strstr(d->d_name, ".err") != 0)
+ if (strstr(d->d_name, ".err") != NULL)
continue;
snprintf(path, sizeof(path), "%s/%s", cert_dir,
d->d_name);
gnutls_transport_set_push_function(server, server_push);
gnutls_transport_set_pull_function(server, server_pull);
gnutls_transport_set_ptr(server, server);
- assert(gnutls_priority_set_direct(server, test->server_prio, 0) >= 0);
+ assert(gnutls_priority_set_direct(server, test->server_prio, NULL) >=
+ 0);
gnutls_transport_set_push_function(client, client_push);
gnutls_transport_set_pull_function(client, client_pull);
gnutls_transport_set_ptr(client, client);
- assert(gnutls_priority_set_direct(client, test->client_prio, 0) >= 0);
+ assert(gnutls_priority_set_direct(client, test->client_prio, NULL) >=
+ 0);
HANDSHAKE(client, server);
.crt_revoke_time = 1274996231,
.crt_serial = "\x0b\x98\x94\xf9\x7c\x6a",
.crt_serial_size = 6 },
- { NULL, NULL, 0, 0 } };
+ { NULL, NULL, 0, NULL } };
static void tls_log_func(int level, const char *str)
{
assert(gnutls_x509_crt_init(&crt) >= 0);
assert(gnutls_x509_crt_import(crt, pem, GNUTLS_X509_FMT_PEM) >= 0);
- ret = gnutls_x509_crl_set_crt(crl, crt, mytime(0));
+ ret = gnutls_x509_crl_set_crt(crl, crt, mytime(NULL));
if (ret != 0)
fail("gnutls_x509_crl_set_crt: %s\n", gnutls_strerror(ret));
if (ret != 0)
fail("gnutls_x509_crl_set_version\n");
- ret = gnutls_x509_crl_set_this_update(crl, mytime(0));
+ ret = gnutls_x509_crl_set_this_update(crl, mytime(NULL));
if (ret != 0)
fail("gnutls_x509_crl_set_this_update\n");
if (!skip_optional) {
- ret = gnutls_x509_crl_set_next_update(crl, mytime(0) + 120);
+ ret = gnutls_x509_crl_set_next_update(crl, mytime(NULL) + 120);
if (ret != 0)
fail("gnutls_x509_crl_set_next_update\n");
}
- ret = gnutls_x509_crl_set_crt_serial(crl, "\x01\x02\x03", 3, mytime(0));
+ ret = gnutls_x509_crl_set_crt_serial(crl, "\x01\x02\x03", 3,
+ mytime(NULL));
if (ret != 0)
fail("gnutls_x509_crl_set_serial %d\n", ret);
(int)crq_key_id_len, (int)pkey_key_id_len);
}
- if (pkey_key_id) {
- free(pkey_key_id);
- pkey_key_id = NULL;
- }
+ free(pkey_key_id);
+ pkey_key_id = NULL;
- if (crq_key_id) {
- free(crq_key_id);
- crq_key_id = NULL;
- }
+ free(crq_key_id);
+ crq_key_id = NULL;
gnutls_x509_crq_deinit(crq);
gnutls_x509_privkey_deinit(pkey);
if (ret != 0)
fail("error\n");
- ret = gnutls_x509_crt_set_activation_time(crt, mytime(0));
+ ret = gnutls_x509_crt_set_activation_time(crt, mytime(NULL));
if (ret != 0)
fail("error\n");
if (ret != 0)
fail("error\n");
- ret = gnutls_x509_crt_set_activation_time(crt, mytime(0));
+ ret = gnutls_x509_crt_set_activation_time(crt, mytime(NULL));
if (ret != 0)
fail("error\n");
if (ret != 0)
fail("error\n");
- ret = gnutls_x509_crt_set_activation_time(crt, mytime(0));
+ ret = gnutls_x509_crt_set_activation_time(crt, mytime(NULL));
if (ret != 0)
fail("error\n");
gnutls_transport_set_push_function(server, server_push);
gnutls_transport_set_pull_function(server, server_pull);
gnutls_transport_set_ptr(server, server);
- assert(gnutls_priority_set_direct(server, test->server_prio, 0) >= 0);
+ assert(gnutls_priority_set_direct(server, test->server_prio, NULL) >=
+ 0);
if (test->request_cli_crt)
gnutls_certificate_server_set_request(server,
gnutls_transport_set_push_function(client, client_push);
gnutls_transport_set_pull_function(client, client_pull);
gnutls_transport_set_ptr(client, client);
- assert(gnutls_priority_set_direct(client, test->client_prio, 0) >= 0);
+ assert(gnutls_priority_set_direct(client, test->client_prio, NULL) >=
+ 0);
// Try handshake
if (test->client_err && test->server_err) {
#include <gnutls/abstract.h>
#include <stdbool.h>
#include <string.h>
-#include <stdlib.h>
#include "utils.h"
#include "dh-compute.h"
int expect_error_on_import, int expect_error_on_derive,
const gnutls_datum_t *result)
{
- gnutls_datum_t Z = { 0 };
+ gnutls_datum_t Z = { NULL, 0 };
bool ok;
int ret;
gnutls_privkey_t privkey = NULL;
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
-#include <errno.h>
#include <gnutls/gnutls.h>
#include <gnutls/dtls.h>
#include <signal.h>
success("closing recv thread\n");
}
- pthread_exit(0);
+ pthread_exit(NULL);
}
static void do_thread_stuff(gnutls_session_t session)
if (debug)
success("closing sending thread\n");
assert(pthread_join(id, &rval) == 0);
- assert(rval == 0);
+ assert(rval == NULL);
do {
ret = gnutls_bye(session, GNUTLS_SHUT_RDWR);
static int permutations2[2][2] = { { 0, 1 }, { 1, 0 } };
-static const char *permutation_names2[] = { "01", "10", 0 };
+static const char *permutation_names2[] = { "01", "10", NULL };
static int permutations3[6][3] = { { 0, 1, 2 }, { 0, 2, 1 }, { 1, 0, 2 },
{ 1, 2, 0 }, { 2, 0, 1 }, { 2, 1, 0 } };
static const char *permutation_names3[] = { "012", "021", "102", "120",
- "201", "210", 0 };
+ "201", "210", NULL };
static int permutations5[120][5] = {
{ 0, 1, 2, 3, 4 }, { 0, 2, 1, 3, 4 }, { 1, 0, 2, 3, 4 },
"40123", "40213", "41023", "41203", "42013", "42103", "40132", "40231",
"41032", "41230", "42031", "42130", "40312", "40321", "41302", "41320",
"42301", "42310", "43012", "43021", "43102", "43120", "43201", "43210",
- 0
+ NULL
};
static const char *filter_names[8] = { "SHello",
filter_packet_state_t state_packet_ServerFinishedResume = { 0 };
static filter_permute_state_t state_permute_ServerHello = {
- 0,
- { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } },
- 0,
+ NULL,
+ { { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 } },
+ NULL,
0
};
static filter_permute_state_t state_permute_ServerHelloFull = {
- 0,
- { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } },
- 0,
+ NULL,
+ { { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 } },
+ NULL,
0
};
static filter_permute_state_t state_permute_ServerFinished = {
- 0,
- { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } },
- 0,
+ NULL,
+ { { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 } },
+ NULL,
0
};
static filter_permute_state_t state_permute_ServerFinishedResume = {
- 0,
- { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } },
- 0,
+ NULL,
+ { { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 } },
+ NULL,
0
};
static filter_permute_state_t state_permute_ClientFinished = {
- 0,
- { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } },
- 0,
+ NULL,
+ { { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 } },
+ NULL,
0
};
static filter_permute_state_t state_permute_ClientFinishedResume = {
- 0,
- { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } },
- 0,
+ NULL,
+ { { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 } },
+ NULL,
0
};
static filter_permute_state_t state_permute_ClientFinishedFull = {
- 0,
- { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } },
- 0,
+ NULL,
+ { { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 } },
+ NULL,
0
};
DECLARE_PERMUTE(ClientFinishedFull)
// }}}
// {{{ emergency deadlock resolution time bomb
-timer_t killtimer_tid = 0;
+timer_t killtimer_tid = NULL;
static void killtimer_set(void)
{
struct sigevent sig;
struct itimerspec tout = { { 0, 0 }, { 2 * timeout_seconds, 0 } };
- if (killtimer_tid != 0) {
+ if (killtimer_tid != NULL) {
timer_delete(killtimer_tid);
}
exit(3);
}
- timer_settime(killtimer_tid, 0, &tout, 0);
+ timer_settime(killtimer_tid, 0, &tout, NULL);
}
// }}}
gnutls_init(&session, GNUTLS_DATAGRAM |
(server ? GNUTLS_SERVER : GNUTLS_CLIENT) |
GNUTLS_NONBLOCK * nonblock);
- gnutls_priority_set_direct(session, "NORMAL:+ECDHE-RSA:+ANON-ECDH", 0);
+ gnutls_priority_set_direct(session, "NORMAL:+ECDHE-RSA:+ANON-ECDH",
+ NULL);
gnutls_transport_set_int(session, sock);
if (full) {
static void client(int sock)
{
int err = 0;
- time_t started = time(0);
+ time_t started = time(NULL);
const char *line = "foobar!";
char buffer[8192];
int len, ret;
await(sock, t ? t : 100);
}
} while (err != 0);
- process_error_or_timeout(err, time(0) - started);
+ process_error_or_timeout(err, time(NULL) - started);
ret = gnutls_session_get_data2(session, &data);
if (ret < 0) {
await(sock, t ? t : 100);
}
} while (err != 0);
- process_error_or_timeout(err, time(0) - started);
+ process_error_or_timeout(err, time(NULL) - started);
if (debug) {
fprintf(stdout, "%i %s| handshake complete\n", run_id,
{
int err;
const char *line = "server foobar!";
- time_t started = time(0);
+ time_t started = time(NULL);
char buffer[8192];
int len;
await(sock, t ? t : 100);
}
} while (err != 0);
- process_error_or_timeout(err, time(0) - started);
+ process_error_or_timeout(err, time(NULL) - started);
gnutls_deinit(session);
await(sock, t ? t : 100);
}
} while (err != 0);
- process_error_or_timeout(err, time(0) - started);
+ process_error_or_timeout(err, time(NULL) - started);
log("handshake complete\n");
while (waitpid(pid2, &status2, 0) < 0 && errno == EINTR)
;
kill(pid1, 15);
- while (waitpid(pid1, 0, 0) < 0 && errno == EINTR)
+ while (waitpid(pid1, NULL, 0) < 0 && errno == EINTR)
;
close(fds[0]);
#ifdef RANDOMIZE
#define RETURN_RND_EAGAIN(session) \
- unsigned int rnd = time(0); \
+ unsigned int rnd = time(NULL); \
if (rnd++ % 3 == 0) { \
gnutls_transport_set_errno(session, EAGAIN); \
return -1; \
size_t retry_sizeofdata;
if (use_null_on_retry) {
- retry_data = 0;
+ retry_data = NULL;
retry_sizeofdata = 0;
} else {
retry_data = data;
#include <gnutls/abstract.h>
#include <stdbool.h>
#include <string.h>
-#include <stdlib.h>
#include "utils.h"
static void genkey(gnutls_ecc_curve_t curve, gnutls_datum_t *x,
int expect_error_on_import, int expect_error_on_derive,
const gnutls_datum_t *result)
{
- gnutls_datum_t Z = { 0 };
+ gnutls_datum_t Z = { NULL, 0 };
bool ok;
int ret;
gnutls_privkey_t privkey = NULL;
{
"[x == 0, y == 0]",
GNUTLS_ECC_CURVE_SECP256R1,
- { 0 },
- { 0 },
- { 0 },
+ { NULL, 0 },
+ { NULL, 0 },
+ { NULL, 0 },
{ (void *)"\x00", 1 },
{ (void *)"\x00", 1 },
{ NULL, 0 },
{
"[x > p - 1]",
GNUTLS_ECC_CURVE_SECP256R1,
- { 0 },
- { 0 },
- { 0 },
+ { NULL, 0 },
+ { NULL, 0 },
+ { NULL, 0 },
{ (void *)"\xff\xff\xff\xff\x00\x00\x00\x01"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\xff\xff\xff\xff"
{
"[y > p - 1]",
GNUTLS_ECC_CURVE_SECP256R1,
- { 0 },
- { 0 },
- { 0 },
+ { NULL, 0 },
+ { NULL, 0 },
+ { NULL, 0 },
{ (void *)"\x02", 1 },
{ (void *)"\xff\xff\xff\xff\x00\x00\x00\x01"
"\x00\x00\x00\x00\x00\x00\x00\x00"
0,
0,
},
- { 0 }
+ { NULL, 0 }
};
global_init();
#include "config.h"
#endif
-#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
-#include <string.h>
-#include <errno.h>
#include <gnutls/gnutls.h>
#include <gnutls/crypto.h>
#include <signal.h>
/* put to a random state */
gnutls_fips140_set_mode(data->set_mode, GNUTLS_FIPS140_SET_MODE_THREAD);
- pthread_exit(0);
+ pthread_exit(NULL);
}
#define MAX_THREADS 48
if (ret != 0)
fail("error\n");
- ret = gnutls_x509_crt_set_activation_time(crt, mytime(0));
+ ret = gnutls_x509_crt_set_activation_time(crt, mytime(NULL));
if (ret != 0)
fail("error\n");
fail("error\n");
ret = gnutls_privkey_import_x509_raw(key, &dsa_key, GNUTLS_X509_FMT_PEM,
- 0, 0);
+ NULL, 0);
if (ret < 0)
fail("error\n");
fail("error\n");
ret = gnutls_privkey_import_x509_raw(key, &rsa_key, GNUTLS_X509_FMT_PEM,
- 0, 0);
+ NULL, 0);
if (ret < 0)
fail("error\n");
fail("error\n");
ret = gnutls_privkey_import_x509_raw(key, &server_ecc_key,
- GNUTLS_X509_FMT_PEM, 0, 0);
+ GNUTLS_X509_FMT_PEM, NULL, 0);
if (ret < 0)
fail("error\n");
fail("error\n");
ret = gnutls_privkey_import_x509_raw(key, &server_ca3_eddsa_key,
- GNUTLS_X509_FMT_PEM, 0, 0);
+ GNUTLS_X509_FMT_PEM, NULL, 0);
if (ret < 0)
fail("error\n");
fail("error\n");
ret = gnutls_privkey_import_x509_raw(key, &server_ca3_gost01_key,
- GNUTLS_X509_FMT_PEM, 0, 0);
+ GNUTLS_X509_FMT_PEM, NULL, 0);
if (ret < 0)
fail("error\n");
FILE *fp = fopen(filename, "r");
char *p;
+ if (fp == NULL) {
+ fail("Failed to open file");
+ }
+
while ((p = fgets(line, sizeof(line), fp)) != NULL) {
success("%s", line);
if (strncmp(line, label, strlen(label)) == 0 &&
signal(SIGPIPE, SIG_IGN);
for (; tries >= 0; tries--) {
- tstart = time(0);
+ tstart = time(NULL);
start(2, 0);
- tstop = time(0);
+ tstop = time(NULL);
tstop = tstop - tstart;
}
for (; tries >= 0; tries--) {
- tstart = time(0);
+ tstart = time(NULL);
start(2, 1);
- tstop = time(0);
+ tstop = time(NULL);
tstop = tstop - tstart;
int ret;
gnutls_pubkey_t pubkey;
gnutls_pk_algorithm_t pk_alg;
- gnutls_datum_t exported = { 0 };
+ gnutls_datum_t exported = { NULL, 0 };
success("Testing: EdDSA %s encoding\n", name);
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
-#include <errno.h>
#include <gnutls/gnutls.h>
#include <gnutls/abstract.h>
#include <gnutls/crypto.h>
gnutls_free(sig.data);
- pthread_exit(0);
+ pthread_exit(NULL);
}
#define MAX_THREADS 48
tests[i].needs_decryption);
if (privkey == NULL && tests[i].exp_key_err < 0)
continue;
- assert(privkey != 0);
+ assert(privkey != NULL);
try_with_key(tests[i].name, tests[i].prio, tests[i].exp_kx, 0,
0, tests[i].cert, privkey, tests[i].exp_serv_err);
exit(1);
}
- ret = gnutls_privkey_import_x509_raw(pkey, &key, GNUTLS_X509_FMT_PEM, 0,
- 0);
+ ret = gnutls_privkey_import_x509_raw(pkey, &key, GNUTLS_X509_FMT_PEM,
+ NULL, 0);
if (ret < 0) {
fail("error in %d: %s\n", __LINE__, gnutls_strerror(ret));
exit(1);
&& d->d_type == DT_REG
#endif
) {
- if (strstr(d->d_name, ".der") == 0)
+ if (strstr(d->d_name, ".der") == NULL)
continue;
- if (strstr(d->d_name, ".err") != 0)
+ if (strstr(d->d_name, ".err") != NULL)
continue;
snprintf(path, sizeof(path), "%s/%s", cert_dir,
d->d_name);
if (ret < 0) {
if (test->exp_err == ret) {
if (strchr(_gnutls_default_priority_string,
- '@') != 0) {
+ '@') != NULL) {
if (ep != test->add_prio) {
fail("error expected error on start of string[%d]: %s\n",
test->err_pos,
#include "config.h"
#endif
-#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
-#include <errno.h>
#include <gnutls/gnutls.h>
#include <gnutls/crypto.h>
#include <signal.h>
if (debug)
hexprint(data->buf, sizeof(data->buf));
- pthread_exit(0);
+ pthread_exit(NULL);
}
#define MAX_THREADS 48
gnutls_transport_set_push_function(server, server_push);
gnutls_transport_set_pull_function(server, server_pull);
gnutls_transport_set_ptr(server, server);
- assert(gnutls_priority_set_direct(server, test->server_prio, 0) >= 0);
+ assert(gnutls_priority_set_direct(server, test->server_prio, NULL) >=
+ 0);
gnutls_transport_set_push_function(client, client_push);
gnutls_transport_set_pull_function(client, client_pull);
gnutls_transport_set_ptr(client, client);
- assert(gnutls_priority_set_direct(client, test->client_prio, 0) >= 0);
+ assert(gnutls_priority_set_direct(client, test->client_prio, NULL) >=
+ 0);
HANDSHAKE_EXPECT(client, server, test->client_ret, test->server_ret);
/* the &ep value is only accurate when the default priorities are not overridden;
* otherwise it should be a pointer to the start of the string */
if (strchr(_gnutls_default_priority_string,
- '@') != 0) {
+ '@') != NULL) {
if (ep != test->add_prio) {
fail("error expected error on start of string[%d]: %s\n",
test->err_pos,
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
if (gcipher == GNUTLS_CIPHER_AES_128_CCM ||
gcipher == GNUTLS_CIPHER_AES_256_CCM) {
- assert(EVP_CipherInit_ex(ctx, evp_cipher, 0, 0, 0, 0) >
- 0);
+ assert(EVP_CipherInit_ex(ctx, evp_cipher, NULL, NULL,
+ NULL, 0) > 0);
assert(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_SET_IVLEN,
- dnonce.size, 0) == 1);
+ dnonce.size, NULL) == 1);
assert(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_SET_TAG,
tag_size,
enc_data + enc_data_size -
tag_size) == 1);
- assert(EVP_CipherInit_ex(ctx, 0, 0, key, nonce, 0) > 0);
+ assert(EVP_CipherInit_ex(ctx, NULL, NULL, key, nonce,
+ 0) > 0);
dec_data_size2 = sizeof(dec_data);
/* Add plain size */
GNUTLS_PROFILE_TO_VFLAGS(GNUTLS_PROFILE_SUITEB192),
GNUTLS_CERT_INSECURE_ALGORITHM | GNUTLS_CERT_INVALID, NULL },
{ "name constraints: empty CN, empty SAN, permitted dns range",
- nc_good0, &nc_good0[2], 0, 0, 0, 1427270515 },
+ nc_good0, &nc_good0[2], 0, 0, NULL, 1427270515 },
{ "name constraints: dns in permitted range", nc_good1, &nc_good1[4], 0,
0, NULL, 1412850586 },
{ "name constraints: ipv6 in permitted range", nc_good2, &nc_good2[4],
{ "kp-ok", kp_ok, &kp_ok[3], 0, 0, GNUTLS_KP_OCSP_SIGNING, 1412850586 },
{ "tls features - intermediate no ext", tls_feat_inter_no_ext,
&tls_feat_inter_no_ext[3], 0,
- GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | GNUTLS_CERT_INVALID, 0,
+ GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | GNUTLS_CERT_INVALID, NULL,
1466612070 },
{ "tls features - end no ext", tls_feat_no_ext, &tls_feat_no_ext[3], 0,
- GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | GNUTLS_CERT_INVALID, 0,
+ GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | GNUTLS_CERT_INVALID, NULL,
1466612070 },
{ "tls features - intermediate is subset", tls_feat_inter_subset_fail,
&tls_feat_inter_subset_fail[3], 0,
- GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | GNUTLS_CERT_INVALID, 0,
+ GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | GNUTLS_CERT_INVALID, NULL,
1466612070 },
{ "tls features - intermediate has unrelated vals",
tls_feat_inter_unrelated_fail, &tls_feat_inter_unrelated_fail[3], 0,
- GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | GNUTLS_CERT_INVALID, 0,
+ GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | GNUTLS_CERT_INVALID, NULL,
1466612070 },
{ "tls features - end is superset", tls_feat_superset,
- &tls_feat_superset[3], 0, 0, 0, 1466612070 },
- { "tls features - ok", tls_feat_ok, &tls_feat_ok[3], 0, 0, 0,
+ &tls_feat_superset[3], 0, 0, NULL, 1466612070 },
+ { "tls features - ok", tls_feat_ok, &tls_feat_ok[3], 0, 0, NULL,
1466612070 },
{ "unknown crit extension on root - fail",
unknown_critical_extension_on_root,
GNUTLS_KP_TLS_WWW_SERVER, 1488365541 },
{ "rsa pss: invalid self sig - fail", rsa_pss_invalid_self_sig,
&rsa_pss_invalid_self_sig[0], GNUTLS_VERIFY_DO_NOT_ALLOW_SAME,
- GNUTLS_CERT_INVALID | GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE, 0,
+ GNUTLS_CERT_INVALID | GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE, NULL,
1501138253 },
{ "rsa pss: invalid chain with pkcs#1 1.5 sig - fail",
rsa_pss_invalid_chain_with_pkcs1_sig,
&rsa_pss_invalid_chain_with_pkcs1_sig[2], 0,
- GNUTLS_CERT_INVALID | GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE, 0,
+ GNUTLS_CERT_INVALID | GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE, NULL,
1501138253 },
{ "rsa pss: invalid chain with wrong hash (sha384-sha256) - fail",
rsa_pss_invalid_chain_with_wrong_hash,
&rsa_pss_invalid_chain_with_wrong_hash[3], 0,
- GNUTLS_CERT_INVALID | GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE, 0,
+ GNUTLS_CERT_INVALID | GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE, NULL,
1501138253 },
{ "rsa pss: smaller salt in sig than spki - fail",
rsa_pss_chain_smaller_salt_in_sig_fail,
&rsa_pss_chain_smaller_salt_in_sig_fail[3], 0,
- GNUTLS_CERT_INVALID | GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE, 0,
+ GNUTLS_CERT_INVALID | GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE, NULL,
1550005473 },
{ "rsa pss: chain with sha1 hash - fail", rsa_pss_chain_with_sha1_fail,
- &rsa_pss_chain_with_sha1_fail[3], 0, GNUTLS_CERT_INVALID, 0,
+ &rsa_pss_chain_with_sha1_fail[3], 0, GNUTLS_CERT_INVALID, NULL,
1501159136 },
{ "rsa pss: chain with different mgf hash - fail",
rsa_pss_chain_with_diff_mgf_oid_fail,
- &rsa_pss_chain_with_diff_mgf_oid_fail[3], 0, GNUTLS_CERT_INVALID, 0,
- 1501159136 },
+ &rsa_pss_chain_with_diff_mgf_oid_fail[3], 0, GNUTLS_CERT_INVALID,
+ NULL, 1501159136 },
{ "rsa pss: chain with sha256 - ok", rsa_pss_chain_sha256_ok,
- &rsa_pss_chain_sha256_ok[3], 0, 0, 0, 1501138253 },
+ &rsa_pss_chain_sha256_ok[3], 0, 0, NULL, 1501138253 },
{ "rsa pss: chain with sha384 - ok", rsa_pss_chain_sha384_ok,
- &rsa_pss_chain_sha384_ok[3], 0, 0, 0, 1501138253 },
+ &rsa_pss_chain_sha384_ok[3], 0, 0, NULL, 1501138253 },
{ "rsa pss: chain with sha512 - ok", rsa_pss_chain_sha512_ok,
- &rsa_pss_chain_sha512_ok[3], 0, 0, 0, 1501138253 },
+ &rsa_pss_chain_sha512_ok[3], 0, 0, NULL, 1501138253 },
{ "rsa pss: chain with increasing salt size - ok",
rsa_pss_chain_increasing_salt_size_ok,
- &rsa_pss_chain_increasing_salt_size_ok[3], 0, 0, 0, 1501159136 },
+ &rsa_pss_chain_increasing_salt_size_ok[3], 0, 0, NULL, 1501159136 },
{ "rsa pss: chain with alternating signatures - ok",
rsa_pss_chain_pkcs11_pss_pkcs1_ok,
- &rsa_pss_chain_pkcs11_pss_pkcs1_ok[3], 0, 0, 0, 1501159136 },
+ &rsa_pss_chain_pkcs11_pss_pkcs1_ok[3], 0, 0, NULL, 1501159136 },
{ "rsa pss: chain with changing hashes - ok",
rsa_pss_chain_sha512_sha384_sha256_ok,
- &rsa_pss_chain_sha512_sha384_sha256_ok[3], 0, 0, 0, 1501159136 },
+ &rsa_pss_chain_sha512_sha384_sha256_ok[3], 0, 0, NULL, 1501159136 },
{ "no subject id: chain with missing subject id, but valid auth id - ok",
chain_with_no_subject_id_in_ca_ok,
- &chain_with_no_subject_id_in_ca_ok[4], 0, 0, 0, 1537518468 },
+ &chain_with_no_subject_id_in_ca_ok[4], 0, 0, NULL, 1537518468 },
#ifdef ENABLE_GOST
{ "gost 34.10-01 - ok", gost01, &gost01[2], GNUTLS_VERIFY_ALLOW_BROKEN,
- 0, 0, 1466612070, 1 },
+ 0, NULL, 1466612070, 1 },
{ "gost 34.10-01 - not ok (due to gostr94)", gost01, &gost01[2], 0,
GNUTLS_CERT_INSECURE_ALGORITHM | GNUTLS_CERT_INVALID, NULL,
1466612070, 1 },
GNUTLS_PROFILE_TO_VFLAGS(GNUTLS_PROFILE_ULTRA),
GNUTLS_CERT_INSECURE_ALGORITHM | GNUTLS_CERT_INVALID, NULL,
1466612070, 1 },
- { "gost 34.10-12-256 - ok", gost12_256, &gost12_256[0], 0, 0, 0,
+ { "gost 34.10-12-256 - ok", gost12_256, &gost12_256[0], 0, 0, NULL,
1466612070, 1 },
- { "gost 34.10-12-512 - ok", gost12_512, &gost12_512[0], 0, 0, 0,
+ { "gost 34.10-12-512 - ok", gost12_512, &gost12_512[0], 0, 0, NULL,
1466612070, 1 },
#endif
{ "rsa-512 - not ok (due to profile)", rsa_512, &rsa_512[0],
{ "ed448 - ok", ed448, &ed448[0],
GNUTLS_PROFILE_TO_VFLAGS(GNUTLS_PROFILE_ULTRA), 0, NULL, 1584352960,
1 },
- { "superseding - ok", superseding, superseding_ca, 0, 0, 0,
+ { "superseding - ok", superseding, superseding_ca, 0, 0, NULL,
1590928011 },
{ "rsa-sha1 in trusted - ok", rsa_sha1_in_trusted,
rsa_sha1_in_trusted_ca,
GNUTLS_PROFILE_TO_VFLAGS(GNUTLS_PROFILE_MEDIUM),
GNUTLS_CERT_INSECURE_ALGORITHM | GNUTLS_CERT_INVALID, NULL,
1620118136, 1 },
- { "cross signed - ok", cross_signed, cross_signed_ca, 0, 0, 0,
+ { "cross signed - ok", cross_signed, cross_signed_ca, 0, 0, NULL,
1704955300 },
- { "many intermediates - ok", many_icas, many_icas_ca, 0, 0, 0,
+ { "many intermediates - ok", many_icas, many_icas_ca, 0, 0, NULL,
1710284400 },
{ NULL, NULL, NULL, 0, 0 }
};
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <errno.h>
#include <gnutls/gnutls.h>
#include "utils.h"
#include "eagain-common.h"
static int check_binding_data(gnutls_session_t client, gnutls_session_t server,
int cbtype, const char *cbname, int negative)
{
- gnutls_datum_t client_cb = { 0 };
- gnutls_datum_t server_cb = { 0 };
+ gnutls_datum_t client_cb = { NULL, 0 };
+ gnutls_datum_t server_cb = { NULL, 0 };
if (gnutls_session_channel_binding(client, cbtype, &client_cb) !=
GNUTLS_E_SUCCESS) {
gnutls_transport_set_push_function(server, server_push);
gnutls_transport_set_pull_function(server, server_pull);
gnutls_transport_set_ptr(server, server);
- assert(gnutls_priority_set_direct(server, sprio, 0) >= 0);
+ assert(gnutls_priority_set_direct(server, sprio, NULL) >= 0);
gnutls_transport_set_push_function(client, client_push);
gnutls_transport_set_pull_function(client, client_pull);
gnutls_transport_set_ptr(client, client);
- assert(gnutls_priority_set_direct(client, cprio, 0) >= 0);
+ assert(gnutls_priority_set_direct(client, cprio, NULL) >= 0);
HANDSHAKE_EXPECT(client, server, cerr, serr);
tests[i].pk, tests[i].exp_key_err);
if (privkey == NULL && tests[i].exp_key_err < 0)
continue;
- assert(privkey != 0);
+ assert(privkey != NULL);
try_with_key(tests[i].name, tests[i].prio, tests[i].exp_kx, 0,
0, tests[i].cert, privkey, tests[i].exp_serv_err);
tests[i].exp_key_err);
if (privkey == NULL && tests[i].exp_key_err < 0)
continue;
- assert(privkey != 0);
+ assert(privkey != NULL);
try_with_key(tests[i].name, tests[i].prio, tests[i].exp_kx, 0,
0, tests[i].cert, privkey, tests[i].exp_serv_err);
success("closing recv thread\n");
}
- pthread_exit(0);
+ pthread_exit(NULL);
}
static void do_thread_stuff(gnutls_session_t session)
/* the receiving thread will receive the EOF and close */
assert(pthread_join(id, &rval) == 0);
- assert(rval == 0);
+ assert(rval == NULL);
}
static void do_reflect_stuff(gnutls_session_t session)
gnutls_transport_set_push_function(server, server_push);
gnutls_transport_set_pull_function(server, server_pull);
gnutls_transport_set_ptr(server, server);
- assert(gnutls_priority_set_direct(server, test->server_prio, 0) >= 0);
+ assert(gnutls_priority_set_direct(server, test->server_prio, NULL) >=
+ 0);
gnutls_transport_set_push_function(client, client_push);
gnutls_transport_set_pull_function(client, client_pull);
gnutls_transport_set_ptr(client, client);
- assert(gnutls_priority_set_direct(client, test->client_prio, 0) >= 0);
+ assert(gnutls_priority_set_direct(client, test->client_prio, NULL) >=
+ 0);
HANDSHAKE_EXPECT(client, server, test->client_ret, test->server_ret);
gnutls_global_set_time_function(mytime); \
}
-#define virt_time_init() virt_time_init_at(time(0))
+#define virt_time_init() virt_time_init_at(time(NULL))
static time_t mytime(time_t *t)
{