From 87b017c71062bbc75ab5a98795abaf87f96ceba6 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sun, 15 Sep 2013 16:21:25 +0200 Subject: [PATCH] Avoid using BIOs. --- src/openssl/ecdsagen.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/openssl/ecdsagen.c b/src/openssl/ecdsagen.c index 31e5847..1affce0 100644 --- a/src/openssl/ecdsagen.c +++ b/src/openssl/ecdsagen.c @@ -50,21 +50,9 @@ ecdsa_t *ecdsa_generate(void) { // Write PEM ECDSA keys bool ecdsa_write_pem_public_key(ecdsa_t *ecdsa, FILE *fp) { - BIO *out = BIO_new(BIO_s_file()); - if(!out) - return false; - BIO_set_fp(out, fp, BIO_NOCLOSE); - bool result = PEM_write_bio_EC_PUBKEY(out, ecdsa); - BIO_free(out); - return result; + return PEM_write_EC_PUBKEY(fp, ecdsa); } bool ecdsa_write_pem_private_key(ecdsa_t *ecdsa, FILE *fp) { - BIO *out = BIO_new(BIO_s_file()); - if(!out) - return false; - BIO_set_fp(out, fp, BIO_NOCLOSE); - bool result = PEM_write_bio_ECPrivateKey(out, ecdsa, NULL, NULL, 0, NULL, NULL); - BIO_free(out); - return result; + return PEM_write_ECPrivateKey(fp, ecdsa, NULL, NULL, 0, NULL, NULL); } -- 2.25.1