/* RAND stuff */
static int hwcrhk_rand_bytes(unsigned char *buf, int num);
+static int hwcrhk_rand_status(void);
/* KM stuff */
static EVP_PKEY *hwcrhk_load_privkey(const char *key_id,
NULL,
NULL,
hwcrhk_rand_bytes,
- NULL
+ hwcrhk_rand_status,
};
/* Our ENGINE structure. */
RSA *rtmp = NULL;
EVP_PKEY *res = NULL;
HWCryptoHook_MPI e, n;
- HWCryptoHook_RSAKeyHandle hptr;
+ HWCryptoHook_RSAKeyHandle *hptr;
HWCryptoHook_ErrMsgBuf rmsg;
if(!hwcrhk_context)
ENGINE_R_NOT_INITIALISED);
goto err;
}
- if (p_hwcrhk_RSALoadKey(hwcrhk_context, key_id, &hptr,
+ hptr = OPENSSL_malloc(sizeof(HWCryptoHook_RSAKeyHandle));
+ if (p_hwcrhk_RSALoadKey(hwcrhk_context, key_id, hptr,
&rmsg, NULL))
{
ENGINEerr(ENGINE_F_HWCRHK_LOAD_PRIVKEY,
ERR_add_error_data(1,rmsg.buf);
goto err;
}
- if (!hptr)
+ if (!*hptr)
{
ENGINEerr(ENGINE_F_HWCRHK_LOAD_PRIVKEY,
ENGINE_R_NO_KEY);
rtmp->flags |= RSA_FLAG_EXT_PKEY;
MPI2BN(rtmp->e, e);
MPI2BN(rtmp->n, n);
- if (p_hwcrhk_RSAGetPublicKey(hptr, &n, &e, &rmsg)
+ if (p_hwcrhk_RSAGetPublicKey(*hptr, &n, &e, &rmsg)
!= HWCRYPTOHOOK_ERROR_MPISIZE)
{
ENGINEerr(ENGINE_F_HWCRHK_LOAD_PUBKEY,ENGINE_R_CHIL_ERROR);
MPI2BN(rtmp->e, e);
MPI2BN(rtmp->n, n);
- if (p_hwcrhk_RSAGetPublicKey(hptr, &n, &e, &rmsg))
+ if (p_hwcrhk_RSAGetPublicKey(*hptr, &n, &e, &rmsg))
{
ENGINEerr(ENGINE_F_HWCRHK_LOAD_PUBKEY,
ENGINE_R_CHIL_ERROR);
return to_return;
}
+static int hwcrhk_rand_status(void)
+ {
+ return 1;
+ }
+
/* This cleans up an RSA KM key, called when ex_data is freed */
static void hwcrhk_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad,