X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=crypto%2Ferr%2Ferr.c;h=fcdb244008f66d0f8ca10e2947092307b82e2003;hp=66d4da85560c38eb8c3f0de03b8b65b8a48874d7;hb=78c45722960510f63f9ee151959ea2f63fac7ba3;hpb=3c1d6bbc9242900af0e5db927fdcda38539bd54a diff --git a/crypto/err/err.c b/crypto/err/err.c index 66d4da8556..fcdb244008 100644 --- a/crypto/err/err.c +++ b/crypto/err/err.c @@ -153,8 +153,9 @@ static ERR_STRING_DATA ERR_str_libraries[]= {ERR_PACK(ERR_LIB_TS,0,0) ,"time stamp routines"}, {ERR_PACK(ERR_LIB_ENGINE,0,0) ,"engine routines"}, {ERR_PACK(ERR_LIB_OCSP,0,0) ,"OCSP routines"}, -{ERR_PACK(ERR_LIB_HMAC,0,0) ,"HMAC routines"}, +{ERR_PACK(ERR_LIB_FIPS,0,0) ,"FIPS routines"}, {ERR_PACK(ERR_LIB_CMS,0,0) ,"CMS routines"}, +{ERR_PACK(ERR_LIB_HMAC,0,0) ,"HMAC routines"}, {0,NULL}, }; @@ -337,14 +338,14 @@ static unsigned long err_string_data_hash(const ERR_STRING_DATA *a) ret=l^ERR_GET_LIB(l)^ERR_GET_FUNC(l); return(ret^ret%19*13); } -static IMPLEMENT_LHASH_HASH_FN(err_string_data, ERR_STRING_DATA); +static IMPLEMENT_LHASH_HASH_FN(err_string_data, ERR_STRING_DATA) static int err_string_data_cmp(const ERR_STRING_DATA *a, const ERR_STRING_DATA *b) { return (int)(a->error - b->error); } -static IMPLEMENT_LHASH_COMP_FN(err_string_data, ERR_STRING_DATA); +static IMPLEMENT_LHASH_COMP_FN(err_string_data, ERR_STRING_DATA) static LHASH_OF(ERR_STRING_DATA) *int_err_get(int create) { @@ -428,15 +429,15 @@ static ERR_STRING_DATA *int_err_del_item(ERR_STRING_DATA *d) static unsigned long err_state_hash(const ERR_STATE *a) { - return CRYPTO_THREADID_hash(&a->tid); + return CRYPTO_THREADID_hash(&a->tid) * 13; } -static IMPLEMENT_LHASH_HASH_FN(err_state, ERR_STATE); +static IMPLEMENT_LHASH_HASH_FN(err_state, ERR_STATE) static int err_state_cmp(const ERR_STATE *a, const ERR_STATE *b) { return CRYPTO_THREADID_cmp(&a->tid, &b->tid); } -static IMPLEMENT_LHASH_COMP_FN(err_state, ERR_STATE); +static IMPLEMENT_LHASH_COMP_FN(err_state, ERR_STATE) static LHASH_OF(ERR_STATE) *int_thread_get(int create) { @@ -979,14 +980,14 @@ const char *ERR_reason_error_string(unsigned long e) return((p == NULL)?NULL:p->string); } -void ERR_remove_thread_state(CRYPTO_THREADID *tid) +void ERR_remove_thread_state(const CRYPTO_THREADID *id) { ERR_STATE tmp; - if (tid) - CRYPTO_THREADID_cpy(&tmp.tid, tid); + if (id) + CRYPTO_THREADID_cpy(&tmp.tid, id); else - CRYPTO_THREADID_set(&tmp.tid); + CRYPTO_THREADID_current(&tmp.tid); err_fns_check(); /* thread_del_item automatically destroys the LHASH if the number of * items reaches zero. */ @@ -1003,12 +1004,12 @@ void ERR_remove_state(unsigned long pid) ERR_STATE *ERR_get_state(void) { static ERR_STATE fallback; - CRYPTO_THREADID tid; ERR_STATE *ret,tmp,*tmpp=NULL; int i; + CRYPTO_THREADID tid; err_fns_check(); - CRYPTO_THREADID_set(&tid); + CRYPTO_THREADID_current(&tid); CRYPTO_THREADID_cpy(&tmp.tid, &tid); ret=ERRFN(thread_get_item)(&tmp); @@ -1065,6 +1066,13 @@ void ERR_set_error_data(char *data, int flags) void ERR_add_error_data(int num, ...) { va_list args; + va_start(args, num); + ERR_add_error_vdata(num, args); + va_end(args); + } + +void ERR_add_error_vdata(int num, va_list args) + { int i,n,s; char *str,*p,*a; @@ -1073,7 +1081,6 @@ void ERR_add_error_data(int num, ...) if (str == NULL) return; str[0]='\0'; - va_start(args, num); n=0; for (i=0; i