summaryrefslogtreecommitdiffstats
path: root/crypto/pem/pvkfmt.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2016-11-17 00:03:43 +0100
committerDr. Stephen Henson <steve@openssl.org>2016-11-17 04:53:02 +0100
commit159f6e7ecfde9e98194d6111c85587b85b6a8fc5 (patch)
tree0743bde0f6ea1f942357efa3686bf72be6963365 /crypto/pem/pvkfmt.c
parentRaise an error on memory alloc failure. (diff)
downloadopenssl-159f6e7ecfde9e98194d6111c85587b85b6a8fc5.tar.xz
openssl-159f6e7ecfde9e98194d6111c85587b85b6a8fc5.zip
Fix MSBLOB format with RSA.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/pem/pvkfmt.c')
-rw-r--r--crypto/pem/pvkfmt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/pem/pvkfmt.c b/crypto/pem/pvkfmt.c
index 416bfc2a47..248704ec59 100644
--- a/crypto/pem/pvkfmt.c
+++ b/crypto/pem/pvkfmt.c
@@ -548,7 +548,7 @@ static void write_rsa(unsigned char **out, RSA *rsa, int ispub)
hnbyte = (RSA_bits(rsa) + 15) >> 4;
RSA_get0_key(rsa, &n, &e, &d);
write_lebn(out, e, 4);
- write_lebn(out, n, -1);
+ write_lebn(out, n, nbyte);
if (ispub)
return;
RSA_get0_factors(rsa, &p, &q);