summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dsa/dsa_err.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/dsa/dsa_err.c (renamed from src/lib/libcrypto/engine/hw_cswift_err.c)121
1 files changed, 51 insertions, 70 deletions
diff --git a/src/lib/libcrypto/engine/hw_cswift_err.c b/src/lib/libcrypto/dsa/dsa_err.c
index 684f53bf27..00545b7b9f 100644
--- a/src/lib/libcrypto/engine/hw_cswift_err.c
+++ b/src/lib/libcrypto/dsa/dsa_err.c
@@ -1,6 +1,6 @@
1/* hw_cswift_err.c */ 1/* crypto/dsa/dsa_err.c */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
@@ -60,90 +60,71 @@
60 60
61#include <stdio.h> 61#include <stdio.h>
62#include <openssl/err.h> 62#include <openssl/err.h>
63#include "hw_cswift_err.h" 63#include <openssl/dsa.h>
64 64
65/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR 66#ifndef OPENSSL_NO_ERR
67static ERR_STRING_DATA CSWIFT_str_functs[]= 67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_DSA,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_DSA,0,reason)
70
71static ERR_STRING_DATA DSA_str_functs[]=
68 { 72 {
69{ERR_PACK(0,CSWIFT_F_CSWIFT_CTRL,0), "CSWIFT_CTRL"}, 73{ERR_FUNC(DSA_F_D2I_DSA_SIG), "d2i_DSA_SIG"},
70{ERR_PACK(0,CSWIFT_F_CSWIFT_DSA_SIGN,0), "CSWIFT_DSA_SIGN"}, 74{ERR_FUNC(DSA_F_DO_DSA_PRINT), "DO_DSA_PRINT"},
71{ERR_PACK(0,CSWIFT_F_CSWIFT_DSA_VERIFY,0), "CSWIFT_DSA_VERIFY"}, 75{ERR_FUNC(DSA_F_DSAPARAMS_PRINT), "DSAparams_print"},
72{ERR_PACK(0,CSWIFT_F_CSWIFT_FINISH,0), "CSWIFT_FINISH"}, 76{ERR_FUNC(DSA_F_DSAPARAMS_PRINT_FP), "DSAparams_print_fp"},
73{ERR_PACK(0,CSWIFT_F_CSWIFT_INIT,0), "CSWIFT_INIT"}, 77{ERR_FUNC(DSA_F_DSA_DO_SIGN), "DSA_do_sign"},
74{ERR_PACK(0,CSWIFT_F_CSWIFT_MOD_EXP,0), "CSWIFT_MOD_EXP"}, 78{ERR_FUNC(DSA_F_DSA_DO_VERIFY), "DSA_do_verify"},
75{ERR_PACK(0,CSWIFT_F_CSWIFT_MOD_EXP_CRT,0), "CSWIFT_MOD_EXP_CRT"}, 79{ERR_FUNC(DSA_F_DSA_GENERATE_KEY), "DSA_generate_key"},
76{ERR_PACK(0,CSWIFT_F_CSWIFT_RSA_MOD_EXP,0), "CSWIFT_RSA_MOD_EXP"}, 80{ERR_FUNC(DSA_F_DSA_GENERATE_PARAMETERS_EX), "DSA_generate_parameters_ex"},
81{ERR_FUNC(DSA_F_DSA_NEW_METHOD), "DSA_new_method"},
82{ERR_FUNC(DSA_F_DSA_PARAM_DECODE), "DSA_PARAM_DECODE"},
83{ERR_FUNC(DSA_F_DSA_PRINT_FP), "DSA_print_fp"},
84{ERR_FUNC(DSA_F_DSA_PRIV_DECODE), "DSA_PRIV_DECODE"},
85{ERR_FUNC(DSA_F_DSA_PRIV_ENCODE), "DSA_PRIV_ENCODE"},
86{ERR_FUNC(DSA_F_DSA_PUB_DECODE), "DSA_PUB_DECODE"},
87{ERR_FUNC(DSA_F_DSA_PUB_ENCODE), "DSA_PUB_ENCODE"},
88{ERR_FUNC(DSA_F_DSA_SIGN), "DSA_sign"},
89{ERR_FUNC(DSA_F_DSA_SIGN_SETUP), "DSA_sign_setup"},
90{ERR_FUNC(DSA_F_DSA_SIG_NEW), "DSA_SIG_new"},
91{ERR_FUNC(DSA_F_DSA_SIG_PRINT), "DSA_SIG_PRINT"},
92{ERR_FUNC(DSA_F_DSA_VERIFY), "DSA_verify"},
93{ERR_FUNC(DSA_F_I2D_DSA_SIG), "i2d_DSA_SIG"},
94{ERR_FUNC(DSA_F_OLD_DSA_PRIV_DECODE), "OLD_DSA_PRIV_DECODE"},
95{ERR_FUNC(DSA_F_PKEY_DSA_CTRL), "PKEY_DSA_CTRL"},
96{ERR_FUNC(DSA_F_PKEY_DSA_KEYGEN), "PKEY_DSA_KEYGEN"},
97{ERR_FUNC(DSA_F_SIG_CB), "SIG_CB"},
77{0,NULL} 98{0,NULL}
78 }; 99 };
79 100
80static ERR_STRING_DATA CSWIFT_str_reasons[]= 101static ERR_STRING_DATA DSA_str_reasons[]=
81 { 102 {
82{CSWIFT_R_ALREADY_LOADED ,"already loaded"}, 103{ERR_REASON(DSA_R_BAD_Q_VALUE) ,"bad q value"},
83{CSWIFT_R_BAD_KEY_SIZE ,"bad key size"}, 104{ERR_REASON(DSA_R_BN_DECODE_ERROR) ,"bn decode error"},
84{CSWIFT_R_BN_CTX_FULL ,"bn ctx full"}, 105{ERR_REASON(DSA_R_BN_ERROR) ,"bn error"},
85{CSWIFT_R_BN_EXPAND_FAIL ,"bn expand fail"}, 106{ERR_REASON(DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE),"data too large for key size"},
86{CSWIFT_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctrl command not implemented"}, 107{ERR_REASON(DSA_R_DECODE_ERROR) ,"decode error"},
87{CSWIFT_R_MISSING_KEY_COMPONENTS ,"missing key components"}, 108{ERR_REASON(DSA_R_INVALID_DIGEST_TYPE) ,"invalid digest type"},
88{CSWIFT_R_NOT_LOADED ,"not loaded"}, 109{ERR_REASON(DSA_R_MISSING_PARAMETERS) ,"missing parameters"},
89{CSWIFT_R_REQUEST_FAILED ,"request failed"}, 110{ERR_REASON(DSA_R_MODULUS_TOO_LARGE) ,"modulus too large"},
90{CSWIFT_R_UNIT_FAILURE ,"unit failure"}, 111{ERR_REASON(DSA_R_NEED_NEW_SETUP_VALUES) ,"need new setup values"},
112{ERR_REASON(DSA_R_NON_FIPS_DSA_METHOD) ,"non fips dsa method"},
113{ERR_REASON(DSA_R_NO_PARAMETERS_SET) ,"no parameters set"},
114{ERR_REASON(DSA_R_PARAMETER_ENCODING_ERROR),"parameter encoding error"},
91{0,NULL} 115{0,NULL}
92 }; 116 };
93 117
94#endif 118#endif
95 119
96#ifdef CSWIFT_LIB_NAME 120void ERR_load_DSA_strings(void)
97static ERR_STRING_DATA CSWIFT_lib_name[]=
98 {
99{0 ,CSWIFT_LIB_NAME},
100{0,NULL}
101 };
102#endif
103
104
105static int CSWIFT_lib_error_code=0;
106static int CSWIFT_error_init=1;
107
108static void ERR_load_CSWIFT_strings(void)
109 { 121 {
110 if (CSWIFT_lib_error_code == 0)
111 CSWIFT_lib_error_code=ERR_get_next_error_library();
112
113 if (CSWIFT_error_init)
114 {
115 CSWIFT_error_init=0;
116#ifndef OPENSSL_NO_ERR 122#ifndef OPENSSL_NO_ERR
117 ERR_load_strings(CSWIFT_lib_error_code,CSWIFT_str_functs);
118 ERR_load_strings(CSWIFT_lib_error_code,CSWIFT_str_reasons);
119#endif
120
121#ifdef CSWIFT_LIB_NAME
122 CSWIFT_lib_name->error = ERR_PACK(CSWIFT_lib_error_code,0,0);
123 ERR_load_strings(0,CSWIFT_lib_name);
124#endif
125 }
126 }
127 123
128static void ERR_unload_CSWIFT_strings(void) 124 if (ERR_func_error_string(DSA_str_functs[0].error) == NULL)
129 {
130 if (CSWIFT_error_init == 0)
131 { 125 {
132#ifndef OPENSSL_NO_ERR 126 ERR_load_strings(0,DSA_str_functs);
133 ERR_unload_strings(CSWIFT_lib_error_code,CSWIFT_str_functs); 127 ERR_load_strings(0,DSA_str_reasons);
134 ERR_unload_strings(CSWIFT_lib_error_code,CSWIFT_str_reasons);
135#endif
136
137#ifdef CSWIFT_LIB_NAME
138 ERR_unload_strings(0,CSWIFT_lib_name);
139#endif
140 CSWIFT_error_init=1;
141 } 128 }
142 } 129#endif
143
144static void ERR_CSWIFT_error(int function, int reason, char *file, int line)
145 {
146 if (CSWIFT_lib_error_code == 0)
147 CSWIFT_lib_error_code=ERR_get_next_error_library();
148 ERR_PUT_error(CSWIFT_lib_error_code,function,reason,file,line);
149 } 130 }