diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-05-31 11:40:00 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-05-31 13:56:01 +0200 |
commit | 05a70fa35d94c48ab9621f651f6f10c67931c4b1 (patch) | |
tree | f79354a1f88bd57e3b243e65b298dc64b5b6f524 | |
parent | b231f31d05760e1963d6ad78cb3d99d423388fb5 (diff) | |
download | gnutls-05a70fa35d94c48ab9621f651f6f10c67931c4b1.tar.gz |
x509: simplified _gnutls_x509_get_tbs()
-rw-r--r-- | lib/x509/sign.c | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/lib/x509/sign.c b/lib/x509/sign.c index 320f42b8b7..35e57f01a2 100644 --- a/lib/x509/sign.c +++ b/lib/x509/sign.c @@ -45,35 +45,7 @@ int _gnutls_x509_get_tbs(ASN1_TYPE cert, const char *tbs_name, gnutls_datum_t * tbs) { - int result; - uint8_t *buf; - int buf_size; - - buf_size = 0; - result = asn1_der_coding(cert, tbs_name, NULL, &buf_size, NULL); - if (result != ASN1_MEM_ERROR) { - gnutls_assert(); - return _gnutls_asn2err(result); - } - - buf = gnutls_malloc(buf_size); - if (buf == NULL) { - gnutls_assert(); - return GNUTLS_E_MEMORY_ERROR; - } - - result = asn1_der_coding(cert, tbs_name, buf, &buf_size, NULL); - - if (result != ASN1_SUCCESS) { - gnutls_assert(); - gnutls_free(buf); - return _gnutls_asn2err(result); - } - - tbs->data = buf; - tbs->size = buf_size; - - return 0; + return _gnutls_x509_der_encode(cert, tbs_name, tbs, 0); } /*- |