summaryrefslogtreecommitdiff
path: root/lib/tpm.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2012-11-18 19:31:54 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2012-11-18 19:31:54 +0100
commit9e02a17f503668551356bdd10489b93c447834e4 (patch)
tree3ab0e52f14dca48efc1d56317a4cb2a259deb456 /lib/tpm.c
parent96c38a6c89fe0b6f7d826c3588479ec861811054 (diff)
downloadgnutls-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.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/tpm.c b/lib/tpm.c
index e9c8123ae6..d1d74ce0ad 100644
--- a/lib/tpm.c
+++ b/lib/tpm.c
@@ -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();