]> git.meshlink.io Git - meshlink/blobdiff - src/openssl/rsa.c
Remove everything GPL that is not copyright Guus Sliepen, update copyright statements.
[meshlink] / src / openssl / rsa.c
index 20bfb65a072b2926e26a1e21191c32dcd3c0aa2b..618e75c13cd8f436fc216e59072e5d1e9704ad63 100644 (file)
@@ -1,6 +1,6 @@
 /*
     rsa.c -- RSA key handling
-    Copyright (C) 2007-2013 Guus Sliepen <guus@tinc-vpn.org>
+    Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
 
     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
@@ -61,8 +61,10 @@ rsa_t *rsa_set_hex_private_key(char *n, char *e, char *d) {
 rsa_t *rsa_read_pem_public_key(FILE *fp) {
        rsa_t *rsa = PEM_read_RSAPublicKey(fp, NULL, NULL, NULL);
 
-       if(!rsa)
+       if(!rsa) {
+               rewind(fp);
                rsa = PEM_read_RSA_PUBKEY(fp, NULL, NULL, NULL);
+       }
 
        if(!rsa)
                logger(DEBUG_ALWAYS, LOG_ERR, "Unable to read RSA public key: %s", ERR_error_string(ERR_get_error(), NULL));