Skip to content
22 changes: 11 additions & 11 deletions source/evp_fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
size_t *counts;
OSSL_TIME max_time;

int err = 0;
int error = 0;
int pq = 0;

static int threadcount;
Expand Down Expand Up @@ -194,7 +194,7 @@ void do_fetch(size_t num)
fetch_alg = exclusive_fetch_alg;
}

if (err == 1)
if (error == 1)
return;

switch (j) {
Expand All @@ -203,7 +203,7 @@ void do_fetch(size_t num)
fetch_entries[j].propq);
if (md == NULL) {
fprintf(stderr, "Failed to fetch %s\n", fetch_alg);
err = 1;
error = 1;
return;
}
EVP_MD_free(md);
Expand All @@ -214,7 +214,7 @@ void do_fetch(size_t num)
fetch_entries[j].propq);
if (cph == NULL) {
fprintf(stderr, "Failed to fetch %s\n", fetch_alg);
err = 1;
error = 1;
return;
}
EVP_CIPHER_free(cph);
Expand All @@ -225,7 +225,7 @@ void do_fetch(size_t num)
fetch_entries[j].propq);
if (kdf == NULL) {
fprintf(stderr, "Failed to fetch %s\n", fetch_alg);
err = 1;
error = 1;
return;
}
EVP_KDF_free(kdf);
Expand All @@ -236,7 +236,7 @@ void do_fetch(size_t num)
fetch_entries[j].propq);
if (mac == NULL) {
fprintf(stderr, "Failed to fetch %s\n", fetch_alg);
err = 1;
error = 1;
return;
}
EVP_MAC_free(mac);
Expand All @@ -247,7 +247,7 @@ void do_fetch(size_t num)
fetch_entries[j].propq);
if (rnd == NULL) {
fprintf(stderr, "Failed to fetch %s\n", fetch_alg);
err = 1;
error = 1;
return;
}
EVP_RAND_free(rnd);
Expand All @@ -258,7 +258,7 @@ void do_fetch(size_t num)
fetch_entries[j].propq);
if (kem == NULL) {
fprintf(stderr, "Failed to fetch %s\n", fetch_alg);
err = 1;
error = 1;
return;
}
EVP_KEM_free(kem);
Expand All @@ -269,14 +269,14 @@ void do_fetch(size_t num)
fetch_entries[j].propq);
if (sig == NULL) {
fprintf(stderr, "Failed to fetch %s\n", fetch_alg);
err = 1;
error = 1;
return;
}
EVP_SIGNATURE_free(sig);
break;
}
default:
err = 1;
error = 1;
return;
}
counts[num]++;
Expand Down Expand Up @@ -372,7 +372,7 @@ int main(int argc, char *argv[])
goto out;
}

if (err) {
if (error) {
printf("Error during test\n");
goto out;
}
Expand Down
12 changes: 6 additions & 6 deletions source/evp_setpeer.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#define RUN_TIME 5

int err = 0;
int error = 0;

size_t num_calls;
static int threadcount;
Expand All @@ -42,13 +42,13 @@ void do_setpeer(size_t num)

pkey_ctx = EVP_PKEY_CTX_new(pkey, NULL);
if (pkey_ctx == NULL) {
err = 1;
error = 1;
printf("Failed to create pkey_ctx\n");
return;
}

if (EVP_PKEY_derive_init(pkey_ctx) <= 0) {
err = 1;
error = 1;
printf("Failed to init pkey_ctx\n");
EVP_PKEY_CTX_free(pkey_ctx);
return;
Expand All @@ -58,7 +58,7 @@ void do_setpeer(size_t num)

do {
if (EVP_PKEY_derive_set_peer(pkey_ctx, pkey) <= 0) {
err = 1;
error = 1;
break;
}
counts[num]++;
Expand Down Expand Up @@ -97,7 +97,7 @@ static double get_avcalltime(void)

static void report_result(int key_id, int terse)
{
if (err) {
if (error) {
fprintf(stderr, "Error during test of %s\n",
sample_names[key_id]);
exit(EXIT_FAILURE);
Expand Down Expand Up @@ -228,7 +228,7 @@ int main(int argc, char *argv[])
EVP_PKEY_free(pkey);
}

if (err) {
if (error) {
printf("Error during test\n");
goto out;
}
Expand Down
18 changes: 9 additions & 9 deletions source/handshake.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#define RUN_TIME 5

int err = 0;
int error = 0;

typedef enum {
INIT_LIB_CTX,
Expand Down Expand Up @@ -102,7 +102,7 @@ static void do_handshake(size_t num)
} while (time.t < max_time.t);

if (!ret)
err = 1;
error = 1;
}

static void do_handshake_ossl_lib_ctx_per_thread(size_t num)
Expand All @@ -117,7 +117,7 @@ static void do_handshake_ossl_lib_ctx_per_thread(size_t num)
libctx = OSSL_LIB_CTX_new();
if (libctx == NULL) {
fprintf(stderr, "%s:%d: Failed to create ossl lib context\n", __FILE__, __LINE__);
err = 1;
error = 1;
return;
}

Expand All @@ -132,7 +132,7 @@ static void do_handshake_ossl_lib_ctx_per_thread(size_t num)
privkey)) {
ERR_print_errors_fp(stderr);
fprintf(stderr, "%s:%d: Failed to create SSL_CTX pair\n", __FILE__, __LINE__);
err = 1;
error = 1;
return;
}
}
Expand All @@ -157,7 +157,7 @@ static void do_handshake_ossl_lib_ctx_per_thread(size_t num)
SSL_CTX_free(lcctx);

if (!ret)
err = 1;
error = 1;

OSSL_LIB_CTX_free(libctx);
}
Expand Down Expand Up @@ -187,7 +187,7 @@ static void do_handshake_ctx_pool(size_t num)
privkey)) {
ERR_print_errors_fp(stderr);
fprintf(stderr, "%s:%d: Failed to create SSL_CTX pair\n", __FILE__, __LINE__);
err = 1;
error = 1;
return;
}
}
Expand All @@ -203,7 +203,7 @@ static void do_handshake_ctx_pool(size_t num)
privkey)) {
ERR_print_errors_fp(stderr);
fprintf(stderr, "%s:%d: Failed to create SSL_CTX pair\n", __FILE__, __LINE__);
err = 1;
error = 1;
return;
}
}
Expand All @@ -230,7 +230,7 @@ static void do_handshake_ctx_pool(size_t num)
}

