Commit 2884156b authored by Nils Goroll's avatar Nils Goroll

libcrypto backwards compatibility

parent 5afe33cd
...@@ -26,6 +26,10 @@ AC_CHECK_LIB([crypto], ...@@ -26,6 +26,10 @@ AC_CHECK_LIB([crypto],
[EVP_MD_CTX_free], [EVP_MD_CTX_free],
[AC_DEFINE([HAVE_EVP_MD_CTX_FREE], [], [AC_DEFINE([HAVE_EVP_MD_CTX_FREE], [],
[Libcrypto has EVP_MD_CTX_free])]) [Libcrypto has EVP_MD_CTX_free])])
AC_CHECK_LIB([crypto],
[RSA_set0_key],
[AC_DEFINE([HAVE_RSA_SET0_KEY], [],
[Libcrypto has RSA_set0_key])])
AC_CHECK_PROGS(BASE64, [base64], [no]) AC_CHECK_PROGS(BASE64, [base64], [no])
test "$BASE64" == "no" && AC_MSG_ERROR([Required program 'base64' not found.]) test "$BASE64" == "no" && AC_MSG_ERROR([Required program 'base64' not found.])
......
...@@ -124,7 +124,7 @@ fini(void) ...@@ -124,7 +124,7 @@ fini(void)
/* /*
* ------------------------------------------------------------ * ------------------------------------------------------------
* libcryto housekeeping * libcryto compat
*/ */
#ifndef HAVE_EVP_MD_CTX_FREE #ifndef HAVE_EVP_MD_CTX_FREE
...@@ -132,6 +132,37 @@ fini(void) ...@@ -132,6 +132,37 @@ fini(void)
#define EVP_MD_CTX_new() EVP_MD_CTX_create() #define EVP_MD_CTX_new() EVP_MD_CTX_create()
#endif #endif
#ifndef HAVE_RSA_SET0_KEY
/* from openssl crypto/rsa/rsa_lib.c */
static int
RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d)
{
/* If the fields n and e in r are NULL, the corresponding input
* parameters MUST be non-NULL for n and e. d may be
* left NULL (in case only the public key is used).
*/
if ((r->n == NULL && n == NULL)
|| (r->e == NULL && e == NULL))
return 0;
if (n != NULL) {
BN_free(r->n);
r->n = n;
}
if (e != NULL) {
BN_free(r->e);
r->e = e;
}
if (d != NULL) {
BN_clear_free(r->d);
r->d = d;
BN_set_flags(r->d, BN_FLG_CONSTTIME);
}
return 1;
}
#endif
/* /*
* ------------------------------------------------------------ * ------------------------------------------------------------
* $Object key() * $Object key()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment