]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - crypt.c
openssl: RSA fixes for openssl-1.1.
[paraslash.git] / crypt.c
diff --git a/crypt.c b/crypt.c
index 06ae6265010a946bd51a1e64b1c620f0e4c89fc3..e819e8be3063cbe151634dc037d30e623e27357a 100644 (file)
--- a/crypt.c
+++ b/crypt.c
@@ -133,18 +133,25 @@ static int read_rsa_bignums(const unsigned char *blob, int blen, RSA **result)
 {
        int ret;
        RSA *rsa;
 {
        int ret;
        RSA *rsa;
+       BIGNUM *n, *e;
        const unsigned char *p = blob, *end = blob + blen;
 
        rsa = RSA_new();
        if (!rsa)
                return -E_BIGNUM;
        const unsigned char *p = blob, *end = blob + blen;
 
        rsa = RSA_new();
        if (!rsa)
                return -E_BIGNUM;
-       ret = read_bignum(p, end - p, &rsa->e);
+       ret = read_bignum(p, end - p, &e);
        if (ret < 0)
                goto fail;
        p += ret;
        if (ret < 0)
                goto fail;
        p += ret;
-       ret = read_bignum(p, end - p, &rsa->n);
+       ret = read_bignum(p, end - p, &n);
        if (ret < 0)
                goto fail;
        if (ret < 0)
                goto fail;
+#ifdef HAVE_RSA_SET0_KEY
+       RSA_set0_key(rsa, n, e, NULL);
+#else
+       rsa->n = n;
+       rsa->e = e;
+#endif
        *result = rsa;
        return 1;
 fail:
        *result = rsa;
        return 1;
 fail: