aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Buehler <tb@openbsd.org>2026-05-05 06:18:42 +0200
committerTheo Buehler <tb@openbsd.org>2026-05-05 06:18:42 +0200
commite1f7784531fe8f09cfbd42651a222a73653b3c2f (patch)
tree1dbfcc5f9310c18aeb71eaa6756ea8a282a86618
parentce37a10469bddb943d0a29975e38475db6ddfe19 (diff)
parenta24d0f296057a861cafdd16167e1447a86f3eeaf (diff)
downloadportable-e1f7784531fe8f09cfbd42651a222a73653b3c2f.tar.gz
portable-e1f7784531fe8f09cfbd42651a222a73653b3c2f.tar.bz2
portable-e1f7784531fe8f09cfbd42651a222a73653b3c2f.zip
Land #1271 - fix speed alarm on windows
-rw-r--r--patches/speed.c.patch52
1 files changed, 30 insertions, 22 deletions
diff --git a/patches/speed.c.patch b/patches/speed.c.patch
index 8e79f5c..4efc65c 100644
--- a/patches/speed.c.patch
+++ b/patches/speed.c.patch
@@ -1,9 +1,9 @@
1--- apps/openssl/speed.c.orig 2026-04-12 11:09:28 1--- apps/openssl/speed.c.orig 2026-05-05 10:50:46
2+++ apps/openssl/speed.c 2026-04-12 11:11:18 2+++ apps/openssl/speed.c 2026-05-05 10:51:24
3@@ -156,7 +156,16 @@ static void print_result(int alg, int run_no, int coun 3@@ -158,7 +158,16 @@ static double speed_timer_stop(int s);
4 pkey_print_message(const char *str, const char *str2,
5 int bits, int sec);
6 static void print_result(int alg, int run_no, int count, double time_used); 4 static void print_result(int alg, int run_no, int count, double time_used);
5 static void speed_timer_start(int s);
6 static double speed_timer_stop(int s);
7+#ifndef _WIN32 7+#ifndef _WIN32
8 static int do_multi(int multi); 8 static int do_multi(int multi);
9+#else 9+#else
@@ -17,7 +17,23 @@
17 17
18 #define SIZE_NUM 5 18 #define SIZE_NUM 5
19 #define MAX_ECDH_SIZE 256 19 #define MAX_ECDH_SIZE 256
20@@ -1110,8 +1119,10 @@ speed_main(int argc, char **argv) 20@@ -1005,7 +1014,15 @@ speed_timer_stop(int s)
21 static double
22 speed_timer_stop(int s)
23 {
24+#ifndef _WIN32
25 return time_f(s);
26+#else
27+ double elapsed;
28+
29+ elapsed = time_f(s);
30+ speed_alarm_free(run);
31+ return elapsed;
32+#endif
33 }
34
35 static const int KDF1_SHA1_len = 20;
36@@ -1123,8 +1140,10 @@ speed_main(int argc, char **argv)
21 const EVP_CIPHER *evp_cipher = NULL; 37 const EVP_CIPHER *evp_cipher = NULL;
22 const EVP_MD *evp_md = NULL; 38 const EVP_MD *evp_md = NULL;
23 int decrypt = 0; 39 int decrypt = 0;
@@ -28,7 +44,7 @@
28 const char *errstr = NULL; 44 const char *errstr = NULL;
29 45
30 if (pledge("stdio proc", NULL) == -1) { 46 if (pledge("stdio proc", NULL) == -1) {
31@@ -1187,6 +1198,7 @@ speed_main(int argc, char **argv) 47@@ -1200,6 +1219,7 @@ speed_main(int argc, char **argv)
32 decrypt = 1; 48 decrypt = 1;
33 j--; /* Otherwise, -decrypt gets confused with an 49 j--; /* Otherwise, -decrypt gets confused with an
34 * algorithm. */ 50 * algorithm. */
@@ -36,7 +52,7 @@
36 } else if (argc > 0 && strcmp(*argv, "-multi") == 0) { 52 } else if (argc > 0 && strcmp(*argv, "-multi") == 0) {
37 argc--; 53 argc--;
38 argv++; 54 argv++;
39@@ -1201,6 +1213,7 @@ speed_main(int argc, char **argv) 55@@ -1214,6 +1234,7 @@ speed_main(int argc, char **argv)
40 } 56 }
41 j--; /* Otherwise, -multi gets confused with an 57 j--; /* Otherwise, -multi gets confused with an
42 * algorithm. */ 58 * algorithm. */
@@ -44,7 +60,7 @@
44 } else if (argc > 0 && strcmp(*argv, "-unaligned") == 0) { 60 } else if (argc > 0 && strcmp(*argv, "-unaligned") == 0) {
45 argc--; 61 argc--;
46 argv++; 62 argv++;
47@@ -1524,7 +1537,9 @@ speed_main(int argc, char **argv) 63@@ -1537,7 +1558,9 @@ speed_main(int argc, char **argv)
48 BIO_printf(bio_err, "-evp e use EVP e.\n"); 64 BIO_printf(bio_err, "-evp e use EVP e.\n");
49 BIO_printf(bio_err, "-decrypt time decryption instead of encryption (only EVP).\n"); 65 BIO_printf(bio_err, "-decrypt time decryption instead of encryption (only EVP).\n");
50 BIO_printf(bio_err, "-mr produce machine readable output.\n"); 66 BIO_printf(bio_err, "-mr produce machine readable output.\n");
@@ -54,7 +70,7 @@
54 BIO_printf(bio_err, "-unaligned n use buffers with offset n from proper alignment.\n"); 70 BIO_printf(bio_err, "-unaligned n use buffers with offset n from proper alignment.\n");
55 goto end; 71 goto end;
56 } 72 }
57@@ -1533,8 +1548,10 @@ speed_main(int argc, char **argv) 73@@ -1546,8 +1569,10 @@ speed_main(int argc, char **argv)
58 j++; 74 j++;
59 } 75 }
60 76
@@ -65,7 +81,7 @@
65 81
66 if (j == 0) { 82 if (j == 0) {
67 for (i = 0; i < ALGOR_NUM; i++) { 83 for (i = 0; i < ALGOR_NUM; i++) {
68@@ -1607,11 +1624,15 @@ speed_main(int argc, char **argv) 84@@ -1620,11 +1645,15 @@ speed_main(int argc, char **argv)
69 #define COND (run && count<0x7fffffff) 85 #define COND (run && count<0x7fffffff)
70 #define COUNT(d) (count) 86 #define COUNT(d) (count)
71 87
@@ -81,7 +97,7 @@
81 97
82 #ifndef OPENSSL_NO_MD4 98 #ifndef OPENSSL_NO_MD4
83 if (doit[D_MD4]) { 99 if (doit[D_MD4]) {
84@@ -2513,7 +2534,9 @@ speed_main(int argc, char **argv) 100@@ -2526,7 +2555,9 @@ speed_main(int argc, char **argv)
85 free(ss); 101 free(ss);
86 } 102 }
87 103
@@ -91,15 +107,7 @@
91 if (!mr) { 107 if (!mr) {
92 fprintf(stdout, "%s\n", SSLeay_version(SSLEAY_VERSION)); 108 fprintf(stdout, "%s\n", SSLeay_version(SSLEAY_VERSION));
93 fprintf(stdout, "%s\n", SSLeay_version(SSLEAY_BUILT_ON)); 109 fprintf(stdout, "%s\n", SSLeay_version(SSLEAY_BUILT_ON));
94@@ -2695,11 +2718,15 @@ print_result(int alg, int run_no, int count, double ti 110@@ -2711,6 +2742,7 @@ print_result(int alg, int run_no, int count, double ti
95 static void
96 print_result(int alg, int run_no, int count, double time_used)
97 {
98+#ifdef _WIN32
99+ speed_alarm_free(run);
100+#endif
101 BIO_printf(bio_err, mr ? "+R:%d:%s:%f\n"
102 : "%d %s in %.2fs\n", count, names[alg], time_used);
103 results[alg][run_no] = ((double) count) / time_used * lengths[run_no]; 111 results[alg][run_no] = ((double) count) / time_used * lengths[run_no];
104 } 112 }
105 113
@@ -107,7 +115,7 @@
107 static char * 115 static char *
108 sstrsep(char **string, const char *delim) 116 sstrsep(char **string, const char *delim)
109 { 117 {
110@@ -2900,5 +2927,6 @@ do_multi(int multi) 118@@ -2911,5 +2943,6 @@ do_multi(int multi)
111 free(fds); 119 free(fds);
112 return 1; 120 return 1;
113 } 121 }