diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libssl/src/apps/apps.c | 357 | ||||
| -rw-r--r-- | src/lib/libssl/src/apps/ca.c | 4 | ||||
| -rw-r--r-- | src/lib/libssl/src/apps/speed.c | 40 |
3 files changed, 1 insertions, 400 deletions
diff --git a/src/lib/libssl/src/apps/apps.c b/src/lib/libssl/src/apps/apps.c index a97d779f53..e92e95b332 100644 --- a/src/lib/libssl/src/apps/apps.c +++ b/src/lib/libssl/src/apps/apps.c | |||
| @@ -112,9 +112,7 @@ | |||
| 112 | #include <stdio.h> | 112 | #include <stdio.h> |
| 113 | #include <stdlib.h> | 113 | #include <stdlib.h> |
| 114 | #include <string.h> | 114 | #include <string.h> |
| 115 | #if !defined(OPENSSL_SYSNAME_WIN32) && !defined(NETWARE_CLIB) | ||
| 116 | #include <strings.h> | 115 | #include <strings.h> |
| 117 | #endif | ||
| 118 | #include <sys/types.h> | 116 | #include <sys/types.h> |
| 119 | #include <ctype.h> | 117 | #include <ctype.h> |
| 120 | #include <errno.h> | 118 | #include <errno.h> |
| @@ -133,18 +131,11 @@ | |||
| 133 | #include <openssl/rsa.h> | 131 | #include <openssl/rsa.h> |
| 134 | #endif | 132 | #endif |
| 135 | #include <openssl/bn.h> | 133 | #include <openssl/bn.h> |
| 136 | #ifndef OPENSSL_NO_JPAKE | ||
| 137 | #include <openssl/jpake.h> | ||
| 138 | #endif | ||
| 139 | 134 | ||
| 140 | #define NON_MAIN | 135 | #define NON_MAIN |
| 141 | #include "apps.h" | 136 | #include "apps.h" |
| 142 | #undef NON_MAIN | 137 | #undef NON_MAIN |
| 143 | 138 | ||
| 144 | #ifdef _WIN32 | ||
| 145 | static int WIN32_rename(const char *from, const char *to); | ||
| 146 | #define rename(from,to) WIN32_rename((from),(to)) | ||
| 147 | #endif | ||
| 148 | 139 | ||
| 149 | typedef struct { | 140 | typedef struct { |
| 150 | const char *name; | 141 | const char *name; |
| @@ -164,98 +155,6 @@ static EVP_PKEY *load_netscape_key(BIO *err, BIO *key, const char *file, | |||
| 164 | #endif | 155 | #endif |
| 165 | 156 | ||
| 166 | int app_init(long mesgwin); | 157 | int app_init(long mesgwin); |
| 167 | #ifdef undef /* never finished - probably never will be :-) */ | ||
| 168 | int | ||
| 169 | args_from_file(char *file, int *argc, char **argv[]) | ||
| 170 | { | ||
| 171 | FILE *fp; | ||
| 172 | int num, i; | ||
| 173 | unsigned int len; | ||
| 174 | static char *buf = NULL; | ||
| 175 | static char **arg = NULL; | ||
| 176 | char *p; | ||
| 177 | |||
| 178 | fp = fopen(file, "r"); | ||
| 179 | if (fp == NULL) | ||
| 180 | return (0); | ||
| 181 | |||
| 182 | if (fseek(fp, 0, SEEK_END) == 0) | ||
| 183 | len = ftell(fp), rewind(fp); | ||
| 184 | else | ||
| 185 | len = -1; | ||
| 186 | if (len <= 0) { | ||
| 187 | fclose(fp); | ||
| 188 | return (0); | ||
| 189 | } | ||
| 190 | |||
| 191 | *argc = 0; | ||
| 192 | *argv = NULL; | ||
| 193 | |||
| 194 | if (buf != NULL) | ||
| 195 | OPENSSL_free(buf); | ||
| 196 | buf = (char *)OPENSSL_malloc(len + 1); | ||
| 197 | if (buf == NULL) | ||
| 198 | return (0); | ||
| 199 | |||
| 200 | len = fread(buf, 1, len, fp); | ||
| 201 | if (len <= 1) | ||
| 202 | return (0); | ||
| 203 | buf[len] = '\0'; | ||
| 204 | |||
| 205 | i = 0; | ||
| 206 | for (p = buf; *p; p++) | ||
| 207 | if (*p == '\n') | ||
| 208 | i++; | ||
| 209 | if (arg != NULL) | ||
| 210 | OPENSSL_free(arg); | ||
| 211 | arg = (char **)OPENSSL_malloc(sizeof(char *)*(i*2)); | ||
| 212 | |||
| 213 | *argv = arg; | ||
| 214 | num = 0; | ||
| 215 | p = buf; | ||
| 216 | for (;;) { | ||
| 217 | if (!*p) | ||
| 218 | break; | ||
| 219 | if (*p == '#') /* comment line */ | ||
| 220 | { | ||
| 221 | while (*p && (*p != '\n')) | ||
| 222 | p++; | ||
| 223 | continue; | ||
| 224 | } | ||
| 225 | /* else we have a line */ | ||
| 226 | *(arg++) = p; | ||
| 227 | num++; | ||
| 228 | while (*p && ((*p != ' ') && (*p != '\t') && (*p != '\n'))) | ||
| 229 | p++; | ||
| 230 | if (!*p) | ||
| 231 | break; | ||
| 232 | if (*p == '\n') { | ||
| 233 | *(p++) = '\0'; | ||
| 234 | continue; | ||
| 235 | } | ||
| 236 | /* else it is a tab or space */ | ||
| 237 | p++; | ||
| 238 | while (*p && ((*p == ' ') || (*p == '\t') || (*p == '\n'))) | ||
| 239 | p++; | ||
| 240 | if (!*p) | ||
| 241 | break; | ||
| 242 | if (*p == '\n') { | ||
| 243 | p++; | ||
| 244 | continue; | ||
| 245 | } | ||
| 246 | *(arg++) = p++; | ||
| 247 | num++; | ||
| 248 | while (*p && (*p != '\n')) | ||
| 249 | p++; | ||
| 250 | if (!*p) | ||
| 251 | break; | ||
| 252 | /* else *p == '\n' */ | ||
| 253 | *(p++) = '\0'; | ||
| 254 | } | ||
| 255 | *argc = num; | ||
| 256 | return (1); | ||
| 257 | } | ||
| 258 | #endif | ||
| 259 | 158 | ||
| 260 | int | 159 | int |
| 261 | str2fmt(char *s) | 160 | str2fmt(char *s) |
| @@ -287,44 +186,6 @@ str2fmt(char *s) | |||
| 287 | return (FORMAT_UNDEF); | 186 | return (FORMAT_UNDEF); |
| 288 | } | 187 | } |
| 289 | 188 | ||
| 290 | #if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_SYS_NETWARE) | ||
| 291 | void | ||
| 292 | program_name(char *in, char *out, int size) | ||
| 293 | { | ||
| 294 | int i, n; | ||
| 295 | char *p = NULL; | ||
| 296 | |||
| 297 | n = strlen(in); | ||
| 298 | /* find the last '/', '\' or ':' */ | ||
| 299 | for (i = n - 1; i > 0; i--) { | ||
| 300 | if ((in[i] == '/') || (in[i] == '\\') || (in[i] == ':')) { | ||
| 301 | p = &(in[i + 1]); | ||
| 302 | break; | ||
| 303 | } | ||
| 304 | } | ||
| 305 | if (p == NULL) | ||
| 306 | p = in; | ||
| 307 | n = strlen(p); | ||
| 308 | |||
| 309 | /* strip off trailing .exe if present. */ | ||
| 310 | if ((n > 4) && (p[n - 4] == '.') && | ||
| 311 | ((p[n - 3] == 'e') || (p[n - 3] == 'E')) && | ||
| 312 | ((p[n - 2] == 'x') || (p[n - 2] == 'X')) && | ||
| 313 | ((p[n - 1] == 'e') || (p[n - 1] == 'E'))) | ||
| 314 | n -= 4; | ||
| 315 | |||
| 316 | if (n > size - 1) | ||
| 317 | n = size - 1; | ||
| 318 | |||
| 319 | for (i = 0; i < n; i++) { | ||
| 320 | if ((p[i] >= 'A') && (p[i] <= 'Z')) | ||
| 321 | out[i] = p[i] - 'A' + 'a'; | ||
| 322 | else | ||
| 323 | out[i] = p[i]; | ||
| 324 | } | ||
| 325 | out[n] = '\0'; | ||
| 326 | } | ||
| 327 | #else | ||
| 328 | void | 189 | void |
| 329 | program_name(char *in, char *out, int size) | 190 | program_name(char *in, char *out, int size) |
| 330 | { | 191 | { |
| @@ -337,7 +198,6 @@ program_name(char *in, char *out, int size) | |||
| 337 | p = in; | 198 | p = in; |
| 338 | BUF_strlcpy(out, p, size); | 199 | BUF_strlcpy(out, p, size); |
| 339 | } | 200 | } |
| 340 | #endif | ||
| 341 | 201 | ||
| 342 | int | 202 | int |
| 343 | chopup_args(ARGS *arg, char *buf, int *argc, char **argv[]) | 203 | chopup_args(ARGS *arg, char *buf, int *argc, char **argv[]) |
| @@ -635,7 +495,6 @@ app_get_pass(BIO *err, char *arg, int keepbio) | |||
| 635 | BIO_printf(err, "Can't open file %s\n", arg + 5); | 495 | BIO_printf(err, "Can't open file %s\n", arg + 5); |
| 636 | return NULL; | 496 | return NULL; |
| 637 | } | 497 | } |
| 638 | #if !defined(_WIN32) | ||
| 639 | /* | 498 | /* |
| 640 | * Under _WIN32, which covers even Win64 and CE, file | 499 | * Under _WIN32, which covers even Win64 and CE, file |
| 641 | * descriptors referenced by BIO_s_fd are not inherited | 500 | * descriptors referenced by BIO_s_fd are not inherited |
| @@ -656,7 +515,6 @@ app_get_pass(BIO *err, char *arg, int keepbio) | |||
| 656 | /* Can't do BIO_gets on an fd BIO so add a buffering BIO */ | 515 | /* Can't do BIO_gets on an fd BIO so add a buffering BIO */ |
| 657 | btmp = BIO_new(BIO_f_buffer()); | 516 | btmp = BIO_new(BIO_f_buffer()); |
| 658 | pwdbio = BIO_push(btmp, pwdbio); | 517 | pwdbio = BIO_push(btmp, pwdbio); |
| 659 | #endif | ||
| 660 | } else if (!strcmp(arg, "stdin")) { | 518 | } else if (!strcmp(arg, "stdin")) { |
| 661 | pwdbio = BIO_new_fp(stdin, BIO_NOCLOSE); | 519 | pwdbio = BIO_new_fp(stdin, BIO_NOCLOSE); |
| 662 | if (!pwdbio) { | 520 | if (!pwdbio) { |
| @@ -2603,193 +2461,9 @@ next_protos_parse(unsigned short *outlen, const char *in) | |||
| 2603 | /* | 2461 | /* |
| 2604 | * Platform-specific sections | 2462 | * Platform-specific sections |
| 2605 | */ | 2463 | */ |
| 2606 | #if defined(_WIN32) | ||
| 2607 | # ifdef fileno | ||
| 2608 | # undef fileno | ||
| 2609 | # define fileno(a) (int)_fileno(a) | ||
| 2610 | # endif | ||
| 2611 | |||
| 2612 | # include <windows.h> | ||
| 2613 | # include <tchar.h> | ||
| 2614 | |||
| 2615 | static int | ||
| 2616 | WIN32_rename(const char *from, const char *to) | ||
| 2617 | { | ||
| 2618 | TCHAR *tfrom = NULL, *tto; | ||
| 2619 | DWORD err; | ||
| 2620 | int ret = 0; | ||
| 2621 | |||
| 2622 | if (sizeof(TCHAR) == 1) { | ||
| 2623 | tfrom = (TCHAR *)from; | ||
| 2624 | tto = (TCHAR *)to; | ||
| 2625 | } | ||
| 2626 | else /* UNICODE path */ | ||
| 2627 | { | ||
| 2628 | size_t i, flen = strlen(from) + 1, tlen = strlen(to) + 1; | ||
| 2629 | tfrom = (TCHAR *)malloc(sizeof(TCHAR)*(flen + tlen)); | ||
| 2630 | if (tfrom == NULL) | ||
| 2631 | goto err; | ||
| 2632 | tto = tfrom + flen; | ||
| 2633 | #if !defined(_WIN32_WCE) || _WIN32_WCE>=101 | ||
| 2634 | if (!MultiByteToWideChar(CP_ACP, 0, from, flen, (WCHAR *)tfrom, flen)) | ||
| 2635 | #endif | ||
| 2636 | for (i = 0;i < flen;i++) tfrom[i] = (TCHAR)from[i]; | ||
| 2637 | #if !defined(_WIN32_WCE) || _WIN32_WCE>=101 | ||
| 2638 | if (!MultiByteToWideChar(CP_ACP, 0, to, tlen, (WCHAR *)tto, tlen)) | ||
| 2639 | #endif | ||
| 2640 | for (i = 0;i < tlen;i++) tto[i] = (TCHAR)to[i]; | ||
| 2641 | } | ||
| 2642 | |||
| 2643 | if (MoveFile(tfrom, tto)) | ||
| 2644 | goto ok; | ||
| 2645 | err = GetLastError(); | ||
| 2646 | if (err == ERROR_ALREADY_EXISTS || err == ERROR_FILE_EXISTS) { | ||
| 2647 | if (DeleteFile(tto) && MoveFile(tfrom, tto)) | ||
| 2648 | goto ok; | ||
| 2649 | err = GetLastError(); | ||
| 2650 | } | ||
| 2651 | if (err == ERROR_FILE_NOT_FOUND || err == ERROR_PATH_NOT_FOUND) | ||
| 2652 | errno = ENOENT; | ||
| 2653 | else if (err == ERROR_ACCESS_DENIED) | ||
| 2654 | errno = EACCES; | ||
| 2655 | else | ||
| 2656 | errno = EINVAL; /* we could map more codes... */ | ||
| 2657 | err: | ||
| 2658 | ret = -1; | ||
| 2659 | ok: | ||
| 2660 | if (tfrom != NULL && tfrom != (TCHAR *)from) | ||
| 2661 | free(tfrom); | ||
| 2662 | return ret; | ||
| 2663 | } | ||
| 2664 | #endif | ||
| 2665 | 2464 | ||
| 2666 | /* app_tminterval section */ | 2465 | /* app_tminterval section */ |
| 2667 | #if defined(_WIN32) | 2466 | #if defined(_SC_CLK_TCK) /* by means of unistd.h */ |
| 2668 | double | ||
| 2669 | app_tminterval(int stop, int usertime) | ||
| 2670 | { | ||
| 2671 | FILETIME now; | ||
| 2672 | double ret = 0; | ||
| 2673 | static ULARGE_INTEGER tmstart; | ||
| 2674 | static int warning = 1; | ||
| 2675 | #ifdef _WIN32_WINNT | ||
| 2676 | static HANDLE proc = NULL; | ||
| 2677 | |||
| 2678 | if (proc == NULL) { | ||
| 2679 | if (check_winnt()) | ||
| 2680 | proc = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, | ||
| 2681 | GetCurrentProcessId()); | ||
| 2682 | if (proc == NULL) | ||
| 2683 | proc = (HANDLE) - 1; | ||
| 2684 | } | ||
| 2685 | |||
| 2686 | if (usertime && proc != (HANDLE) - 1) { | ||
| 2687 | FILETIME junk; | ||
| 2688 | GetProcessTimes(proc, &junk, &junk, &junk, &now); | ||
| 2689 | } else | ||
| 2690 | #endif | ||
| 2691 | { | ||
| 2692 | SYSTEMTIME systime; | ||
| 2693 | |||
| 2694 | if (usertime && warning) { | ||
| 2695 | BIO_printf(bio_err, "To get meaningful results, run " | ||
| 2696 | "this program on idle system.\n"); | ||
| 2697 | warning = 0; | ||
| 2698 | } | ||
| 2699 | GetSystemTime(&systime); | ||
| 2700 | SystemTimeToFileTime(&systime, &now); | ||
| 2701 | } | ||
| 2702 | |||
| 2703 | if (stop == TM_START) { | ||
| 2704 | tmstart.u.LowPart = now.dwLowDateTime; | ||
| 2705 | tmstart.u.HighPart = now.dwHighDateTime; | ||
| 2706 | } else { | ||
| 2707 | ULARGE_INTEGER tmstop; | ||
| 2708 | |||
| 2709 | tmstop.u.LowPart = now.dwLowDateTime; | ||
| 2710 | tmstop.u.HighPart = now.dwHighDateTime; | ||
| 2711 | |||
| 2712 | ret = (__int64)(tmstop.QuadPart - tmstart.QuadPart)*1e - 7; | ||
| 2713 | } | ||
| 2714 | |||
| 2715 | return (ret); | ||
| 2716 | } | ||
| 2717 | |||
| 2718 | #elif defined(OPENSSL_SYSTEM_VXWORKS) | ||
| 2719 | #include <time.h> | ||
| 2720 | |||
| 2721 | double | ||
| 2722 | app_tminterval(int stop, int usertime) | ||
| 2723 | { | ||
| 2724 | double ret = 0; | ||
| 2725 | #ifdef CLOCK_REALTIME | ||
| 2726 | static struct timespec tmstart; | ||
| 2727 | struct timespec now; | ||
| 2728 | #else | ||
| 2729 | static unsigned long tmstart; | ||
| 2730 | unsigned long now; | ||
| 2731 | #endif | ||
| 2732 | static int warning = 1; | ||
| 2733 | |||
| 2734 | if (usertime && warning) { | ||
| 2735 | BIO_printf(bio_err, "To get meaningful results, run " | ||
| 2736 | "this program on idle system.\n"); | ||
| 2737 | warning = 0; | ||
| 2738 | } | ||
| 2739 | |||
| 2740 | #ifdef CLOCK_REALTIME | ||
| 2741 | clock_gettime(CLOCK_REALTIME, &now); | ||
| 2742 | if (stop == TM_START) | ||
| 2743 | tmstart = now; | ||
| 2744 | else ret = ( (now.tv_sec + now.tv_nsec*1e - 9) | ||
| 2745 | - (tmstart.tv_sec + tmstart.tv_nsec*1e - 9) ); | ||
| 2746 | #else | ||
| 2747 | now = tickGet(); | ||
| 2748 | if (stop == TM_START) | ||
| 2749 | tmstart = now; | ||
| 2750 | else | ||
| 2751 | ret = (now - tmstart)/(double)sysClkRateGet(); | ||
| 2752 | #endif | ||
| 2753 | return (ret); | ||
| 2754 | } | ||
| 2755 | |||
| 2756 | #elif defined(OPENSSL_SYSTEM_VMS) | ||
| 2757 | #include <time.h> | ||
| 2758 | #include <times.h> | ||
| 2759 | |||
| 2760 | double | ||
| 2761 | app_tminterval(int stop, int usertime) | ||
| 2762 | { | ||
| 2763 | static clock_t tmstart; | ||
| 2764 | double ret = 0; | ||
| 2765 | clock_t now; | ||
| 2766 | #ifdef __TMS | ||
| 2767 | struct tms rus; | ||
| 2768 | |||
| 2769 | now = times(&rus); | ||
| 2770 | if (usertime) | ||
| 2771 | now = rus.tms_utime; | ||
| 2772 | #else | ||
| 2773 | if (usertime) | ||
| 2774 | now = clock(); /* sum of user and kernel times */ | ||
| 2775 | else { | ||
| 2776 | struct timeval tv; | ||
| 2777 | gettimeofday(&tv, NULL); | ||
| 2778 | now = (clock_t)( | ||
| 2779 | (unsigned long long)tv.tv_sec*CLK_TCK + | ||
| 2780 | (unsigned long long)tv.tv_usec*(1000000/CLK_TCK) | ||
| 2781 | ); | ||
| 2782 | } | ||
| 2783 | #endif | ||
| 2784 | if (stop == TM_START) | ||
| 2785 | tmstart = now; | ||
| 2786 | else | ||
| 2787 | ret = (now - tmstart)/(double)(CLK_TCK); | ||
| 2788 | |||
| 2789 | return (ret); | ||
| 2790 | } | ||
| 2791 | |||
| 2792 | #elif defined(_SC_CLK_TCK) /* by means of unistd.h */ | ||
| 2793 | #include <sys/times.h> | 2467 | #include <sys/times.h> |
| 2794 | 2468 | ||
| 2795 | double | 2469 | double |
| @@ -2841,34 +2515,6 @@ app_tminterval(int stop, int usertime) | |||
| 2841 | #endif | 2515 | #endif |
| 2842 | 2516 | ||
| 2843 | /* app_isdir section */ | 2517 | /* app_isdir section */ |
| 2844 | #ifdef _WIN32 | ||
| 2845 | int | ||
| 2846 | app_isdir(const char *name) | ||
| 2847 | { | ||
| 2848 | HANDLE hList; | ||
| 2849 | WIN32_FIND_DATA FileData; | ||
| 2850 | #if defined(UNICODE) || defined(_UNICODE) | ||
| 2851 | size_t i, len_0 = strlen(name) + 1; | ||
| 2852 | |||
| 2853 | if (len_0 > sizeof(FileData.cFileName)/sizeof(FileData.cFileName[0])) | ||
| 2854 | return -1; | ||
| 2855 | |||
| 2856 | #if !defined(_WIN32_WCE) || _WIN32_WCE>=101 | ||
| 2857 | if (!MultiByteToWideChar(CP_ACP, 0, name, len_0, FileData.cFileName, len_0)) | ||
| 2858 | #endif | ||
| 2859 | for (i = 0; i < len_0; i++) | ||
| 2860 | FileData.cFileName[i] = (WCHAR)name[i]; | ||
| 2861 | |||
| 2862 | hList = FindFirstFile(FileData.cFileName, &FileData); | ||
| 2863 | #else | ||
| 2864 | hList = FindFirstFile(name, &FileData); | ||
| 2865 | #endif | ||
| 2866 | if (hList == INVALID_HANDLE_VALUE) | ||
| 2867 | return -1; | ||
| 2868 | FindClose(hList); | ||
| 2869 | return ((FileData.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) != 0); | ||
| 2870 | } | ||
| 2871 | #else | ||
| 2872 | #include <sys/stat.h> | 2518 | #include <sys/stat.h> |
| 2873 | #ifndef S_ISDIR | 2519 | #ifndef S_ISDIR |
| 2874 | # if defined(_S_IFMT) && defined(_S_IFDIR) | 2520 | # if defined(_S_IFMT) && defined(_S_IFDIR) |
| @@ -2892,7 +2538,6 @@ app_isdir(const char *name) | |||
| 2892 | return -1; | 2538 | return -1; |
| 2893 | #endif | 2539 | #endif |
| 2894 | } | 2540 | } |
| 2895 | #endif | ||
| 2896 | 2541 | ||
| 2897 | /* raw_read|write section */ | 2542 | /* raw_read|write section */ |
| 2898 | #if defined(_WIN32) && defined(STD_INPUT_HANDLE) | 2543 | #if defined(_WIN32) && defined(STD_INPUT_HANDLE) |
diff --git a/src/lib/libssl/src/apps/ca.c b/src/lib/libssl/src/apps/ca.c index 54344a1377..7a68552c62 100644 --- a/src/lib/libssl/src/apps/ca.c +++ b/src/lib/libssl/src/apps/ca.c | |||
| @@ -783,11 +783,7 @@ bad: | |||
| 783 | that to access(). However, time's too short to do that just | 783 | that to access(). However, time's too short to do that just |
| 784 | now. | 784 | now. |
| 785 | */ | 785 | */ |
| 786 | #ifndef _WIN32 | ||
| 787 | if (access(outdir, R_OK|W_OK|X_OK) != 0) | 786 | if (access(outdir, R_OK|W_OK|X_OK) != 0) |
| 788 | #else | ||
| 789 | if (_access(outdir, R_OK|W_OK|X_OK) != 0) | ||
| 790 | #endif | ||
| 791 | { | 787 | { |
| 792 | BIO_printf(bio_err, "I am unable to access the %s directory\n", outdir); | 788 | BIO_printf(bio_err, "I am unable to access the %s directory\n", outdir); |
| 793 | perror(outdir); | 789 | perror(outdir); |
diff --git a/src/lib/libssl/src/apps/speed.c b/src/lib/libssl/src/apps/speed.c index 7e60c08a00..fb4f25ed41 100644 --- a/src/lib/libssl/src/apps/speed.c +++ b/src/lib/libssl/src/apps/speed.c | |||
| @@ -288,49 +288,11 @@ static SIGRETTYPE sig_done(int sig) | |||
| 288 | #define START 0 | 288 | #define START 0 |
| 289 | #define STOP 1 | 289 | #define STOP 1 |
| 290 | 290 | ||
| 291 | #if defined(_WIN32) | ||
| 292 | |||
| 293 | #if !defined(SIGALRM) | ||
| 294 | # define SIGALRM | ||
| 295 | #endif | ||
| 296 | static unsigned int lapse,schlock; | ||
| 297 | static void alarm_win32(unsigned int secs) { lapse = secs*1000; } | ||
| 298 | #define alarm alarm_win32 | ||
| 299 | |||
| 300 | static DWORD WINAPI sleepy(VOID *arg) | ||
| 301 | { | ||
| 302 | schlock = 1; | ||
| 303 | Sleep(lapse); | ||
| 304 | run = 0; | ||
| 305 | return 0; | ||
| 306 | } | ||
| 307 | |||
| 308 | static double Time_F(int s) | ||
| 309 | { | ||
| 310 | if (s == START) | ||
| 311 | { | ||
| 312 | HANDLE thr; | ||
| 313 | schlock = 0; | ||
| 314 | thr = CreateThread(NULL,4096,sleepy,NULL,0,NULL); | ||
| 315 | if (thr==NULL) | ||
| 316 | { | ||
| 317 | DWORD ret=GetLastError(); | ||
| 318 | BIO_printf(bio_err,"unable to CreateThread (%d)",ret); | ||
| 319 | ExitProcess(ret); | ||
| 320 | } | ||
| 321 | CloseHandle(thr); /* detach the thread */ | ||
| 322 | while (!schlock) Sleep(0); /* scheduler spinlock */ | ||
| 323 | } | ||
| 324 | |||
| 325 | return app_tminterval(s,usertime); | ||
| 326 | } | ||
| 327 | #else | ||
| 328 | 291 | ||
| 329 | static double Time_F(int s) | 292 | static double Time_F(int s) |
| 330 | { | 293 | { |
| 331 | return app_tminterval(s,usertime); | 294 | return app_tminterval(s,usertime); |
| 332 | } | 295 | } |
| 333 | #endif | ||
| 334 | 296 | ||
| 335 | 297 | ||
| 336 | #ifndef OPENSSL_NO_ECDH | 298 | #ifndef OPENSSL_NO_ECDH |
| @@ -1486,9 +1448,7 @@ int MAIN(int argc, char **argv) | |||
| 1486 | #else | 1448 | #else |
| 1487 | #define COND(c) (run && count<0x7fffffff) | 1449 | #define COND(c) (run && count<0x7fffffff) |
| 1488 | #define COUNT(d) (count) | 1450 | #define COUNT(d) (count) |
| 1489 | #ifndef _WIN32 | ||
| 1490 | signal(SIGALRM,sig_done); | 1451 | signal(SIGALRM,sig_done); |
| 1491 | #endif | ||
| 1492 | #endif /* SIGALRM */ | 1452 | #endif /* SIGALRM */ |
| 1493 | 1453 | ||
| 1494 | #ifndef OPENSSL_NO_MD2 | 1454 | #ifndef OPENSSL_NO_MD2 |
