diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-11-18 19:31:54 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-11-18 19:31:54 +0100 |
commit | 9e02a17f503668551356bdd10489b93c447834e4 (patch) | |
tree | 3ab0e52f14dca48efc1d56317a4cb2a259deb456 /lib/tpm.c | |
parent | 96c38a6c89fe0b6f7d826c3588479ec861811054 (diff) | |
download | gnutls-9e02a17f503668551356bdd10489b93c447834e4.tar.gz |
Added functions to parse the certificate policies extention.
Added gnutls_x509_crt_get_policy() etc. In addition several updated in the
handling of strings in X.509 structures.
Diffstat (limited to 'lib/tpm.c')
-rw-r--r-- | lib/tpm.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -367,10 +367,11 @@ static int load_key(TSS_HCONTEXT tpm_ctx, TSS_HKEY srk, { int ret, err; gnutls_datum_t asn1 = { NULL, 0 }; -size_t slen; if (format == GNUTLS_TPMKEY_FMT_CTK_PEM) { + gnutls_datum_t td; + ret = gnutls_pem_base64_decode_alloc ("TSS KEY BLOB", fdata, &asn1); if (ret) { @@ -380,14 +381,15 @@ size_t slen; return ret; } - slen = asn1.size; - ret = _gnutls_x509_decode_octet_string(NULL, asn1.data, asn1.size, asn1.data, &slen); + ret = _gnutls_x509_decode_string(NULL, asn1.data, asn1.size, &td); if (ret < 0) { gnutls_assert(); goto cleanup; } - asn1.size = slen; + gnutls_free(asn1.data); + asn1.data = td.data; + asn1.size = td.size; } else /* DER */ { @@ -1359,7 +1361,7 @@ uint8_t buf[32]; if (format == GNUTLS_TPMKEY_FMT_CTK_PEM) { - ret = _gnutls_x509_encode_octet_string(tdata, tint, &tmpkey); + ret = _gnutls_x509_encode_string(NULL, tdata, tint, &tmpkey); if (ret < 0) { gnutls_assert(); |