Skip to content

Commit

Permalink
speed.c is likely broken on Windows, so add a hack
Browse files Browse the repository at this point in the history
  • Loading branch information
botovq committed Jul 13, 2024
1 parent 40d85d8 commit 2eb32c2
Showing 1 changed file with 29 additions and 12 deletions.
41 changes: 29 additions & 12 deletions patches/speed.c.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- apps/openssl/speed.c.orig Fri Jul 28 06:04:45 2023
+++ apps/openssl/speed.c Fri Jul 28 06:09:00 2023
@@ -161,7 +161,16 @@ static void
--- apps/openssl/speed.c.orig Sat Jul 13 10:21:42 2024
+++ apps/openssl/speed.c Sat Jul 13 10:27:25 2024
@@ -161,7 +161,16 @@
pkey_print_message(const char *str, const char *str2,
long num, int bits, int sec);
static void print_result(int alg, int run_no, int count, double time_used);
Expand All @@ -17,33 +17,36 @@

#define ALGOR_NUM 32
#define SIZE_NUM 5
@@ -431,7 +440,9 @@ speed_main(int argc, char **argv)
@@ -430,9 +439,11 @@
const EVP_CIPHER *evp_cipher = NULL;
const EVP_MD *evp_md = NULL;
int decrypt = 0;
+#ifndef _WIN32
int multi = 0;
- const char *errstr = NULL;
struct sigaction sa;
+#endif
const char *errstr = NULL;
+ const char *errstr = NULL;

if (pledge("stdio proc", NULL) == -1) {
@@ -506,6 +517,7 @@ speed_main(int argc, char **argv)
perror("pledge");
@@ -506,6 +517,7 @@
decrypt = 1;
j--; /* Otherwise, -decrypt gets confused with an
* algorithm. */
+#ifndef _WIN32
} else if (argc > 0 && strcmp(*argv, "-multi") == 0) {
argc--;
argv++;
@@ -520,6 +532,7 @@ speed_main(int argc, char **argv)
@@ -520,6 +532,7 @@
}
j--; /* Otherwise, -multi gets confused with an
* algorithm. */
+#endif
} else if (argc > 0 && strcmp(*argv, "-unaligned") == 0) {
argc--;
argv++;
@@ -855,7 +868,9 @@ speed_main(int argc, char **argv)
@@ -851,7 +864,9 @@
BIO_printf(bio_err, "-evp e use EVP e.\n");
BIO_printf(bio_err, "-decrypt time decryption instead of encryption (only EVP).\n");
BIO_printf(bio_err, "-mr produce machine readable output.\n");
Expand All @@ -53,7 +56,7 @@
BIO_printf(bio_err, "-unaligned n use buffers with offset n from proper alignment.\n");
goto end;
}
@@ -864,8 +879,10 @@ speed_main(int argc, char **argv)
@@ -860,8 +875,10 @@
j++;
}

Expand All @@ -64,7 +67,21 @@

if (j == 0) {
for (i = 0; i < ALGOR_NUM; i++) {
@@ -1742,7 +1759,9 @@ speed_main(int argc, char **argv)
@@ -933,11 +950,13 @@
#define COND(c) (run && count<0x7fffffff)
#define COUNT(d) (count)

+#ifndef _WIN32
memset(&sa, 0, sizeof(sa));
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_RESTART;
sa.sa_handler = sig_done;
sigaction(SIGALRM, &sa, NULL);
+#endif

#ifndef OPENSSL_NO_MD4
if (doit[D_MD4]) {
@@ -1743,7 +1762,9 @@
ecdh_doit[j] = 0;
}
}
Expand All @@ -74,7 +91,7 @@
if (!mr) {
fprintf(stdout, "%s\n", SSLeay_version(SSLEAY_VERSION));
fprintf(stdout, "%s\n", SSLeay_version(SSLEAY_BUILT_ON));
@@ -1898,11 +1917,15 @@ pkey_print_message(const char *str, const char *str2,
@@ -1899,11 +1920,15 @@
static void
print_result(int alg, int run_no, int count, double time_used)
{
Expand All @@ -90,7 +107,7 @@
static char *
sstrsep(char **string, const char *delim)
{
@@ -2109,4 +2132,5 @@ do_multi(int multi)
@@ -2104,4 +2129,5 @@
free(fds);
return 1;
}
Expand Down

0 comments on commit 2eb32c2

Please sign in to comment.