提交 e083f914 编写于 作者: R Richard Levitte

Because AEP and we used the same AEP_R_ prefix for error reasons,

lets change our prefix to AEPHK_R_.  Otherwise, we get very mysterious
errors because we happen to redefine AEP_R_OK and AEP_R_GENERAL_ERROR.
上级 ba2cad19
L AEP hw_aep_err.h hw_aep_err.c
L AEPHK hw_aep_err.h hw_aep_err.c
L ATALLA hw_atalla_err.h hw_atalla_err.c
L CSWIFT hw_cswift_err.h hw_cswift_err.c
L HWCRHK hw_ncipher_err.h hw_ncipher_err.c
......
......@@ -307,7 +307,7 @@ static int bind_aep(ENGINE *e)
#endif
/* Ensure the aep error handling is set up */
ERR_load_AEP_strings();
ERR_load_AEPHK_strings();
return 1;
}
......@@ -399,10 +399,11 @@ static int aep_init(ENGINE *e)
t_AEP_CloseConnection *p8;
int to_return = 0;
AEP_RV rv;
if(aep_dso != NULL)
{
AEPerr(AEP_F_AEP_INIT,AEP_R_ALREADY_LOADED);
AEPHKerr(AEPHK_F_AEP_INIT,AEPHK_R_ALREADY_LOADED);
goto err;
}
/* Attempt to load libaep.so. */
......@@ -411,7 +412,7 @@ static int aep_init(ENGINE *e)
if(aep_dso == NULL)
{
AEPerr(AEP_F_AEP_INIT,AEP_R_NOT_LOADED);
AEPHKerr(AEPHK_F_AEP_INIT,AEPHK_R_NOT_LOADED);
goto err;
}
......@@ -426,7 +427,7 @@ static int aep_init(ENGINE *e)
!(p7 = (t_AEP_SetBNCallBacks*) DSO_bind_func( aep_dso,AEP_F7)) ||
!(p8 = (t_AEP_CloseConnection*) DSO_bind_func( aep_dso,AEP_F8)))
{
AEPerr(AEP_F_AEP_INIT,AEP_R_NOT_LOADED);
AEPHKerr(AEPHK_F_AEP_INIT,AEPHK_R_NOT_LOADED);
goto err;
}
......@@ -469,7 +470,7 @@ static int aep_init(ENGINE *e)
/* Destructor (complements the "ENGINE_aep()" constructor) */
static int aep_destroy(ENGINE *e)
{
ERR_unload_AEP_strings();
ERR_unload_AEPHK_strings();
return 1;
}
......@@ -480,32 +481,32 @@ static int aep_finish(ENGINE *e)
if(aep_dso == NULL)
{
AEPerr(AEP_F_AEP_FINISH,AEP_R_NOT_LOADED);
AEPHKerr(AEPHK_F_AEP_FINISH,AEPHK_R_NOT_LOADED);
goto err;
}
rv = aep_close_all_connections(0, &in_use);
if (rv != AEP_R_OK)
{
AEPerr(AEP_F_AEP_FINISH,AEP_R_CLOSE_HANDLES_FAILED);
AEPHKerr(AEPHK_F_AEP_FINISH,AEPHK_R_CLOSE_HANDLES_FAILED);
goto err;
}
if (in_use)
{
AEPerr(AEP_F_AEP_FINISH,AEP_R_CONNECTIONS_IN_USE);
AEPHKerr(AEPHK_F_AEP_FINISH,AEPHK_R_CONNECTIONS_IN_USE);
goto err;
}
rv = p_AEP_Finalize();
if (rv != AEP_R_OK)
{
AEPerr(AEP_F_AEP_FINISH,AEP_R_FINALIZE_FAILED);
AEPHKerr(AEPHK_F_AEP_FINISH,AEPHK_R_FINALIZE_FAILED);
goto err;
}
if(!DSO_free(aep_dso))
{
AEPerr(AEP_F_AEP_FINISH,AEP_R_UNIT_FAILURE);
AEPHKerr(AEPHK_F_AEP_FINISH,AEPHK_R_UNIT_FAILURE);
goto err;
}
......@@ -534,14 +535,14 @@ static int aep_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)())
case AEP_CMD_SO_PATH:
if(p == NULL)
{
AEPerr(AEP_F_AEP_CTRL,
AEPHKerr(AEPHK_F_AEP_CTRL,
ERR_R_PASSED_NULL_PARAMETER);
return 0;
}
if(initialised)
{
AEPerr(AEP_F_AEP_CTRL,
AEP_R_ALREADY_LOADED);
AEPHKerr(AEPHK_F_AEP_CTRL,
AEPHK_R_ALREADY_LOADED);
return 0;
}
AEP_LIBNAME = (const char *)p;
......@@ -549,7 +550,7 @@ static int aep_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)())
default:
break;
}
AEPerr(AEP_F_AEP_CTRL,AEP_R_CTRL_COMMAND_NOT_IMPLEMENTED);
AEPHKerr(AEPHK_F_AEP_CTRL,AEPHK_R_CTRL_COMMAND_NOT_IMPLEMENTED);
return 0;
}
......@@ -564,7 +565,7 @@ static int aep_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
rv = aep_get_connection(&hConnection);
if (rv != AEP_R_OK)
{
AEPerr(AEP_F_AEP_MOD_EXP,AEP_R_GET_HANDLE_FAILED);
AEPHKerr(AEPHK_F_AEP_MOD_EXP,AEPHK_R_GET_HANDLE_FAILED);
goto err;
}
......@@ -573,7 +574,7 @@ static int aep_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
if (rv != AEP_R_OK)
{
AEPerr(AEP_F_AEP_MOD_EXP,AEP_R_MOD_EXP_FAILED);
AEPHKerr(AEPHK_F_AEP_MOD_EXP,AEPHK_R_MOD_EXP_FAILED);
rv = aep_return_connection(hConnection);
goto err;
}
......@@ -582,7 +583,7 @@ static int aep_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
rv = aep_return_connection(hConnection);
if (rv != AEP_R_OK)
{
AEPerr(AEP_F_AEP_RAND,AEP_R_RETURN_CONNECTION_FAILED);
AEPHKerr(AEPHK_F_AEP_RAND,AEPHK_R_RETURN_CONNECTION_FAILED);
goto err;
}
......@@ -602,7 +603,7 @@ static AEP_RV aep_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
rv = aep_get_connection(&hConnection);
if (rv != AEP_R_OK)
{
AEPerr(AEP_F_AEP_MOD_EXP_CRT,AEP_R_GET_HANDLE_FAILED);
AEPHKerr(AEPHK_F_AEP_MOD_EXP_CRT,AEPHK_R_GET_HANDLE_FAILED);
goto err;
}
......@@ -611,7 +612,7 @@ static AEP_RV aep_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
(void*)iqmp,(void*)r,NULL);
if (rv != AEP_R_OK)
{
AEPerr(AEP_F_AEP_MOD_EXP_CRT,AEP_R_MOD_EXP_CRT_FAILED);
AEPHKerr(AEPHK_F_AEP_MOD_EXP_CRT,AEPHK_R_MOD_EXP_CRT_FAILED);
rv = aep_return_connection(hConnection);
goto err;
}
......@@ -620,7 +621,7 @@ static AEP_RV aep_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
rv = aep_return_connection(hConnection);
if (rv != AEP_R_OK)
{
AEPerr(AEP_F_AEP_RAND,AEP_R_RETURN_CONNECTION_FAILED);
AEPHKerr(AEPHK_F_AEP_RAND,AEPHK_R_RETURN_CONNECTION_FAILED);
goto err;
}
......@@ -655,7 +656,7 @@ static int aep_rand(unsigned char *buf,int len )
rv = aep_get_connection(&hConnection);
if (rv != AEP_R_OK)
{
AEPerr(AEP_F_AEP_RAND,AEP_R_GET_HANDLE_FAILED);
AEPHKerr(AEPHK_F_AEP_RAND,AEPHK_R_GET_HANDLE_FAILED);
goto err_nounlock;
}
......@@ -664,7 +665,7 @@ static int aep_rand(unsigned char *buf,int len )
rv = p_AEP_GenRandom(hConnection, len, 2, buf, NULL);
if (rv != AEP_R_OK)
{
AEPerr(AEP_F_AEP_RAND,AEP_R_GET_RANDOM_FAILED);
AEPHKerr(AEPHK_F_AEP_RAND,AEPHK_R_GET_RANDOM_FAILED);
goto err_nounlock;
}
}
......@@ -675,7 +676,7 @@ static int aep_rand(unsigned char *buf,int len )
rv = p_AEP_GenRandom(hConnection, RAND_BLK_SIZE, 2, &rand_block[0], NULL);
if (rv != AEP_R_OK)
{
AEPerr(AEP_F_AEP_RAND,AEP_R_GET_RANDOM_FAILED);
AEPHKerr(AEPHK_F_AEP_RAND,AEPHK_R_GET_RANDOM_FAILED);
goto err;
}
......@@ -691,7 +692,7 @@ static int aep_rand(unsigned char *buf,int len )
rv = aep_return_connection(hConnection);
if (rv != AEP_R_OK)
{
AEPerr(AEP_F_AEP_RAND,AEP_R_RETURN_CONNECTION_FAILED);
AEPHKerr(AEPHK_F_AEP_RAND,AEPHK_R_RETURN_CONNECTION_FAILED);
goto err_nounlock;
}
......@@ -722,7 +723,7 @@ static int aep_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
if (!aep_dso)
{
AEPerr(AEP_F_AEP_RSA_MOD_EXP,AEP_R_NOT_LOADED);
AEPHKerr(AEPHK_F_AEP_RSA_MOD_EXP,AEPHK_R_NOT_LOADED);
goto err;
}
......@@ -737,7 +738,7 @@ static int aep_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
{
if (!rsa->d || !rsa->n)
{
AEPerr(AEP_F_AEP_RSA_MOD_EXP,AEP_R_MISSING_KEY_COMPONENTS);
AEPHKerr(AEPHK_F_AEP_RSA_MOD_EXP,AEPHK_R_MISSING_KEY_COMPONENTS);
goto err;
}
......@@ -830,7 +831,7 @@ static AEP_RV aep_get_connection(AEP_CONNECTION_HNDL_PTR phConnection)
if (rv != AEP_R_OK)
{
AEPerr(AEP_F_AEP_INIT,AEP_R_INIT_FAILURE);
AEPHKerr(AEPHK_F_AEP_GET_CONNECTION,AEPHK_R_INIT_FAILURE);
recorded_pid = 0;
goto end;
}
......@@ -841,7 +842,7 @@ static AEP_RV aep_get_connection(AEP_CONNECTION_HNDL_PTR phConnection)
if (rv != AEP_R_OK)
{
AEPerr(AEP_F_AEP_INIT,AEP_R_SETBNCALLBACK_FAILURE);
AEPHKerr(AEPHK_F_AEP_GET_CONNECTION,AEPHK_R_SETBNCALLBACK_FAILURE);
recorded_pid = 0;
goto end;
}
......@@ -863,7 +864,7 @@ static AEP_RV aep_get_connection(AEP_CONNECTION_HNDL_PTR phConnection)
if (rv != AEP_R_OK)
{
AEPerr(AEP_F_AEP_INIT,AEP_R_UNIT_FAILURE);
AEPHKerr(AEPHK_F_AEP_GET_CONNECTION,AEPHK_R_UNIT_FAILURE);
recorded_pid = 0;
goto end;
}
......@@ -893,7 +894,7 @@ static AEP_RV aep_get_connection(AEP_CONNECTION_HNDL_PTR phConnection)
if (rv != AEP_R_OK)
{
AEPerr(AEP_F_AEP_INIT,AEP_R_UNIT_FAILURE);
AEPHKerr(AEPHK_F_AEP_GET_CONNECTION,AEPHK_R_UNIT_FAILURE);
goto end;
}
......
......@@ -64,93 +64,93 @@
/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR
static ERR_STRING_DATA AEP_str_functs[]=
static ERR_STRING_DATA AEPHK_str_functs[]=
{
{ERR_PACK(0,AEP_F_AEP_CTRL,0), "AEP_CTRL"},
{ERR_PACK(0,AEP_F_AEP_FINISH,0), "AEP_FINISH"},
{ERR_PACK(0,AEP_F_AEP_INIT,0), "AEP_INIT"},
{ERR_PACK(0,AEP_F_AEP_MOD_EXP,0), "AEP_MOD_EXP"},
{ERR_PACK(0,AEP_F_AEP_MOD_EXP_CRT,0), "AEP_MOD_EXP_CRT"},
{ERR_PACK(0,AEP_F_AEP_RAND,0), "AEP_RAND"},
{ERR_PACK(0,AEP_F_AEP_RSA_MOD_EXP,0), "AEP_RSA_MOD_EXP"},
{ERR_PACK(0,AEPHK_F_AEP_CTRL,0), "AEP_CTRL"},
{ERR_PACK(0,AEPHK_F_AEP_FINISH,0), "AEP_FINISH"},
{ERR_PACK(0,AEPHK_F_AEP_GET_CONNECTION,0), "AEP_GET_CONNECTION"},
{ERR_PACK(0,AEPHK_F_AEP_INIT,0), "AEP_INIT"},
{ERR_PACK(0,AEPHK_F_AEP_MOD_EXP,0), "AEP_MOD_EXP"},
{ERR_PACK(0,AEPHK_F_AEP_MOD_EXP_CRT,0), "AEP_MOD_EXP_CRT"},
{ERR_PACK(0,AEPHK_F_AEP_RAND,0), "AEP_RAND"},
{ERR_PACK(0,AEPHK_F_AEP_RSA_MOD_EXP,0), "AEP_RSA_MOD_EXP"},
{0,NULL}
};
static ERR_STRING_DATA AEP_str_reasons[]=
static ERR_STRING_DATA AEPHK_str_reasons[]=
{
{AEP_R_ALREADY_LOADED ,"already loaded"},
{AEP_R_CLOSE_HANDLES_FAILED ,"close handles failed"},
{AEP_R_CONNECTIONS_IN_USE ,"connections in use"},
{AEP_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctrl command not implemented"},
{AEP_R_FINALIZE_FAILED ,"finalize failed"},
{AEP_R_GENERAL_ERROR ,"general error"},
{AEP_R_GET_HANDLE_FAILED ,"get handle failed"},
{AEP_R_GET_RANDOM_FAILED ,"get random failed"},
{AEP_R_INIT_FAILURE ,"init failure"},
{AEP_R_MISSING_KEY_COMPONENTS ,"missing key components"},
{AEP_R_MOD_EXP_CRT_FAILED ,"mod exp crt failed"},
{AEP_R_MOD_EXP_FAILED ,"mod exp failed"},
{AEP_R_NOT_LOADED ,"not loaded"},
{AEP_R_OK ,"ok"},
{AEP_R_RETURN_CONNECTION_FAILED ,"return connection failed"},
{AEP_R_SETBNCALLBACK_FAILURE ,"setbncallback failure"},
{AEP_R_UNIT_FAILURE ,"unit failure"},
{AEPHK_R_ALREADY_LOADED ,"already loaded"},
{AEPHK_R_CLOSE_HANDLES_FAILED ,"close handles failed"},
{AEPHK_R_CONNECTIONS_IN_USE ,"connections in use"},
{AEPHK_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctrl command not implemented"},
{AEPHK_R_FINALIZE_FAILED ,"finalize failed"},
{AEPHK_R_GET_HANDLE_FAILED ,"get handle failed"},
{AEPHK_R_GET_RANDOM_FAILED ,"get random failed"},
{AEPHK_R_INIT_FAILURE ,"init failure"},
{AEPHK_R_MISSING_KEY_COMPONENTS ,"missing key components"},
{AEPHK_R_MOD_EXP_CRT_FAILED ,"mod exp crt failed"},
{AEPHK_R_MOD_EXP_FAILED ,"mod exp failed"},
{AEPHK_R_NOT_LOADED ,"not loaded"},
{AEPHK_R_OK ,"ok"},
{AEPHK_R_RETURN_CONNECTION_FAILED ,"return connection failed"},
{AEPHK_R_SETBNCALLBACK_FAILURE ,"setbncallback failure"},
{AEPHK_R_UNIT_FAILURE ,"unit failure"},
{0,NULL}
};
#endif
#ifdef AEP_LIB_NAME
static ERR_STRING_DATA AEP_lib_name[]=
#ifdef AEPHK_LIB_NAME
static ERR_STRING_DATA AEPHK_lib_name[]=
{
{0 ,AEP_LIB_NAME},
{0 ,AEPHK_LIB_NAME},
{0,NULL}
};
#endif
static int AEP_lib_error_code=0;
static int AEP_error_init=1;
static int AEPHK_lib_error_code=0;
static int AEPHK_error_init=1;
static void ERR_load_AEP_strings(void)
static void ERR_load_AEPHK_strings(void)
{
if (AEP_lib_error_code == 0)
AEP_lib_error_code=ERR_get_next_error_library();
if (AEPHK_lib_error_code == 0)
AEPHK_lib_error_code=ERR_get_next_error_library();
if (AEP_error_init)
if (AEPHK_error_init)
{
AEP_error_init=0;
AEPHK_error_init=0;
#ifndef OPENSSL_NO_ERR
ERR_load_strings(AEP_lib_error_code,AEP_str_functs);
ERR_load_strings(AEP_lib_error_code,AEP_str_reasons);
ERR_load_strings(AEPHK_lib_error_code,AEPHK_str_functs);
ERR_load_strings(AEPHK_lib_error_code,AEPHK_str_reasons);
#endif
#ifdef AEP_LIB_NAME
AEP_lib_name->error = ERR_PACK(AEP_lib_error_code,0,0);
ERR_load_strings(0,AEP_lib_name);
#ifdef AEPHK_LIB_NAME
AEPHK_lib_name->error = ERR_PACK(AEPHK_lib_error_code,0,0);
ERR_load_strings(0,AEPHK_lib_name);
#endif
}
}
static void ERR_unload_AEP_strings(void)
static void ERR_unload_AEPHK_strings(void)
{
if (AEP_error_init == 0)
if (AEPHK_error_init == 0)
{
#ifndef OPENSSL_NO_ERR
ERR_unload_strings(AEP_lib_error_code,AEP_str_functs);
ERR_unload_strings(AEP_lib_error_code,AEP_str_reasons);
ERR_unload_strings(AEPHK_lib_error_code,AEPHK_str_functs);
ERR_unload_strings(AEPHK_lib_error_code,AEPHK_str_reasons);
#endif
#ifdef AEP_LIB_NAME
ERR_unload_strings(0,AEP_lib_name);
#ifdef AEPHK_LIB_NAME
ERR_unload_strings(0,AEPHK_lib_name);
#endif
AEP_error_init=1;
AEPHK_error_init=1;
}
}
static void ERR_AEP_error(int function, int reason, char *file, int line)
static void ERR_AEPHK_error(int function, int reason, char *file, int line)
{
if (AEP_lib_error_code == 0)
AEP_lib_error_code=ERR_get_next_error_library();
ERR_PUT_error(AEP_lib_error_code,function,reason,file,line);
if (AEPHK_lib_error_code == 0)
AEPHK_lib_error_code=ERR_get_next_error_library();
ERR_PUT_error(AEPHK_lib_error_code,function,reason,file,line);
}
......@@ -52,47 +52,47 @@
*
*/
#ifndef HEADER_AEP_ERR_H
#define HEADER_AEP_ERR_H
#ifndef HEADER_AEPHK_ERR_H
#define HEADER_AEPHK_ERR_H
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
* made after this point may be overwritten when the script is next run.
*/
static void ERR_load_AEP_strings(void);
static void ERR_unload_AEP_strings(void);
static void ERR_AEP_error(int function, int reason, char *file, int line);
#define AEPerr(f,r) ERR_AEP_error((f),(r),__FILE__,__LINE__)
static void ERR_load_AEPHK_strings(void);
static void ERR_unload_AEPHK_strings(void);
static void ERR_AEPHK_error(int function, int reason, char *file, int line);
#define AEPHKerr(f,r) ERR_AEPHK_error((f),(r),__FILE__,__LINE__)
/* Error codes for the AEP functions. */
/* Error codes for the AEPHK functions. */
/* Function codes. */
#define AEP_F_AEP_CTRL 100
#define AEP_F_AEP_FINISH 101
#define AEP_F_AEP_INIT 102
#define AEP_F_AEP_MOD_EXP 103
#define AEP_F_AEP_MOD_EXP_CRT 104
#define AEP_F_AEP_RAND 105
#define AEP_F_AEP_RSA_MOD_EXP 106
#define AEPHK_F_AEP_CTRL 100
#define AEPHK_F_AEP_FINISH 101
#define AEPHK_F_AEP_GET_CONNECTION 102
#define AEPHK_F_AEP_INIT 103
#define AEPHK_F_AEP_MOD_EXP 104
#define AEPHK_F_AEP_MOD_EXP_CRT 105
#define AEPHK_F_AEP_RAND 106
#define AEPHK_F_AEP_RSA_MOD_EXP 107
/* Reason codes. */
#define AEP_R_ALREADY_LOADED 100
#define AEP_R_CLOSE_HANDLES_FAILED 101
#define AEP_R_CONNECTIONS_IN_USE 102
#define AEP_R_CTRL_COMMAND_NOT_IMPLEMENTED 103
#define AEP_R_FINALIZE_FAILED 104
#define AEP_R_GENERAL_ERROR 105
#define AEP_R_GET_HANDLE_FAILED 106
#define AEP_R_GET_RANDOM_FAILED 107
#define AEP_R_INIT_FAILURE 108
#define AEP_R_MISSING_KEY_COMPONENTS 109
#define AEP_R_MOD_EXP_CRT_FAILED 110
#define AEP_R_MOD_EXP_FAILED 111
#define AEP_R_NOT_LOADED 112
#define AEP_R_OK 113
#define AEP_R_RETURN_CONNECTION_FAILED 114
#define AEP_R_SETBNCALLBACK_FAILURE 115
#define AEP_R_UNIT_FAILURE 116
#define AEPHK_R_ALREADY_LOADED 100
#define AEPHK_R_CLOSE_HANDLES_FAILED 101
#define AEPHK_R_CONNECTIONS_IN_USE 102
#define AEPHK_R_CTRL_COMMAND_NOT_IMPLEMENTED 103
#define AEPHK_R_FINALIZE_FAILED 104
#define AEPHK_R_GET_HANDLE_FAILED 105
#define AEPHK_R_GET_RANDOM_FAILED 106
#define AEPHK_R_INIT_FAILURE 107
#define AEPHK_R_MISSING_KEY_COMPONENTS 108
#define AEPHK_R_MOD_EXP_CRT_FAILED 109
#define AEPHK_R_MOD_EXP_FAILED 110
#define AEPHK_R_NOT_LOADED 111
#define AEPHK_R_OK 112
#define AEPHK_R_RETURN_CONNECTION_FAILED 113
#define AEPHK_R_SETBNCALLBACK_FAILURE 114
#define AEPHK_R_UNIT_FAILURE 115
#ifdef __cplusplus
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册