X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fopenssl%2Frsa.c;h=e7428add874f8435e5d6a9533f0c6380e9fef97a;hb=ef27852d0f5a5e31b21f256b3fb3074dd634b19d;hp=48a71a91817b6a58dd2753797e0dad3c5557bbe4;hpb=f12e34dd921ce0df138194d6559aacf18da0e192;p=tinc diff --git a/src/openssl/rsa.c b/src/openssl/rsa.c index 48a71a91..e7428add 100644 --- a/src/openssl/rsa.c +++ b/src/openssl/rsa.c @@ -1,6 +1,6 @@ /* rsa.c -- RSA key handling - Copyright (C) 2007-2013 Guus Sliepen + Copyright (C) 2007-2021 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,18 +31,6 @@ typedef RSA rsa_t; // Set RSA keys -#ifndef HAVE_RSA_SET0_KEY -int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d) { - BN_free(r->n); - r->n = n; - BN_free(r->e); - r->e = e; - BN_free(r->d); - r->d = d; - return 1; -} -#endif - rsa_t *rsa_set_hex_public_key(char *n, char *e) { BIGNUM *bn_n = NULL; BIGNUM *bn_e = NULL; @@ -114,12 +102,12 @@ rsa_t *rsa_read_pem_private_key(FILE *fp) { return rsa; } -size_t rsa_size(rsa_t *rsa) { +size_t rsa_size(const rsa_t *rsa) { return RSA_size(rsa); } bool rsa_public_encrypt(rsa_t *rsa, void *in, size_t len, void *out) { - if((size_t)RSA_public_encrypt(len, in, out, rsa, RSA_NO_PADDING) == len) { + if((size_t)RSA_public_encrypt((int) len, in, out, rsa, RSA_NO_PADDING) == len) { return true; } @@ -128,7 +116,7 @@ bool rsa_public_encrypt(rsa_t *rsa, void *in, size_t len, void *out) { } bool rsa_private_decrypt(rsa_t *rsa, void *in, size_t len, void *out) { - if((size_t)RSA_private_decrypt(len, in, out, rsa, RSA_NO_PADDING) == len) { + if((size_t)RSA_private_decrypt((int) len, in, out, rsa, RSA_NO_PADDING) == len) { return true; } @@ -136,10 +124,6 @@ bool rsa_private_decrypt(rsa_t *rsa, void *in, size_t len, void *out) { return false; } -bool rsa_active(rsa_t *rsa) { - return rsa; -} - void rsa_free(rsa_t *rsa) { if(rsa) { RSA_free(rsa);