-/* crypto/engine/hw_ubsec.c */
/*
* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL project
* 2000. Cloned shamelessly by Joe Tardo.
# ifndef OPENSSL_NO_RSA
/*
- * We know that the "PKCS1_SSLeay()" functions hook properly to the
+ * We know that the "PKCS1_OpenSSL()" functions hook properly to the
* Broadcom-specific mod_exp and mod_exp_crt so we use those functions.
* NB: We don't use ENGINE_openssl() or anything "more generic" because
* something like the RSAref code may not hook properly, and if you own
* one of these cards then you have the right to do RSA operations on it
* anyway!
*/
- meth1 = RSA_PKCS1_SSLeay();
+ meth1 = RSA_PKCS1_OpenSSL();
ubsec_rsa.rsa_pub_enc = meth1->rsa_pub_enc;
ubsec_rsa.rsa_pub_dec = meth1->rsa_pub_dec;
ubsec_rsa.rsa_priv_enc = meth1->rsa_priv_enc;
static ENGINE *engine_ubsec(void)
{
ENGINE *ret = ENGINE_new();
- if (!ret)
+ if (ret == NULL)
return NULL;
if (!bind_helper(ret)) {
ENGINE_free(ret);
static long set_UBSEC_LIBNAME(const char *name)
{
free_UBSEC_LIBNAME();
- return (((UBSEC_LIBNAME = BUF_strdup(name)) != NULL) ? 1 : 0);
+ return (((UBSEC_LIBNAME = OPENSSL_strdup(name)) != NULL) ? 1 : 0);
}
static const char *UBSEC_F1 = "ubsec_bytes_to_bits";
goto err;
}
- if (!(p1 = (t_UBSEC_ubsec_bytes_to_bits *)
- DSO_bind_func(ubsec_dso, UBSEC_F1))
- || !(p2 = (t_UBSEC_ubsec_bits_to_bytes *)
- DSO_bind_func(ubsec_dso, UBSEC_F2))
- || !(p3 = (t_UBSEC_ubsec_open *)
- DSO_bind_func(ubsec_dso, UBSEC_F3))
- || !(p4 = (t_UBSEC_ubsec_close *)
- DSO_bind_func(ubsec_dso, UBSEC_F4))
+#define BINDIT(t, name) (t *)DSO_bind_func(ubsec_dso, name)
+ if ((p1 = BINDIT(t_UBSEC_ubsec_bytes_to_bits, UBSEC_F1)) == NULL
+ || (p2 = BINDIT(t_UBSEC_ubsec_bits_to_bytes, UBSEC_F2)) == NULL
+ || (p3 = BINDIT(t_UBSEC_ubsec_open, UBSEC_F3)) == NULL
+ || (p4 = BINDIT(t_UBSEC_ubsec_close, UBSEC_F4)) == NULL
# ifndef OPENSSL_NO_DH
- || !(p5 = (t_UBSEC_diffie_hellman_generate_ioctl *)
- DSO_bind_func(ubsec_dso, UBSEC_F5))
- || !(p6 = (t_UBSEC_diffie_hellman_agree_ioctl *)
- DSO_bind_func(ubsec_dso, UBSEC_F6))
+ || (p5 = BINDIT(t_UBSEC_diffie_hellman_generate_ioctl, UBSEC_F5)) == NULL
+ || (p6 = BINDIT(t_UBSEC_diffie_hellman_agree_ioctl, UBSEC_F6)) == NULL
# endif
/* #ifndef OPENSSL_NO_RSA */
- || !(p7 = (t_UBSEC_rsa_mod_exp_ioctl *)
- DSO_bind_func(ubsec_dso, UBSEC_F7))
- || !(p8 = (t_UBSEC_rsa_mod_exp_crt_ioctl *)
- DSO_bind_func(ubsec_dso, UBSEC_F8))
+ || (p7 = BINDIT(t_UBSEC_rsa_mod_exp_ioctl, UBSEC_F7)) == NULL
+ || (p8 = BINDIT(t_UBSEC_rsa_mod_exp_crt_ioctl, UBSEC_F8)) == NULL
/* #endif */
# ifndef OPENSSL_NO_DSA
- || !(p9 = (t_UBSEC_dsa_sign_ioctl *)
- DSO_bind_func(ubsec_dso, UBSEC_F9))
- || !(p10 = (t_UBSEC_dsa_verify_ioctl *)
- DSO_bind_func(ubsec_dso, UBSEC_F10))
+ || (p9 = BINDIT(t_UBSEC_dsa_sign_ioctl, UBSEC_F9)) == NULL
+ || (p10 = BINDIT(t_UBSEC_dsa_verify_ioctl, UBSEC_F10)) == NULL
# endif
- || !(p11 = (t_UBSEC_math_accelerate_ioctl *)
- DSO_bind_func(ubsec_dso, UBSEC_F11))
- || !(p12 = (t_UBSEC_rng_ioctl *)
- DSO_bind_func(ubsec_dso, UBSEC_F12))
- || !(p13 = (t_UBSEC_max_key_len_ioctl *)
- DSO_bind_func(ubsec_dso, UBSEC_F13))) {
+ || (p11 = BINDIT(t_UBSEC_math_accelerate_ioctl, UBSEC_F11)) == NULL
+ || (p12 = BINDIT(t_UBSEC_rng_ioctl, UBSEC_F12)) == NULL
+ || (p13 = BINDIT(t_UBSEC_max_key_len_ioctl, UBSEC_F13)) == NULL) {
UBSECerr(UBSEC_F_UBSEC_INIT, UBSEC_R_DSO_FAILURE);
goto err;
}
}
err:
- if (ubsec_dso)
- DSO_free(ubsec_dso);
+ DSO_free(ubsec_dso);
ubsec_dso = NULL;
p_UBSEC_ubsec_bytes_to_bits = NULL;
p_UBSEC_ubsec_bits_to_bytes = NULL;
/*
* Do in software as hardware failed.
*/
- const RSA_METHOD *meth = RSA_PKCS1_SSLeay();
+ const RSA_METHOD *meth = RSA_PKCS1_OpenSSL();
to_return = (*meth->rsa_mod_exp) (r0, I, rsa, ctx);
}
err:
/* Do in software if the key is too large for the hardware. */
if (BN_num_bits(m) > max_key_len) {
- const RSA_METHOD *meth = RSA_PKCS1_SSLeay();
+ const RSA_METHOD *meth = RSA_PKCS1_OpenSSL();
ret = (*meth->bn_mod_exp) (r, a, p, m, ctx, m_ctx);
} else {
ret = ubsec_mod_exp(r, a, p, m, ctx);
const RAND_METHOD *meth;
UBSECerr(UBSEC_F_UBSEC_RAND_BYTES, UBSEC_R_UNIT_FAILURE);
num = p_UBSEC_ubsec_bits_to_bytes(num);
- meth = RAND_SSLeay();
+ meth = RAND_OpenSSL();
meth->seed(buf, num);
ret = meth->bytes(buf, num);
goto err;
p_UBSEC_ubsec_close(fd);
num = p_UBSEC_ubsec_bits_to_bytes(num);
- meth = RAND_SSLeay();
+ meth = RAND_OpenSSL();
meth->seed(buf, num);
ret = meth->bytes(buf, num);