-/* crypto/engine/hw_aep.c */
-/*
- */
/* ====================================================================
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
*
#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
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);
/* 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). */
NULL, /* init */
NULL, /* finish */
0, /* flags */
- NULL /* app_data */
+ NULL, /* app_data */
+ NULL, /* dsa_paramgen */
+ NULL /* dsa_keygen */
};
#endif
NULL,
NULL,
0,
+ NULL,
NULL
};
#endif
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)
#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;
- if ((ctx = BN_CTX_new()) == NULL)
- goto err;
-
if (!aep_dso)
{
AEPHKerr(AEPHK_F_AEP_RSA_MOD_EXP,AEPHK_R_NOT_LOADED);
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)
to_return = 1;
err:
- if(ctx)
- BN_CTX_free(ctx);
return to_return;
}
#endif
CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
+#ifndef NETWARE_CLIB
curr_pid = getpid();
+#else
+ curr_pid = GetThreadID();
+#endif
/*Check if this is the first time this is being called from the current
process*/