X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fopenssl%2Frsagen.c;h=3a8c8ad2efbfba49524a567a5d93f148a2db787f;hp=0f4a4fa19733f37cbfcd7e394f2e77d6ea51af33;hb=9b9230a0a79c670b86f54fadd2807b864ff9d91f;hpb=e70b5b5bd77bb66e8dd324c17d86d9bff151aa82 diff --git a/src/openssl/rsagen.c b/src/openssl/rsagen.c index 0f4a4fa1..3a8c8ad2 100644 --- a/src/openssl/rsagen.c +++ b/src/openssl/rsagen.c @@ -1,6 +1,6 @@ /* rsagen.c -- RSA key generation and export - Copyright (C) 2008 Guus Sliepen + Copyright (C) 2008-2013 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 @@ -17,13 +17,16 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "system.h" +#include "../system.h" #include #include -#include "logger.h" -#include "rsagen.h" +#define __TINC_RSA_INTERNAL__ +typedef RSA rsa_t; + +#include "../logger.h" +#include "../rsagen.h" /* This function prettyprints the key generation process */ @@ -63,21 +66,16 @@ static void indicator(int a, int b, void *p) { // Generate RSA key -bool rsa_generate(rsa_t *rsa, size_t bits, unsigned long exponent) { - *rsa = RSA_generate_key(bits, exponent, indicator, NULL); - - return *rsa; +rsa_t *rsa_generate(size_t bits, unsigned long exponent) { + return RSA_generate_key(bits, exponent, indicator, NULL); } // Write PEM RSA keys bool rsa_write_pem_public_key(rsa_t *rsa, FILE *fp) { - PEM_write_RSAPublicKey(fp, *rsa); - - return true; + return PEM_write_RSAPublicKey(fp, rsa); } bool rsa_write_pem_private_key(rsa_t *rsa, FILE *fp) { - PEM_write_RSAPrivateKey(fp, *rsa, NULL, NULL, 0, NULL, NULL); - return true; + return PEM_write_RSAPrivateKey(fp, rsa, NULL, NULL, 0, NULL, NULL); }