]> git.meshlink.io Git - meshlink/commitdiff
Avoid using BIOs.
authorGuus Sliepen <guus@tinc-vpn.org>
Sun, 15 Sep 2013 14:21:25 +0000 (16:21 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Sun, 15 Sep 2013 14:21:25 +0000 (16:21 +0200)
src/openssl/ecdsagen.c

index 31e5847078e71500801bd64f8c98e9329f997242..1affce05333f98e59395d84eefeabfc83e12d824 100644 (file)
@@ -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);
 }