aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2012-05-04 19:26:31 +0200
committerTobias Brunner <tobias@strongswan.org>2012-06-11 17:09:19 +0200
commit50e51bee54cbc4eba400c0e77dadd19ec05abf17 (patch)
treecd3fa620542f1737bc3273bd1985a1111d79b1c6 /src
parenta2ddcc3695bfd8048f465a36fe1fbd68cd42cf5b (diff)
downloadstrongswan-50e51bee54cbc4eba400c0e77dadd19ec05abf17.tar.bz2
strongswan-50e51bee54cbc4eba400c0e77dadd19ec05abf17.tar.xz
scepclient: Replaced usages of datatot().
Diffstat (limited to 'src')
-rw-r--r--src/scepclient/scep.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/scepclient/scep.c b/src/scepclient/scep.c
index 714d3e929..5cf640fba 100644
--- a/src/scepclient/scep.c
+++ b/src/scepclient/scep.c
@@ -1,4 +1,5 @@
/*
+ * Copyright (C) 2012 Tobias Brunner
* Copyright (C) 2005 Jan Hutter, Martin Willi
* Hochschule fuer Technik Rapperswil
*
@@ -299,9 +300,7 @@ void scep_generate_transaction_id(public_key_t *key, chunk_t *transID,
memcpy(pos, digest.ptr, digest.len);
/* the transaction id is the serial number in hex format */
- transID->len = 2*digest.len;
- transID->ptr = malloc(transID->len + 1);
- datatot(digest.ptr, digest.len, 16, transID->ptr, transID->len + 1);
+ *transID = chunk_to_hex(digest, NULL, FALSE);
}
/**
@@ -390,11 +389,12 @@ static char* escape_http_request(chunk_t req)
int n = 0;
/* compute and allocate the size of the base64-encoded request */
- int len = 1 + 4*((req.len + 2)/3);
+ int len = 1 + 4 * ((req.len + 2) / 3);
char *encoded_req = malloc(len);
/* do the base64 conversion */
- len = datatot(req.ptr, req.len, 64, encoded_req, len);
+ chunk_t base64 = chunk_to_base64(req, encoded_req);
+ len = base64.len + 1;
/* compute newline characters to be inserted every 64 characters */
lines = (len - 2) / 64;
@@ -409,7 +409,7 @@ static char* escape_http_request(chunk_t req)
}
}
- escaped_req = malloc(len + 3*(lines + plus));
+ escaped_req = malloc(len + 3 * (lines + plus));
/* escape special characters in the request */
p1 = encoded_req;