diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2014-08-29 15:17:42 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2014-09-03 16:54:54 +0200 |
commit | a44b16835075b60dcbf299ad5dde0755856a3bfe (patch) | |
tree | 78550b9e6bb91b6b4441a804671dd5eb00180f02 /lib/x509/common.c | |
parent | 10aa06076ee3bdb5eedb272c3fbb4b58fbfdc555 (diff) | |
download | gnutls-a44b16835075b60dcbf299ad5dde0755856a3bfe.tar.gz |
when importing a certificate, keep the DER data
Diffstat (limited to 'lib/x509/common.c')
-rw-r--r-- | lib/x509/common.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/x509/common.c b/lib/x509/common.c index f31f0cfdd7..cbe96ff28b 100644 --- a/lib/x509/common.c +++ b/lib/x509/common.c @@ -1513,16 +1513,22 @@ _gnutls_x509_get_pk_algorithm(ASN1_TYPE src, const char *src_name, * returns them into signed_data. */ int -_gnutls_x509_get_signed_data(ASN1_TYPE src, const char *src_name, +_gnutls_x509_get_signed_data(ASN1_TYPE src, const gnutls_datum *_der, + const char *src_name, gnutls_datum_t * signed_data) { - gnutls_datum_t der; int start, end, result; + gnutls_datum_t der; - result = _gnutls_x509_der_encode(src, "", &der, 0); - if (result < 0) { - gnutls_assert(); - return result; + if (_der == NULL) { + result = _gnutls_x509_der_encode(src, "", &der, 0); + if (result < 0) { + gnutls_assert(); + return result; + } + } else { + der.data = _der->data; + der.size = _der->size; } /* Get the signed data @@ -1547,7 +1553,8 @@ _gnutls_x509_get_signed_data(ASN1_TYPE src, const char *src_name, result = 0; cleanup: - _gnutls_free_datum(&der); + if (_der == NULL) + _gnutls_free_datum(&der); return result; } |