if (!ret)
err = 1;
error = 1;
}

static void free_ctx_pool()
Expand Down Expand Up @@ -482,7 +482,7 @@ int main(int argc, char * const argv[])
goto err;
};

if (err) {
if (error) {
printf("Error during test\n");
goto err;
}
Expand Down
6 changes: 3 additions & 3 deletions source/newrawkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ enum {
} algorithm = ALGO_X25519;
const char *alg_name = "X25519";

int err = 0;
int error = 0;

static unsigned char key_x25519[32] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
Expand Down Expand Up @@ -377,7 +377,7 @@ void do_newrawkey(size_t num)
sizeof(key_data));
#endif
if (pkey == NULL)
err = 1;
error = 1;
else
EVP_PKEY_free(pkey);
counts[num]++;
Expand Down Expand Up @@ -451,7 +451,7 @@ int main(int argc, char *argv[])
goto out;
}

if (err) {
if (error) {
printf("Error during test\n");
goto out;
}
Expand Down
10 changes: 9 additions & 1 deletion source/perflib/err.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,21 @@
# define OSSL_PERFLIB_ERR_H
# pragma once

#include <stdarg.h>
# if !defined(_WIN32)

# include <err.h>

# else /* _WIN32 */

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use new lines around include in #if.

# include <stdarg.h>

extern const char *progname;

extern void vwarnx(const char *, va_list);
extern void errx(int, const char *, ...);
extern void warnx(const char *, ...);

# endif /* !_WIN32 */

#endif

16 changes: 8 additions & 8 deletions source/pkeyread.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ size_t num_calls;
size_t *counts;
OSSL_TIME max_time;

int err = 0;
int error = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change? Theres a good portion of this PR dedicated to renaming variables that doesn't really have anything to do with the addition of thread affinity management.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this address linker issues. there is function err() which conflicts with variables err. the changes in this PR just discovered this conflict. so the change got included here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't it be more prudent to just rename the err() function that commit 953a33f introduced then?

Though I'm surprised that a reasonable compiler can't tell the difference between a variable reference and a function call of the same name.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't it be more prudent to just rename the err() function that commit 953a33f introduced then?

Though I'm surprised that a reasonable compiler can't tell the difference between a variable reference and a function call of the same name.

the err() is a windows version of err(3) which is commonly used on *nix it would make me sad to see it go,


static int threadcount;

Expand All @@ -69,7 +69,7 @@ static void do_pemread(size_t num)

if (sample_id >= SAMPLE_ALL) {
fprintf(stderr, "%s no sample key set for test\n", __func__);
err = 1;
error = 1;
return;
}

Expand All @@ -80,7 +80,7 @@ static void do_pemread(size_t num)
if (pem == NULL) {
fprintf(stderr, "%s Cannot create mem BIO [%s PEM]\n",
__func__, sample_names[sample_id]);
err = 1;
error = 1;
return;
}

Expand All @@ -93,14 +93,14 @@ static void do_pemread(size_t num)
if (key == NULL) {
fprintf(stderr, "Failed to create key [%s PEM]\n",
sample_names[sample_id]);
err = 1;
error = 1;
goto end;
}
EVP_PKEY_free(key);
if (BIO_reset(pem) == 0) {
fprintf(stderr, "Failed to reset BIO [%s PEM]\n",
sample_names[sample_id]);
err = 1;
error = 1;
goto end;
}

Expand Down Expand Up @@ -130,7 +130,7 @@ static void do_derread(size_t num)

if (sample_id >= SAMPLE_ALL) {
fprintf(stderr, "%s no sample key set for test\n", __func__);
err = 1;
error = 1;
return;
}

Expand All @@ -144,7 +144,7 @@ static void do_derread(size_t num)
if (pkey == NULL) {
fprintf(stderr, "%s pkey is NULL [%s DER]\n",
__func__, sample_names[sample_id]);
err = 1;
error = 1;
goto error;
}
error:
Expand Down Expand Up @@ -238,7 +238,7 @@ static void report_result(int key_id, int format_id, int verbosity)
{
struct call_times times = { 0 };

if (err) {
if (error) {
fprintf(stderr, "Error during test of %s in %s format\n",
sample_names[key_id], format_names[format_id]);
exit(EXIT_FAILURE);
Expand Down
6 changes: 3 additions & 3 deletions source/randbytes.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ size_t num_calls;
size_t *counts;
OSSL_TIME max_time;

int err = 0;
int error = 0;

static int threadcount;

Expand All @@ -42,7 +42,7 @@ void do_randbytes(size_t num)

do {
if (!RAND_bytes(buf, sizeof(buf)))
err = 1;
error = 1;
counts[num]++;
time = ossl_time_now();
} while (time.t < max_time.t);
Expand Down Expand Up @@ -92,7 +92,7 @@ int main(int argc, char *argv[])
goto out;
}

if (err) {
if (error) {
printf("Error during test\n");
goto out;
}
Expand Down
Loading