Loading apps/speed.c +15 −27 Original line number Diff line number Diff line Loading @@ -99,24 +99,6 @@ # include <windows.h> #endif #if defined(OPENSSL_SYS_UNIX) && defined(OPENSSL_THREADS) # include <unistd.h> #endif #if !defined(OPENSSL_NO_ASYNC) # if defined(OPENSSL_SYS_UNIX) && defined(OPENSSL_THREADS) # if _POSIX_VERSION >= 200112L # define ASYNC_POSIX # endif # elif defined(_WIN32) || defined(__CYGWIN__) # define ASYNC_WIN # endif #endif #if !defined(ASYNC_POSIX) && !defined(ASYNC_WIN) # define ASYNC_NULL #endif #include <openssl/bn.h> #ifndef OPENSSL_NO_DES # include <openssl/des.h> Loading Loading @@ -458,7 +440,7 @@ OPTIONS speed_options[] = { #ifndef NO_FORK {"multi", OPT_MULTI, 'p', "Run benchmarks in parallel"}, #endif #ifndef ASYNC_NULL #ifndef OPENSSL_NO_ASYNC {"async_jobs", OPT_ASYNCJOBS, 'p', "Enable async mode and start pnum jobs"}, #endif #ifndef OPENSSL_NO_ENGINE Loading Loading @@ -1136,7 +1118,7 @@ static int run_benchmark(int async_jobs, int (*loop_function)(void *), loopargs_ int i = 0; OSSL_ASYNC_FD job_fd = 0; size_t num_job_fds = 0; #if defined(ASYNC_POSIX) #if defined(OPENSSL_SYS_UNIX) fd_set waitfdset; OSSL_ASYNC_FD max_fd = 0; #endif Loading Loading @@ -1171,7 +1153,7 @@ static int run_benchmark(int async_jobs, int (*loop_function)(void *), loopargs_ } } #if defined(ASYNC_POSIX) #if defined(OPENSSL_SYS_UNIX) FD_ZERO(&waitfdset); /* Add to the wait set all the fds that are already in the WAIT_CTX Loading @@ -1197,7 +1179,7 @@ static int run_benchmark(int async_jobs, int (*loop_function)(void *), loopargs_ #endif while (num_inprogress > 0) { #if defined(ASYNC_POSIX) #if defined(OPENSSL_SYS_UNIX) int select_result = 0; struct timeval select_timeout; select_timeout.tv_sec = 0; Loading Loading @@ -1252,7 +1234,7 @@ static int run_benchmark(int async_jobs, int (*loop_function)(void *), loopargs_ if (select_result == 0) continue; #elif defined(ASYNC_WIN) #elif defined(OPENSSL_SYS_WINDOWS) DWORD avail = 0; #endif Loading @@ -1269,10 +1251,10 @@ static int run_benchmark(int async_jobs, int (*loop_function)(void *), loopargs_ } ASYNC_WAIT_CTX_get_all_fds(loopargs[i].wait_ctx, &job_fd, &num_job_fds); #if defined(ASYNC_POSIX) #if defined(OPENSSL_SYS_UNIX) if (num_job_fds == 1 && !FD_ISSET(job_fd, &waitfdset)) continue; #elif defined(ASYNC_WIN) #elif defined(OPENSSL_SYS_WINDOWS) if (num_job_fds == 1 && !PeekNamedPipe(job_fd, NULL, 0, NULL, &avail, NULL) && avail > 0) continue; Loading @@ -1290,7 +1272,7 @@ static int run_benchmark(int async_jobs, int (*loop_function)(void *), loopargs_ total_op_count += job_op_count; } --num_inprogress; #if defined(ASYNC_POSIX) #if defined(OPENSSL_SYS_UNIX) FD_CLR(job_fd, &waitfdset); #endif loopargs[i].inprogress_job = NULL; Loading Loading @@ -1520,8 +1502,14 @@ int speed_main(int argc, char **argv) #endif break; case OPT_ASYNCJOBS: #ifndef ASYNC_NULL #ifndef OPENSSL_NO_ASYNC async_jobs = atoi(opt_arg()); if (!ASYNC_is_capable()) { BIO_printf(bio_err, "%s: async_jobs specified but async not supported\n", prog); goto opterr; } #endif break; case OPT_MISALIGN: Loading crypto/async/arch/async_null.c +5 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,11 @@ #ifdef ASYNC_NULL int ASYNC_is_capable(void) { return 0; } void async_local_cleanup(void) { } Loading crypto/async/arch/async_posix.c +5 −1 Original line number Diff line number Diff line Loading @@ -60,10 +60,14 @@ #define STACKSIZE 32768 void async_local_cleanup(void) int ASYNC_is_capable(void) { return 1; } void async_local_cleanup(void) { } int async_fibre_makecontext(async_fibre *fibre) { Loading crypto/async/arch/async_win.c +5 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,11 @@ # include <windows.h> # include "internal/cryptlib.h" int ASYNC_is_capable(void) { return 1; } void async_local_cleanup(void) { async_ctx *ctx = async_get_ctx(); Loading doc/crypto/ASYNC_start_job.pod +14 −5 Original line number Diff line number Diff line Loading @@ -4,8 +4,8 @@ ASYNC_init_thread, ASYNC_cleanup_thread, ASYNC_start_job, ASYNC_pause_job, ASYNC_in_job, ASYNC_get_wait_fd, ASYNC_set_wait_fd, ASYNC_clear_wait_fd, ASYNC_get_current_job, ASYNC_block_pause, ASYNC_unblock_pause - asynchronous job management functions ASYNC_get_current_job, ASYNC_block_pause, ASYNC_unblock_pause, ASYNC_is_capable - asynchronous job management functions =head1 SYNOPSIS Loading @@ -23,6 +23,8 @@ management functions void ASYNC_block_pause(void); void ASYNC_unblock_pause(void); int ASYNC_is_capable(void); =head1 DESCRIPTION OpenSSL implements asynchronous capabilities through an ASYNC_JOB. This Loading Loading @@ -137,6 +139,9 @@ ASYNC_block_pause() immediately after aquiring the lock and ASYNC_unblock_pause() immediately before releasing it then this situation cannot occur. Some platforms cannot support async operations. The ASYNC_is_capable() function can be used to detect whether the current platform is async capable or not. =head1 RETURN VALUES ASYNC_init_thread returns 1 on success or 0 otherwise. Loading @@ -153,6 +158,9 @@ NULL if not within the context of a job. ASYNC_get_wait_ctx() returns a pointer to the ASYNC_WAIT_CTX for the job. ASYNC_is_capable() returns 1 if the current platform is async capable or 0 otherwise. =head1 EXAMPLE The following example demonstrates how to use most of the core async APIs: Loading Loading @@ -295,8 +303,9 @@ L<crypto(3)>, L<ERR_print_errors(3)> =head1 HISTORY ASYNC_init, ASYNC_init_thread, ASYNC_cleanup, ASYNC_cleanup_thread, ASYNC_start_job, ASYNC_pause_job, ASYNC_get_wait_fd, ASYNC_get_current_job, ASYNC_wake, ASYNC_clear_wake were first added to OpenSSL 1.1.0. ASYNC_init_thread, ASYNC_cleanup_thread, ASYNC_start_job, ASYNC_pause_job, ASYNC_get_current_job, ASYNC_get_wait_ctx(), ASYNC_block_pause(), ASYNC_unblock_pause() and ASYNC_is_capable() were first added to OpenSSL 1.1.0. =cut Loading
apps/speed.c +15 −27 Original line number Diff line number Diff line Loading @@ -99,24 +99,6 @@ # include <windows.h> #endif #if defined(OPENSSL_SYS_UNIX) && defined(OPENSSL_THREADS) # include <unistd.h> #endif #if !defined(OPENSSL_NO_ASYNC) # if defined(OPENSSL_SYS_UNIX) && defined(OPENSSL_THREADS) # if _POSIX_VERSION >= 200112L # define ASYNC_POSIX # endif # elif defined(_WIN32) || defined(__CYGWIN__) # define ASYNC_WIN # endif #endif #if !defined(ASYNC_POSIX) && !defined(ASYNC_WIN) # define ASYNC_NULL #endif #include <openssl/bn.h> #ifndef OPENSSL_NO_DES # include <openssl/des.h> Loading Loading @@ -458,7 +440,7 @@ OPTIONS speed_options[] = { #ifndef NO_FORK {"multi", OPT_MULTI, 'p', "Run benchmarks in parallel"}, #endif #ifndef ASYNC_NULL #ifndef OPENSSL_NO_ASYNC {"async_jobs", OPT_ASYNCJOBS, 'p', "Enable async mode and start pnum jobs"}, #endif #ifndef OPENSSL_NO_ENGINE Loading Loading @@ -1136,7 +1118,7 @@ static int run_benchmark(int async_jobs, int (*loop_function)(void *), loopargs_ int i = 0; OSSL_ASYNC_FD job_fd = 0; size_t num_job_fds = 0; #if defined(ASYNC_POSIX) #if defined(OPENSSL_SYS_UNIX) fd_set waitfdset; OSSL_ASYNC_FD max_fd = 0; #endif Loading Loading @@ -1171,7 +1153,7 @@ static int run_benchmark(int async_jobs, int (*loop_function)(void *), loopargs_ } } #if defined(ASYNC_POSIX) #if defined(OPENSSL_SYS_UNIX) FD_ZERO(&waitfdset); /* Add to the wait set all the fds that are already in the WAIT_CTX Loading @@ -1197,7 +1179,7 @@ static int run_benchmark(int async_jobs, int (*loop_function)(void *), loopargs_ #endif while (num_inprogress > 0) { #if defined(ASYNC_POSIX) #if defined(OPENSSL_SYS_UNIX) int select_result = 0; struct timeval select_timeout; select_timeout.tv_sec = 0; Loading Loading @@ -1252,7 +1234,7 @@ static int run_benchmark(int async_jobs, int (*loop_function)(void *), loopargs_ if (select_result == 0) continue; #elif defined(ASYNC_WIN) #elif defined(OPENSSL_SYS_WINDOWS) DWORD avail = 0; #endif Loading @@ -1269,10 +1251,10 @@ static int run_benchmark(int async_jobs, int (*loop_function)(void *), loopargs_ } ASYNC_WAIT_CTX_get_all_fds(loopargs[i].wait_ctx, &job_fd, &num_job_fds); #if defined(ASYNC_POSIX) #if defined(OPENSSL_SYS_UNIX) if (num_job_fds == 1 && !FD_ISSET(job_fd, &waitfdset)) continue; #elif defined(ASYNC_WIN) #elif defined(OPENSSL_SYS_WINDOWS) if (num_job_fds == 1 && !PeekNamedPipe(job_fd, NULL, 0, NULL, &avail, NULL) && avail > 0) continue; Loading @@ -1290,7 +1272,7 @@ static int run_benchmark(int async_jobs, int (*loop_function)(void *), loopargs_ total_op_count += job_op_count; } --num_inprogress; #if defined(ASYNC_POSIX) #if defined(OPENSSL_SYS_UNIX) FD_CLR(job_fd, &waitfdset); #endif loopargs[i].inprogress_job = NULL; Loading Loading @@ -1520,8 +1502,14 @@ int speed_main(int argc, char **argv) #endif break; case OPT_ASYNCJOBS: #ifndef ASYNC_NULL #ifndef OPENSSL_NO_ASYNC async_jobs = atoi(opt_arg()); if (!ASYNC_is_capable()) { BIO_printf(bio_err, "%s: async_jobs specified but async not supported\n", prog); goto opterr; } #endif break; case OPT_MISALIGN: Loading
crypto/async/arch/async_null.c +5 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,11 @@ #ifdef ASYNC_NULL int ASYNC_is_capable(void) { return 0; } void async_local_cleanup(void) { } Loading
crypto/async/arch/async_posix.c +5 −1 Original line number Diff line number Diff line Loading @@ -60,10 +60,14 @@ #define STACKSIZE 32768 void async_local_cleanup(void) int ASYNC_is_capable(void) { return 1; } void async_local_cleanup(void) { } int async_fibre_makecontext(async_fibre *fibre) { Loading
crypto/async/arch/async_win.c +5 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,11 @@ # include <windows.h> # include "internal/cryptlib.h" int ASYNC_is_capable(void) { return 1; } void async_local_cleanup(void) { async_ctx *ctx = async_get_ctx(); Loading
doc/crypto/ASYNC_start_job.pod +14 −5 Original line number Diff line number Diff line Loading @@ -4,8 +4,8 @@ ASYNC_init_thread, ASYNC_cleanup_thread, ASYNC_start_job, ASYNC_pause_job, ASYNC_in_job, ASYNC_get_wait_fd, ASYNC_set_wait_fd, ASYNC_clear_wait_fd, ASYNC_get_current_job, ASYNC_block_pause, ASYNC_unblock_pause - asynchronous job management functions ASYNC_get_current_job, ASYNC_block_pause, ASYNC_unblock_pause, ASYNC_is_capable - asynchronous job management functions =head1 SYNOPSIS Loading @@ -23,6 +23,8 @@ management functions void ASYNC_block_pause(void); void ASYNC_unblock_pause(void); int ASYNC_is_capable(void); =head1 DESCRIPTION OpenSSL implements asynchronous capabilities through an ASYNC_JOB. This Loading Loading @@ -137,6 +139,9 @@ ASYNC_block_pause() immediately after aquiring the lock and ASYNC_unblock_pause() immediately before releasing it then this situation cannot occur. Some platforms cannot support async operations. The ASYNC_is_capable() function can be used to detect whether the current platform is async capable or not. =head1 RETURN VALUES ASYNC_init_thread returns 1 on success or 0 otherwise. Loading @@ -153,6 +158,9 @@ NULL if not within the context of a job. ASYNC_get_wait_ctx() returns a pointer to the ASYNC_WAIT_CTX for the job. ASYNC_is_capable() returns 1 if the current platform is async capable or 0 otherwise. =head1 EXAMPLE The following example demonstrates how to use most of the core async APIs: Loading Loading @@ -295,8 +303,9 @@ L<crypto(3)>, L<ERR_print_errors(3)> =head1 HISTORY ASYNC_init, ASYNC_init_thread, ASYNC_cleanup, ASYNC_cleanup_thread, ASYNC_start_job, ASYNC_pause_job, ASYNC_get_wait_fd, ASYNC_get_current_job, ASYNC_wake, ASYNC_clear_wake were first added to OpenSSL 1.1.0. ASYNC_init_thread, ASYNC_cleanup_thread, ASYNC_start_job, ASYNC_pause_job, ASYNC_get_current_job, ASYNC_get_wait_ctx(), ASYNC_block_pause(), ASYNC_unblock_pause() and ASYNC_is_capable() were first added to OpenSSL 1.1.0. =cut