projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
clear dso pointer in case of an error
[openssl.git]
/
engines
/
e_aep.c
diff --git
a/engines/e_aep.c
b/engines/e_aep.c
index 8b8380a582b4d1432a76862a70ef6aff952652ce..c175a186e98a2a4db12638c83db3f8575c016375 100644
(file)
--- a/
engines/e_aep.c
+++ b/
engines/e_aep.c
@@
-1,6
+1,3
@@
-/* crypto/engine/hw_aep.c */
-/*
- */
/* ====================================================================
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
*
/* ====================================================================
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
*
@@
-72,6
+69,10
@@
typedef int pid_t;
#include <openssl/dso.h>
#include <openssl/engine.h>
#include <openssl/buffer.h>
#include <openssl/dso.h>
#include <openssl/engine.h>
#include <openssl/buffer.h>
+#include <openssl/rsa.h>
+#include <openssl/dsa.h>
+#include <openssl/dh.h>
+#include <openssl/bn.h>
#ifndef OPENSSL_NO_HW
#ifndef OPENSSL_NO_HW_AEP
#ifndef OPENSSL_NO_HW
#ifndef OPENSSL_NO_HW_AEP
@@
-84,11
+85,11
@@
typedef int pid_t;
#define AEP_LIB_NAME "aep engine"
#define FAIL_TO_SW 0x10101010
#define AEP_LIB_NAME "aep engine"
#define FAIL_TO_SW 0x10101010
-#include "
hw
_aep_err.c"
+#include "
e
_aep_err.c"
static int aep_init(ENGINE *e);
static int aep_finish(ENGINE *e);
static int aep_init(ENGINE *e);
static int aep_finish(ENGINE *e);
-static int aep_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)());
+static int aep_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(
void
));
static int aep_destroy(ENGINE *e);
static AEP_RV aep_get_connection(AEP_CONNECTION_HNDL_PTR hConnection);
static int aep_destroy(ENGINE *e);
static AEP_RV aep_get_connection(AEP_CONNECTION_HNDL_PTR hConnection);
@@
-106,7
+107,7
@@
static AEP_RV aep_mod_exp_crt(BIGNUM *r,const BIGNUM *a, const BIGNUM *p,
/* RSA stuff */
#ifndef OPENSSL_NO_RSA
/* RSA stuff */
#ifndef OPENSSL_NO_RSA
-static int aep_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa);
+static int aep_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa
, BN_CTX *ctx
);
#endif
/* This function is aliased to mod_exp (with the mont stuff dropped). */
#endif
/* This function is aliased to mod_exp (with the mont stuff dropped). */
@@
-172,7
+173,8
@@
static RSA_METHOD aep_rsa =
0, /*flags*/
NULL, /*app_data*/
NULL, /*rsa_sign*/
0, /*flags*/
NULL, /*app_data*/
NULL, /*rsa_sign*/
- NULL /*rsa_verify*/
+ NULL, /*rsa_verify*/
+ NULL /*rsa_keygen*/
};
#endif
};
#endif
@@
-189,7
+191,9
@@
static DSA_METHOD aep_dsa =
NULL, /* init */
NULL, /* finish */
0, /* flags */
NULL, /* init */
NULL, /* finish */
0, /* flags */
- NULL /* app_data */
+ NULL, /* app_data */
+ NULL, /* dsa_paramgen */
+ NULL /* dsa_keygen */
};
#endif
};
#endif
@@
-204,6
+208,7
@@
static DH_METHOD aep_dh =
NULL,
NULL,
0,
NULL,
NULL,
0,
+ NULL,
NULL
};
#endif
NULL
};
#endif
@@
-318,7
+323,7
@@
static int bind_aep(ENGINE *e)
return 1;
}
return 1;
}
-#if
def ENGINE_DYNAMIC_SUPPORT
+#if
ndef OPENSSL_NO_DYNAMIC_ENGINE
static int bind_helper(ENGINE *e, const char *id)
{
if(id && (strcmp(id, engine_aep_id) != 0))
static int bind_helper(ENGINE *e, const char *id)
{
if(id && (strcmp(id, engine_aep_id) != 0))
@@
-474,6
+479,7
@@
static int aep_init(ENGINE *e)
if(aep_dso)
DSO_free(aep_dso);
if(aep_dso)
DSO_free(aep_dso);
+ aep_dso = NULL;
p_AEP_OpenConnection = NULL;
p_AEP_ModExp = NULL;
p_AEP_OpenConnection = NULL;
p_AEP_ModExp = NULL;
@@
-550,7
+556,7
@@
static int aep_finish(ENGINE *e)
return to_return;
}
return to_return;
}
-static int aep_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)())
+static int aep_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(
void
))
{
int initialised = ((aep_dso == NULL) ? 0 : 1);
switch(cmd)
{
int initialised = ((aep_dso == NULL) ? 0 : 1);
switch(cmd)
@@
-615,7
+621,7
@@
static int aep_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
rv = aep_return_connection(hConnection);
if (rv != AEP_R_OK)
{
rv = aep_return_connection(hConnection);
if (rv != AEP_R_OK)
{
- AEPHKerr(AEPHK_F_AEP_
RAND
,AEPHK_R_RETURN_CONNECTION_FAILED);
+ AEPHKerr(AEPHK_F_AEP_
MOD_EXP
,AEPHK_R_RETURN_CONNECTION_FAILED);
goto err;
}
goto err;
}
@@
-653,7
+659,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)
{
rv = aep_return_connection(hConnection);
if (rv != AEP_R_OK)
{
- AEPHKerr(AEPHK_F_AEP_
RAND
,AEPHK_R_RETURN_CONNECTION_FAILED);
+ AEPHKerr(AEPHK_F_AEP_
MOD_EXP_CRT
,AEPHK_R_RETURN_CONNECTION_FAILED);
goto err;
}
goto err;
}
@@
-741,15
+747,11
@@
static int aep_rand_status(void)
#endif
#ifndef OPENSSL_NO_RSA
#endif
#ifndef OPENSSL_NO_RSA
-static int aep_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
+static int aep_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa
, BN_CTX *ctx
)
{
{
- BN_CTX *ctx = NULL;
int to_return = 0;
AEP_RV rv = AEP_R_OK;
int to_return = 0;
AEP_RV rv = AEP_R_OK;
- if ((ctx = BN_CTX_new()) == NULL)
- goto err;
-
if (!aep_dso)
{
AEPHKerr(AEPHK_F_AEP_RSA_MOD_EXP,AEPHK_R_NOT_LOADED);
if (!aep_dso)
{
AEPHKerr(AEPHK_F_AEP_RSA_MOD_EXP,AEPHK_R_NOT_LOADED);
@@
-763,7
+765,7
@@
static int aep_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
if (rv == FAIL_TO_SW){
const RSA_METHOD *meth = RSA_PKCS1_SSLeay();
if (rv == FAIL_TO_SW){
const RSA_METHOD *meth = RSA_PKCS1_SSLeay();
- to_return = (*meth->rsa_mod_exp)(r0, I, rsa);
+ to_return = (*meth->rsa_mod_exp)(r0, I, rsa
, ctx
);
goto err;
}
else if (rv != AEP_R_OK)
goto err;
}
else if (rv != AEP_R_OK)
@@
-786,8
+788,6
@@
static int aep_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
to_return = 1;
err:
to_return = 1;
err:
- if(ctx)
- BN_CTX_free(ctx);
return to_return;
}
#endif
return to_return;
}
#endif
@@
-848,7
+848,11
@@
static AEP_RV aep_get_connection(AEP_CONNECTION_HNDL_PTR phConnection)
CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
+#ifndef NETWARE_CLIB
curr_pid = getpid();
curr_pid = getpid();
+#else
+ curr_pid = GetThreadID();
+#endif
/*Check if this is the first time this is being called from the current
process*/
/*Check if this is the first time this is being called from the current
process*/