summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dh/dh_err.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/dh/dh_err.c (renamed from src/lib/libcrypto/engine/hw_atalla_err.c)104
1 files changed, 38 insertions, 66 deletions
diff --git a/src/lib/libcrypto/engine/hw_atalla_err.c b/src/lib/libcrypto/dh/dh_err.c
index 1df9c4570c..d5cf0c22a3 100644
--- a/src/lib/libcrypto/engine/hw_atalla_err.c
+++ b/src/lib/libcrypto/dh/dh_err.c
@@ -1,6 +1,6 @@
1/* hw_atalla_err.c */ 1/* crypto/dh/dh_err.c */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999-2006 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,86 +60,58 @@
60 60
61#include <stdio.h> 61#include <stdio.h>
62#include <openssl/err.h> 62#include <openssl/err.h>
63#include "hw_atalla_err.h" 63#include <openssl/dh.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 ATALLA_str_functs[]= 67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_DH,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_DH,0,reason)
70
71static ERR_STRING_DATA DH_str_functs[]=
68 { 72 {
69{ERR_PACK(0,ATALLA_F_ATALLA_CTRL,0), "ATALLA_CTRL"}, 73{ERR_FUNC(DH_F_COMPUTE_KEY), "COMPUTE_KEY"},
70{ERR_PACK(0,ATALLA_F_ATALLA_FINISH,0), "ATALLA_FINISH"}, 74{ERR_FUNC(DH_F_DHPARAMS_PRINT_FP), "DHparams_print_fp"},
71{ERR_PACK(0,ATALLA_F_ATALLA_INIT,0), "ATALLA_INIT"}, 75{ERR_FUNC(DH_F_DH_BUILTIN_GENPARAMS), "DH_BUILTIN_GENPARAMS"},
72{ERR_PACK(0,ATALLA_F_ATALLA_MOD_EXP,0), "ATALLA_MOD_EXP"}, 76{ERR_FUNC(DH_F_DH_NEW_METHOD), "DH_new_method"},
73{ERR_PACK(0,ATALLA_F_ATALLA_RSA_MOD_EXP,0), "ATALLA_RSA_MOD_EXP"}, 77{ERR_FUNC(DH_F_DH_PARAM_DECODE), "DH_PARAM_DECODE"},
78{ERR_FUNC(DH_F_DH_PRIV_DECODE), "DH_PRIV_DECODE"},
79{ERR_FUNC(DH_F_DH_PRIV_ENCODE), "DH_PRIV_ENCODE"},
80{ERR_FUNC(DH_F_DH_PUB_DECODE), "DH_PUB_DECODE"},
81{ERR_FUNC(DH_F_DH_PUB_ENCODE), "DH_PUB_ENCODE"},
82{ERR_FUNC(DH_F_DO_DH_PRINT), "DO_DH_PRINT"},
83{ERR_FUNC(DH_F_GENERATE_KEY), "GENERATE_KEY"},
84{ERR_FUNC(DH_F_GENERATE_PARAMETERS), "GENERATE_PARAMETERS"},
85{ERR_FUNC(DH_F_PKEY_DH_DERIVE), "PKEY_DH_DERIVE"},
86{ERR_FUNC(DH_F_PKEY_DH_KEYGEN), "PKEY_DH_KEYGEN"},
74{0,NULL} 87{0,NULL}
75 }; 88 };
76 89
77static ERR_STRING_DATA ATALLA_str_reasons[]= 90static ERR_STRING_DATA DH_str_reasons[]=
78 { 91 {
79{ATALLA_R_ALREADY_LOADED ,"already loaded"}, 92{ERR_REASON(DH_R_BAD_GENERATOR) ,"bad generator"},
80{ATALLA_R_BN_CTX_FULL ,"bn ctx full"}, 93{ERR_REASON(DH_R_BN_DECODE_ERROR) ,"bn decode error"},
81{ATALLA_R_BN_EXPAND_FAIL ,"bn expand fail"}, 94{ERR_REASON(DH_R_BN_ERROR) ,"bn error"},
82{ATALLA_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctrl command not implemented"}, 95{ERR_REASON(DH_R_DECODE_ERROR) ,"decode error"},
83{ATALLA_R_MISSING_KEY_COMPONENTS ,"missing key components"}, 96{ERR_REASON(DH_R_INVALID_PUBKEY) ,"invalid public key"},
84{ATALLA_R_NOT_LOADED ,"not loaded"}, 97{ERR_REASON(DH_R_KEYS_NOT_SET) ,"keys not set"},
85{ATALLA_R_REQUEST_FAILED ,"request failed"}, 98{ERR_REASON(DH_R_MODULUS_TOO_LARGE) ,"modulus too large"},
86{ATALLA_R_UNIT_FAILURE ,"unit failure"}, 99{ERR_REASON(DH_R_NO_PARAMETERS_SET) ,"no parameters set"},
100{ERR_REASON(DH_R_NO_PRIVATE_VALUE) ,"no private value"},
101{ERR_REASON(DH_R_PARAMETER_ENCODING_ERROR),"parameter encoding error"},
87{0,NULL} 102{0,NULL}
88 }; 103 };
89 104
90#endif 105#endif
91 106
92#ifdef ATALLA_LIB_NAME 107void ERR_load_DH_strings(void)
93static ERR_STRING_DATA ATALLA_lib_name[]=
94 {
95{0 ,ATALLA_LIB_NAME},
96{0,NULL}
97 };
98#endif
99
100
101static int ATALLA_lib_error_code=0;
102static int ATALLA_error_init=1;
103
104static void ERR_load_ATALLA_strings(void)
105 { 108 {
106 if (ATALLA_lib_error_code == 0)
107 ATALLA_lib_error_code=ERR_get_next_error_library();
108
109 if (ATALLA_error_init)
110 {
111 ATALLA_error_init=0;
112#ifndef OPENSSL_NO_ERR 109#ifndef OPENSSL_NO_ERR
113 ERR_load_strings(ATALLA_lib_error_code,ATALLA_str_functs);
114 ERR_load_strings(ATALLA_lib_error_code,ATALLA_str_reasons);
115#endif
116
117#ifdef ATALLA_LIB_NAME
118 ATALLA_lib_name->error = ERR_PACK(ATALLA_lib_error_code,0,0);
119 ERR_load_strings(0,ATALLA_lib_name);
120#endif
121 }
122 }
123 110
124static void ERR_unload_ATALLA_strings(void) 111 if (ERR_func_error_string(DH_str_functs[0].error) == NULL)
125 {
126 if (ATALLA_error_init == 0)
127 { 112 {
128#ifndef OPENSSL_NO_ERR 113 ERR_load_strings(0,DH_str_functs);
129 ERR_unload_strings(ATALLA_lib_error_code,ATALLA_str_functs); 114 ERR_load_strings(0,DH_str_reasons);
130 ERR_unload_strings(ATALLA_lib_error_code,ATALLA_str_reasons);
131#endif
132
133#ifdef ATALLA_LIB_NAME
134 ERR_unload_strings(0,ATALLA_lib_name);
135#endif
136 ATALLA_error_init=1;
137 } 115 }
138 } 116#endif
139
140static void ERR_ATALLA_error(int function, int reason, char *file, int line)
141 {
142 if (ATALLA_lib_error_code == 0)
143 ATALLA_lib_error_code=ERR_get_next_error_library();
144 ERR_PUT_error(ATALLA_lib_error_code,function,reason,file,line);
145 } 117 }