diff options
author | Miloslav Trmač <mitr@redhat.com> | 2010-11-25 23:46:40 +0100 |
---|---|---|
committer | Miloslav Trmač <mitr@redhat.com> | 2010-11-25 23:46:40 +0100 |
commit | eafbed071d3e3de75f8539c1473edd5a8af28cac (patch) | |
tree | 38534dbf5cdf5b614f6a1bf2677d6a28d6d37b4e | |
parent | e4392e2df40c8d89109630fa7cab951f6c8ab70d (diff) | |
download | ncrypto-eafbed071d3e3de75f8539c1473edd5a8af28cac.tar.gz ncrypto-eafbed071d3e3de75f8539c1473edd5a8af28cac.tar.xz ncrypto-eafbed071d3e3de75f8539c1473edd5a8af28cac.zip |
Report all required sizes if any one is too small
-rw-r--r-- | lib/ncrypto_nss.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/ncrypto_nss.c b/lib/ncrypto_nss.c index 24e7e30..b6e7464 100644 --- a/lib/ncrypto_nss.c +++ b/lib/ncrypto_nss.c @@ -744,19 +744,13 @@ ncr_public_key_export_rsa (struct ncr_public_key *key, void *modulus, } res = CKR_OK; if (*modulus_size_ptr < der_output.modulus.len) - { - *modulus_size_ptr = der_output.modulus.len; - res = CKR_BUFFER_TOO_SMALL; - } + res = CKR_BUFFER_TOO_SMALL; + *modulus_size_ptr = der_output.modulus.len; if (*public_exponent_size_ptr < der_output.public_exponent.len) - { - *public_exponent_size_ptr = der_output.public_exponent.len; - res = CKR_BUFFER_TOO_SMALL; - } + res = CKR_BUFFER_TOO_SMALL; + *public_exponent_size_ptr = der_output.public_exponent.len; if (res != CKR_OK) goto end; - *modulus_size_ptr = der_output.modulus.len; - *public_exponent_size_ptr = der_output.public_exponent.len; memcpy (modulus, der_output.modulus.data, der_output.modulus.len); memcpy (public_exponent, der_output.public_exponent.data, |