aboutsummaryrefslogtreecommitdiff
path: root/patches/speed.c.patch
blob: c29ef4d12a0c7fddff9e953697993e9b01e3599b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
--- apps/openssl/speed.c.orig	Sat Jul 13 11:02:51 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);
+#ifndef _WIN32
 static int do_multi(int multi);
+#else
+void speed_signal(int sigcatch, void (*func)(int sigraised));
+unsigned int speed_alarm(unsigned int seconds);
+void speed_alarm_free(int run);
+#define SIGALRM		14
+#define signal(sigcatch, func)	speed_signal((sigcatch), (func))
+#define alarm(seconds)		speed_alarm((seconds))
+#endif
 
 #define ALGOR_NUM	32
 #define SIZE_NUM	5
@@ -430,8 +439,10 @@
 	const EVP_CIPHER *evp_cipher = NULL;
 	const EVP_MD *evp_md = NULL;
 	int decrypt = 0;
+#ifndef _WIN32
 	int multi = 0;
 	struct sigaction sa;
+#endif
 	const char *errstr = NULL;
 
 	if (pledge("stdio proc", NULL) == -1) {
@@ -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 @@
 			}
 			j--;	/* Otherwise, -multi gets confused with an
 				 * algorithm. */
+#endif
 		} else if (argc > 0 && strcmp(*argv, "-unaligned") == 0) {
 			argc--;
 			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");
+#ifndef _WIN32
 			BIO_printf(bio_err, "-multi n        run n benchmarks in parallel.\n");
+#endif
 			BIO_printf(bio_err, "-unaligned n    use buffers with offset n from proper alignment.\n");
 			goto end;
 		}
@@ -860,8 +875,10 @@
 		j++;
 	}
 
+#ifndef _WIN32
 	if (multi && do_multi(multi))
 		goto show_res;
+#endif
 
 	if (j == 0) {
 		for (i = 0; i < ALGOR_NUM; i++) {
@@ -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;
 		}
 	}
+#ifndef _WIN32
 show_res:
+#endif
 	if (!mr) {
 		fprintf(stdout, "%s\n", SSLeay_version(SSLEAY_VERSION));
 		fprintf(stdout, "%s\n", SSLeay_version(SSLEAY_BUILT_ON));
@@ -1899,11 +1920,15 @@
 static void
 print_result(int alg, int run_no, int count, double time_used)
 {
+#ifdef _WIN32
+	speed_alarm_free(run);
+#endif
 	BIO_printf(bio_err, mr ? "+R:%d:%s:%f\n"
 	    : "%d %s in %.2fs\n", count, names[alg], time_used);
 	results[alg][run_no] = ((double) count) / time_used * lengths[run_no];
 }
 
+#ifndef _WIN32
 static char *
 sstrsep(char **string, const char *delim)
 {
@@ -2104,4 +2129,5 @@
 	free(fds);
 	return 1;
 }
+#endif
 #endif