diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-10-07 10:33:55 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-10-07 10:37:44 +0200 |
commit | 531bac41a0ee19158f0722937d0c9efafbc3bb14 (patch) | |
tree | c768f0c17ae335479b628d0c644742da63fb0f44 /libdane | |
parent | 5afff3b04637ee2d0fa29bf783428e7fc43ea722 (diff) | |
download | gnutls-531bac41a0ee19158f0722937d0c9efafbc3bb14.tar.gz |
Added functions to export structures in an allocated buffer.
Diffstat (limited to 'libdane')
-rw-r--r-- | libdane/dane.c | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/libdane/dane.c b/libdane/dane.c index 6f9a2db4cd..ebf362c498 100644 --- a/libdane/dane.c +++ b/libdane/dane.c @@ -306,7 +306,6 @@ static int crt_to_pubkey(const gnutls_datum_t *raw_crt, gnutls_datum_t * out) gnutls_pubkey_t pub = NULL; gnutls_x509_crt_t crt = NULL; int ret; -size_t size; out->data = NULL; @@ -332,27 +331,12 @@ size_t size; goto cleanup; } - size = 0; - ret = gnutls_pubkey_export(pub, GNUTLS_X509_FMT_DER, NULL, &size); - if (ret < 0 && ret != GNUTLS_E_SHORT_MEMORY_BUFFER) { - ret = DANE_E_PUBKEY_ERROR; - goto cleanup; - } - - out->data = malloc(size); - if (out->data == NULL) { - ret = DANE_E_MEMORY_ERROR; - goto cleanup; - } - - ret = gnutls_pubkey_export(pub, GNUTLS_X509_FMT_DER, out->data, &size); + ret = gnutls_pubkey_export2(pub, GNUTLS_X509_FMT_DER, out); if (ret < 0) { ret = DANE_E_PUBKEY_ERROR; goto cleanup; } - out->size = size; - ret = 0; goto clean_certs; |