projects
/
tinc
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
44c7f55
)
Rewind the file before trying to use PEM_read_RSA_PUBKEY().
author
Guus Sliepen
<guus@tinc-vpn.org>
Wed, 26 Feb 2014 16:27:57 +0000
(17:27 +0100)
committer
Guus Sliepen
<guus@tinc-vpn.org>
Wed, 26 Feb 2014 16:27:57 +0000
(17:27 +0100)
src/openssl/rsa.c
patch
|
blob
|
history
diff --git
a/src/openssl/rsa.c
b/src/openssl/rsa.c
index
20bfb65
..
9c1f498
100644
(file)
--- a/
src/openssl/rsa.c
+++ b/
src/openssl/rsa.c
@@
-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));