Add functions to set ECDSA_METHOD structure.
[openssl.git] / crypto / err / err.c
index b96e6756183fd020d545638d997e1b71b4eb5f10..3492950b59be3e05bc1d5c82594b22265f0b2a16 100644 (file)
  *
  */
 
+#define OPENSSL_NO_FIPS_ERR
+
 #include <stdio.h>
 #include <stdarg.h>
 #include <string.h>
@@ -143,6 +145,8 @@ static ERR_STRING_DATA ERR_str_libraries[]=
 {ERR_PACK(ERR_LIB_CONF,0,0)            ,"configuration file routines"},
 {ERR_PACK(ERR_LIB_CRYPTO,0,0)          ,"common libcrypto routines"},
 {ERR_PACK(ERR_LIB_EC,0,0)              ,"elliptic curve routines"},
+{ERR_PACK(ERR_LIB_ECDSA,0,0)           ,"ECDSA routines"},
+{ERR_PACK(ERR_LIB_ECDH,0,0)            ,"ECDH routines"},
 {ERR_PACK(ERR_LIB_SSL,0,0)             ,"SSL routines"},
 {ERR_PACK(ERR_LIB_BIO,0,0)             ,"BIO routines"},
 {ERR_PACK(ERR_LIB_PKCS7,0,0)           ,"PKCS7 routines"},
@@ -203,6 +207,7 @@ static ERR_STRING_DATA ERR_str_reasons[]=
 {ERR_R_ENGINE_LIB                      ,"ENGINE lib"},
 {ERR_R_OCSP_LIB                                ,"OCSP lib"},
 {ERR_R_TS_LIB                          ,"TS lib"},
+{ERR_R_ECDSA_LIB                       ,"ECDSA lib"},
 
 {ERR_R_NESTED_ASN1_ERROR               ,"nested asn1 error"},
 {ERR_R_BAD_ASN1_OBJECT_HEADER          ,"bad asn1 object header"},
@@ -429,7 +434,7 @@ 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)
 
@@ -980,14 +985,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. */
@@ -1004,12 +1009,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);
 
@@ -1033,7 +1038,7 @@ ERR_STATE *ERR_get_state(void)
                        ERR_STATE_free(ret); /* could not insert it */
                        return(&fallback);
                        }
-               /* If a race occured in this function and we came second, tmpp
+               /* If a race occurred in this function and we came second, tmpp
                 * is the first one that we just replaced. */
                if (tmpp)
                        ERR_STATE_free(tmpp);
@@ -1066,6 +1071,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;
 
@@ -1074,7 +1086,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<num; i++)
                {
@@ -1090,7 +1101,7 @@ void ERR_add_error_data(int num, ...)
                                if (p == NULL)
                                        {
                                        OPENSSL_free(str);
-                                       goto err;
+                                       return;
                                        }
                                else
                                        str=p;
@@ -1099,9 +1110,6 @@ void ERR_add_error_data(int num, ...)
                        }
                }
        ERR_set_error_data(str,ERR_TXT_MALLOCED|ERR_TXT_STRING);
-
-err:
-       va_end(args);
        }
 
 int ERR_set_mark(void)