diff options
| author | beck <> | 1999-09-29 04:37:45 +0000 |
|---|---|---|
| committer | beck <> | 1999-09-29 04:37:45 +0000 |
| commit | de8f24ea083384bb66b32ec105dc4743c5663cdf (patch) | |
| tree | 1412176ae62a3cab2cf2b0b92150fcbceaac6092 /src/lib/libcrypto/threads/mttest.c | |
| parent | cb929d29896bcb87c2a97417fbd03e50078fc178 (diff) | |
| download | openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.gz openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.bz2 openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.zip | |
OpenSSL 0.9.4 merge
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/threads/mttest.c | 119 |
1 files changed, 33 insertions, 86 deletions
diff --git a/src/lib/libcrypto/threads/mttest.c b/src/lib/libcrypto/threads/mttest.c index be395f2bc4..142623edda 100644 --- a/src/lib/libcrypto/threads/mttest.c +++ b/src/lib/libcrypto/threads/mttest.c | |||
| @@ -74,13 +74,13 @@ | |||
| 74 | #include <ulocks.h> | 74 | #include <ulocks.h> |
| 75 | #include <sys/prctl.h> | 75 | #include <sys/prctl.h> |
| 76 | #endif | 76 | #endif |
| 77 | #include "lhash.h" | 77 | #include <openssl/lhash.h> |
| 78 | #include "crypto.h" | 78 | #include <openssl/crypto.h> |
| 79 | #include "buffer.h" | 79 | #include <openssl/buffer.h> |
| 80 | #include "../e_os.h" | 80 | #include "../e_os.h" |
| 81 | #include "x509.h" | 81 | #include <openssl/x509.h> |
| 82 | #include "ssl.h" | 82 | #include <openssl/ssl.h> |
| 83 | #include "err.h" | 83 | #include <openssl/err.h> |
| 84 | 84 | ||
| 85 | #ifdef NO_FP_API | 85 | #ifdef NO_FP_API |
| 86 | #define APPS_WIN16 | 86 | #define APPS_WIN16 |
| @@ -92,7 +92,6 @@ | |||
| 92 | 92 | ||
| 93 | #define MAX_THREAD_NUMBER 100 | 93 | #define MAX_THREAD_NUMBER 100 |
| 94 | 94 | ||
| 95 | #ifndef NOPROTO | ||
| 96 | int MS_CALLBACK verify_callback(int ok, X509 *xs, X509 *xi, int depth, | 95 | int MS_CALLBACK verify_callback(int ok, X509 *xs, X509 *xi, int depth, |
| 97 | int error,char *arg); | 96 | int error,char *arg); |
| 98 | void thread_setup(void); | 97 | void thread_setup(void); |
| @@ -108,23 +107,6 @@ unsigned long irix_thread_id(void ); | |||
| 108 | unsigned long solaris_thread_id(void ); | 107 | unsigned long solaris_thread_id(void ); |
| 109 | unsigned long pthreads_thread_id(void ); | 108 | unsigned long pthreads_thread_id(void ); |
| 110 | 109 | ||
| 111 | #else | ||
| 112 | int MS_CALLBACK verify_callback(); | ||
| 113 | void thread_setup(); | ||
| 114 | void thread_cleanup(); | ||
| 115 | void do_threads(); | ||
| 116 | |||
| 117 | void irix_locking_callback(); | ||
| 118 | void solaris_locking_callback(); | ||
| 119 | void win32_locking_callback(); | ||
| 120 | void pthreads_locking_callback(); | ||
| 121 | |||
| 122 | unsigned long irix_thread_id(); | ||
| 123 | unsigned long solaris_thread_id(); | ||
| 124 | unsigned long pthreads_thread_id(); | ||
| 125 | |||
| 126 | #endif | ||
| 127 | |||
| 128 | BIO *bio_err=NULL; | 110 | BIO *bio_err=NULL; |
| 129 | BIO *bio_stdout=NULL; | 111 | BIO *bio_stdout=NULL; |
| 130 | 112 | ||
| @@ -139,15 +121,8 @@ int number_of_loops=10; | |||
| 139 | int reconnect=0; | 121 | int reconnect=0; |
| 140 | int cache_stats=0; | 122 | int cache_stats=0; |
| 141 | 123 | ||
| 142 | #ifndef NOPROTO | ||
| 143 | int doit(char *ctx[4]); | 124 | int doit(char *ctx[4]); |
| 144 | #else | 125 | static void print_stats(FILE *fp, SSL_CTX *ctx) |
| 145 | int doit(); | ||
| 146 | #endif | ||
| 147 | |||
| 148 | static void print_stats(fp,ctx) | ||
| 149 | FILE *fp; | ||
| 150 | SSL_CTX *ctx; | ||
| 151 | { | 126 | { |
| 152 | fprintf(fp,"%4ld items in the session cache\n", | 127 | fprintf(fp,"%4ld items in the session cache\n", |
| 153 | SSL_CTX_sess_number(ctx)); | 128 | SSL_CTX_sess_number(ctx)); |
| @@ -164,7 +139,7 @@ SSL_CTX *ctx; | |||
| 164 | fprintf(fp,"%4d session cache timeouts\n",SSL_CTX_sess_timeouts(ctx)); | 139 | fprintf(fp,"%4d session cache timeouts\n",SSL_CTX_sess_timeouts(ctx)); |
| 165 | } | 140 | } |
| 166 | 141 | ||
| 167 | static void sv_usage() | 142 | static void sv_usage(void) |
| 168 | { | 143 | { |
| 169 | fprintf(stderr,"usage: ssltest [args ...]\n"); | 144 | fprintf(stderr,"usage: ssltest [args ...]\n"); |
| 170 | fprintf(stderr,"\n"); | 145 | fprintf(stderr,"\n"); |
| @@ -182,9 +157,7 @@ static void sv_usage() | |||
| 182 | fprintf(stderr," -ssl3 - just SSLv3n\n"); | 157 | fprintf(stderr," -ssl3 - just SSLv3n\n"); |
| 183 | } | 158 | } |
| 184 | 159 | ||
| 185 | int main(argc, argv) | 160 | int main(int argc, char *argv[]) |
| 186 | int argc; | ||
| 187 | char *argv[]; | ||
| 188 | { | 161 | { |
| 189 | char *CApath=NULL,*CAfile=NULL; | 162 | char *CApath=NULL,*CAfile=NULL; |
| 190 | int badop=0; | 163 | int badop=0; |
| @@ -358,8 +331,7 @@ end: | |||
| 358 | #define C_DONE 1 | 331 | #define C_DONE 1 |
| 359 | #define S_DONE 2 | 332 | #define S_DONE 2 |
| 360 | 333 | ||
| 361 | int ndoit(ssl_ctx) | 334 | int ndoit(SSL_CTX *ssl_ctx[2]) |
| 362 | SSL_CTX *ssl_ctx[2]; | ||
| 363 | { | 335 | { |
| 364 | int i; | 336 | int i; |
| 365 | int ret; | 337 | int ret; |
| @@ -405,8 +377,7 @@ SSL_CTX *ssl_ctx[2]; | |||
| 405 | return(0); | 377 | return(0); |
| 406 | } | 378 | } |
| 407 | 379 | ||
| 408 | int doit(ctx) | 380 | int doit(char *ctx[4]) |
| 409 | char *ctx[4]; | ||
| 410 | { | 381 | { |
| 411 | SSL_CTX *s_ctx,*c_ctx; | 382 | SSL_CTX *s_ctx,*c_ctx; |
| 412 | static char cbuf[200],sbuf[200]; | 383 | static char cbuf[200],sbuf[200]; |
| @@ -681,13 +652,8 @@ err: | |||
| 681 | return(0); | 652 | return(0); |
| 682 | } | 653 | } |
| 683 | 654 | ||
| 684 | int MS_CALLBACK verify_callback(ok, xs, xi, depth, error, arg) | 655 | int MS_CALLBACK verify_callback(int ok, X509 *xs, X509 *xi, int depth, |
| 685 | int ok; | 656 | int error, char *arg) |
| 686 | X509 *xs; | ||
| 687 | X509 *xi; | ||
| 688 | int depth; | ||
| 689 | int error; | ||
| 690 | char *arg; | ||
| 691 | { | 657 | { |
| 692 | char buf[256]; | 658 | char buf[256]; |
| 693 | 659 | ||
| @@ -708,7 +674,7 @@ char *arg; | |||
| 708 | 674 | ||
| 709 | static HANDLE lock_cs[CRYPTO_NUM_LOCKS]; | 675 | static HANDLE lock_cs[CRYPTO_NUM_LOCKS]; |
| 710 | 676 | ||
| 711 | void thread_setup() | 677 | void thread_setup(void) |
| 712 | { | 678 | { |
| 713 | int i; | 679 | int i; |
| 714 | 680 | ||
| @@ -721,7 +687,7 @@ void thread_setup() | |||
| 721 | /* id callback defined */ | 687 | /* id callback defined */ |
| 722 | } | 688 | } |
| 723 | 689 | ||
| 724 | void thread_cleanup() | 690 | void thread_cleanup(void) |
| 725 | { | 691 | { |
| 726 | int i; | 692 | int i; |
| 727 | 693 | ||
| @@ -730,11 +696,7 @@ void thread_cleanup() | |||
| 730 | CloseHandle(lock_cs[i]); | 696 | CloseHandle(lock_cs[i]); |
| 731 | } | 697 | } |
| 732 | 698 | ||
| 733 | void win32_locking_callback(mode,type,file,line) | 699 | void win32_locking_callback(int mode, int type, char *file, int line) |
| 734 | int mode; | ||
| 735 | int type; | ||
| 736 | char *file; | ||
| 737 | int line; | ||
| 738 | { | 700 | { |
| 739 | if (mode & CRYPTO_LOCK) | 701 | if (mode & CRYPTO_LOCK) |
| 740 | { | 702 | { |
| @@ -746,8 +708,7 @@ int line; | |||
| 746 | } | 708 | } |
| 747 | } | 709 | } |
| 748 | 710 | ||
| 749 | void do_threads(s_ctx,c_ctx) | 711 | void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx) |
| 750 | SSL_CTX *s_ctx,*c_ctx; | ||
| 751 | { | 712 | { |
| 752 | double ret; | 713 | double ret; |
| 753 | SSL_CTX *ssl_ctx[2]; | 714 | SSL_CTX *ssl_ctx[2]; |
| @@ -806,7 +767,7 @@ static mutex_t lock_cs[CRYPTO_NUM_LOCKS]; | |||
| 806 | /*static rwlock_t lock_cs[CRYPTO_NUM_LOCKS]; */ | 767 | /*static rwlock_t lock_cs[CRYPTO_NUM_LOCKS]; */ |
| 807 | static long lock_count[CRYPTO_NUM_LOCKS]; | 768 | static long lock_count[CRYPTO_NUM_LOCKS]; |
| 808 | 769 | ||
| 809 | void thread_setup() | 770 | void thread_setup(void) |
| 810 | { | 771 | { |
| 811 | int i; | 772 | int i; |
| 812 | 773 | ||
| @@ -821,7 +782,7 @@ void thread_setup() | |||
| 821 | CRYPTO_set_locking_callback((void (*)())solaris_locking_callback); | 782 | CRYPTO_set_locking_callback((void (*)())solaris_locking_callback); |
| 822 | } | 783 | } |
| 823 | 784 | ||
| 824 | void thread_cleanup() | 785 | void thread_cleanup(void) |
| 825 | { | 786 | { |
| 826 | int i; | 787 | int i; |
| 827 | 788 | ||
| @@ -836,11 +797,7 @@ fprintf(stderr,"cleanup\n"); | |||
| 836 | fprintf(stderr,"done cleanup\n"); | 797 | fprintf(stderr,"done cleanup\n"); |
| 837 | } | 798 | } |
| 838 | 799 | ||
| 839 | void solaris_locking_callback(mode,type,file,line) | 800 | void solaris_locking_callback(int mode, int type, char *file, int line) |
| 840 | int mode; | ||
| 841 | int type; | ||
| 842 | char *file; | ||
| 843 | int line; | ||
| 844 | { | 801 | { |
| 845 | #ifdef undef | 802 | #ifdef undef |
| 846 | fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n", | 803 | fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n", |
| @@ -872,8 +829,7 @@ if (CRYPTO_LOCK_SSL_CERT == type) | |||
| 872 | } | 829 | } |
| 873 | } | 830 | } |
| 874 | 831 | ||
| 875 | void do_threads(s_ctx,c_ctx) | 832 | void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx) |
| 876 | SSL_CTX *s_ctx,*c_ctx; | ||
| 877 | { | 833 | { |
| 878 | SSL_CTX *ssl_ctx[2]; | 834 | SSL_CTX *ssl_ctx[2]; |
| 879 | thread_t thread_ctx[MAX_THREAD_NUMBER]; | 835 | thread_t thread_ctx[MAX_THREAD_NUMBER]; |
| @@ -902,7 +858,7 @@ SSL_CTX *s_ctx,*c_ctx; | |||
| 902 | s_ctx->references,c_ctx->references); | 858 | s_ctx->references,c_ctx->references); |
| 903 | } | 859 | } |
| 904 | 860 | ||
| 905 | unsigned long solaris_thread_id() | 861 | unsigned long solaris_thread_id(void) |
| 906 | { | 862 | { |
| 907 | unsigned long ret; | 863 | unsigned long ret; |
| 908 | 864 | ||
| @@ -917,7 +873,7 @@ unsigned long solaris_thread_id() | |||
| 917 | static usptr_t *arena; | 873 | static usptr_t *arena; |
| 918 | static usema_t *lock_cs[CRYPTO_NUM_LOCKS]; | 874 | static usema_t *lock_cs[CRYPTO_NUM_LOCKS]; |
| 919 | 875 | ||
| 920 | void thread_setup() | 876 | void thread_setup(void) |
| 921 | { | 877 | { |
| 922 | int i; | 878 | int i; |
| 923 | char filename[20]; | 879 | char filename[20]; |
| @@ -941,7 +897,7 @@ void thread_setup() | |||
| 941 | CRYPTO_set_locking_callback((void (*)())irix_locking_callback); | 897 | CRYPTO_set_locking_callback((void (*)())irix_locking_callback); |
| 942 | } | 898 | } |
| 943 | 899 | ||
| 944 | void thread_cleanup() | 900 | void thread_cleanup(void) |
| 945 | { | 901 | { |
| 946 | int i; | 902 | int i; |
| 947 | 903 | ||
| @@ -956,11 +912,7 @@ void thread_cleanup() | |||
| 956 | } | 912 | } |
| 957 | } | 913 | } |
| 958 | 914 | ||
| 959 | void irix_locking_callback(mode,type,file,line) | 915 | void irix_locking_callback(int mode, int type, char *file, int line) |
| 960 | int mode; | ||
| 961 | int type; | ||
| 962 | char *file; | ||
| 963 | int line; | ||
| 964 | { | 916 | { |
| 965 | if (mode & CRYPTO_LOCK) | 917 | if (mode & CRYPTO_LOCK) |
| 966 | { | 918 | { |
| @@ -974,8 +926,7 @@ int line; | |||
| 974 | } | 926 | } |
| 975 | } | 927 | } |
| 976 | 928 | ||
| 977 | void do_threads(s_ctx,c_ctx) | 929 | void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx) |
| 978 | SSL_CTX *s_ctx,*c_ctx; | ||
| 979 | { | 930 | { |
| 980 | SSL_CTX *ssl_ctx[2]; | 931 | SSL_CTX *ssl_ctx[2]; |
| 981 | int thread_ctx[MAX_THREAD_NUMBER]; | 932 | int thread_ctx[MAX_THREAD_NUMBER]; |
| @@ -1000,7 +951,7 @@ SSL_CTX *s_ctx,*c_ctx; | |||
| 1000 | s_ctx->references,c_ctx->references); | 951 | s_ctx->references,c_ctx->references); |
| 1001 | } | 952 | } |
| 1002 | 953 | ||
| 1003 | unsigned long irix_thread_id() | 954 | unsigned long irix_thread_id(void) |
| 1004 | { | 955 | { |
| 1005 | unsigned long ret; | 956 | unsigned long ret; |
| 1006 | 957 | ||
| @@ -1014,7 +965,7 @@ unsigned long irix_thread_id() | |||
| 1014 | static pthread_mutex_t lock_cs[CRYPTO_NUM_LOCKS]; | 965 | static pthread_mutex_t lock_cs[CRYPTO_NUM_LOCKS]; |
| 1015 | static long lock_count[CRYPTO_NUM_LOCKS]; | 966 | static long lock_count[CRYPTO_NUM_LOCKS]; |
| 1016 | 967 | ||
| 1017 | void thread_setup() | 968 | void thread_setup(void) |
| 1018 | { | 969 | { |
| 1019 | int i; | 970 | int i; |
| 1020 | 971 | ||
| @@ -1028,7 +979,7 @@ void thread_setup() | |||
| 1028 | CRYPTO_set_locking_callback((void (*)())pthreads_locking_callback); | 979 | CRYPTO_set_locking_callback((void (*)())pthreads_locking_callback); |
| 1029 | } | 980 | } |
| 1030 | 981 | ||
| 1031 | void thread_cleanup() | 982 | void thread_cleanup(void) |
| 1032 | { | 983 | { |
| 1033 | int i; | 984 | int i; |
| 1034 | 985 | ||
| @@ -1043,11 +994,8 @@ void thread_cleanup() | |||
| 1043 | fprintf(stderr,"done cleanup\n"); | 994 | fprintf(stderr,"done cleanup\n"); |
| 1044 | } | 995 | } |
| 1045 | 996 | ||
| 1046 | void pthreads_locking_callback(mode,type,file,line) | 997 | void pthreads_locking_callback(int mode, int type, char *file, |
| 1047 | int mode; | 998 | int line) |
| 1048 | int type; | ||
| 1049 | char *file; | ||
| 1050 | int line; | ||
| 1051 | { | 999 | { |
| 1052 | #ifdef undef | 1000 | #ifdef undef |
| 1053 | fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n", | 1001 | fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n", |
| @@ -1072,8 +1020,7 @@ int line; | |||
| 1072 | } | 1020 | } |
| 1073 | } | 1021 | } |
| 1074 | 1022 | ||
| 1075 | void do_threads(s_ctx,c_ctx) | 1023 | void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx) |
| 1076 | SSL_CTX *s_ctx,*c_ctx; | ||
| 1077 | { | 1024 | { |
| 1078 | SSL_CTX *ssl_ctx[2]; | 1025 | SSL_CTX *ssl_ctx[2]; |
| 1079 | pthread_t thread_ctx[MAX_THREAD_NUMBER]; | 1026 | pthread_t thread_ctx[MAX_THREAD_NUMBER]; |
| @@ -1101,7 +1048,7 @@ SSL_CTX *s_ctx,*c_ctx; | |||
| 1101 | s_ctx->references,c_ctx->references); | 1048 | s_ctx->references,c_ctx->references); |
| 1102 | } | 1049 | } |
| 1103 | 1050 | ||
| 1104 | unsigned long pthreads_thread_id() | 1051 | unsigned long pthreads_thread_id(void) |
| 1105 | { | 1052 | { |
| 1106 | unsigned long ret; | 1053 | unsigned long ret; |
| 1107 | 1054 | ||
