summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2015-07-21 08:36:32 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2015-07-21 11:47:41 +0200
commit1e424c305cbbab4970df9b903a4e8e409fb969e4 (patch)
tree92d8917d228e91ed7ced26dbbc119c9a530f28d3
parent84b1f2b39f02c5ba241f50807329b53fdac1a903 (diff)
downloadgnutls-1e424c305cbbab4970df9b903a4e8e409fb969e4.tar.gz
tpm: use gnutls_hex_decode for uuid decoding
-rw-r--r--lib/tpm.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/tpm.c b/lib/tpm.c
index f5613c52d5..23ebc9f0b1 100644
--- a/lib/tpm.c
+++ b/lib/tpm.c
@@ -893,6 +893,7 @@ static int decode_tpmkey_url(const char *url, struct tpmkey_url_st *s)
} else if ((p = strstr(url, "uuid=")) != NULL) {
char tmp_uuid[33];
uint8_t raw_uuid[16];
+ gnutls_datum_t tmp;
p += sizeof("uuid=") - 1;
size = strlen(p);
@@ -906,10 +907,12 @@ static int decode_tpmkey_url(const char *url, struct tpmkey_url_st *s)
}
tmp_uuid[j] = 0;
+ tmp.data = tmp_uuid;
+ tmp.size = strlen(tmp_uuid);
size = sizeof(raw_uuid);
ret =
- _gnutls_hex2bin(tmp_uuid, strlen(tmp_uuid), raw_uuid,
- &size);
+ gnutls_hex_decode(&tmp, raw_uuid,
+ &size);
if (ret < 0) {
gnutls_assert();
goto cleanup;