aboutsummaryrefslogtreecommitdiffstats
path: root/src/scepclient/scep.c
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2009-04-17 07:11:29 +0000
committerAndreas Steffen <andreas.steffen@strongswan.org>2009-04-17 07:11:29 +0000
commit67411e66c3ce7767e2178d613559e01999820771 (patch)
tree6fd577a4bbc1435f34e13451b2fe481bece2f6d5 /src/scepclient/scep.c
parent5cac9e4c3463fb83dfd2908006256dec1205f409 (diff)
downloadstrongswan-67411e66c3ce7767e2178d613559e01999820771.tar.bz2
strongswan-67411e66c3ce7767e2178d613559e01999820771.tar.xz
port the libstrongswan memory allocation methods to pluto
Diffstat (limited to 'src/scepclient/scep.c')
-rw-r--r--src/scepclient/scep.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/scepclient/scep.c b/src/scepclient/scep.c
index 75a23878b..a867815a8 100644
--- a/src/scepclient/scep.c
+++ b/src/scepclient/scep.c
@@ -276,7 +276,7 @@ scep_generate_pkcs10_fingerprint(chunk_t pkcs10, chunk_t *fingerprint)
/* the fingerprint is the MD5 hash in hexadecimal format */
compute_digest(pkcs10, OID_MD5, &digest);
fingerprint->len = 2*digest.len;
- fingerprint->ptr = alloc_bytes(fingerprint->len + 1, "fingerprint");
+ fingerprint->ptr = malloc(fingerprint->len + 1);
datatot(digest.ptr, digest.len, 16, fingerprint->ptr, fingerprint->len + 1);
}
@@ -296,14 +296,14 @@ scep_generate_transaction_id(const RSA_public_key_t *rsak
u_char *pos;
compute_digest(public_key, OID_MD5, &digest);
- pfree(public_key.ptr);
+ free(public_key.ptr);
/* is the most significant bit of the digest set? */
msb_set = (*digest.ptr & 0x80) == 0x80;
/* allocate space for the serialNumber */
serialNumber->len = msb_set + digest.len;
- serialNumber->ptr = alloc_bytes(serialNumber->len, "serialNumber");
+ serialNumber->ptr = malloc(serialNumber->len);
/* the serial number as the two's complement of the digest */
pos = serialNumber->ptr;
@@ -315,7 +315,7 @@ scep_generate_transaction_id(const RSA_public_key_t *rsak
/* the transaction id is the serial number in hex format */
transID->len = 2*digest.len;
- transID->ptr = alloc_bytes(transID->len + 1, "transID");
+ transID->ptr = malloc(transID->len + 1);
datatot(digest.ptr, digest.len, 16, transID->ptr, transID->len + 1);
}
@@ -415,7 +415,7 @@ escape_http_request(chunk_t req)
/* compute and allocate the size of the base64-encoded request */
int len = 1 + 4*((req.len + 2)/3);
- char *encoded_req = alloc_bytes(len, "encoded request");
+ char *encoded_req = malloc(len);
/* do the base64 conversion */
len = datatot(req.ptr, req.len, 64, encoded_req, len);
@@ -431,7 +431,7 @@ escape_http_request(chunk_t req)
plus++;
}
- escaped_req = alloc_bytes(len + 3*(lines + plus), "escaped request");
+ escaped_req = malloc(len + 3*(lines + plus));
/* escape special characters in the request */
p1 = encoded_req;
@@ -457,7 +457,7 @@ escape_http_request(chunk_t req)
n++;
}
*p2 = '\0';
- pfreeany(encoded_req);
+ free(encoded_req);
return escaped_req;
}
#endif
@@ -498,10 +498,10 @@ scep_http_request(const char *url, chunk_t pkcs7, scep_op_t op
/* form complete url */
int len = strlen(url) + 20 + strlen(operation) + strlen(escaped_req) + 1;
- complete_url = alloc_bytes(len, "complete url");
+ complete_url = malloc(len);
snprintf(complete_url, len, "%s?operation=%s&message=%s"
, url, operation, escaped_req);
- pfreeany(escaped_req);
+ free(escaped_req);
curl_easy_setopt(curl, CURLOPT_HTTPGET, TRUE);
headers = curl_slist_append(headers, "Pragma:");
@@ -515,7 +515,7 @@ scep_http_request(const char *url, chunk_t pkcs7, scep_op_t op
/* form complete url */
int len = strlen(url) + 11 + strlen(operation) + 1;
- complete_url = alloc_bytes(len, "complete url");
+ complete_url = malloc(len);
snprintf(complete_url, len, "%s?operation=%s", url, operation);
curl_easy_setopt(curl, CURLOPT_HTTPGET, FALSE);
@@ -533,7 +533,7 @@ scep_http_request(const char *url, chunk_t pkcs7, scep_op_t op
/* form complete url */
int len = strlen(url) + 32 + strlen(operation) + 1;
- complete_url = alloc_bytes(len, "complete url");
+ complete_url = malloc(len);
snprintf(complete_url, len, "%s?operation=%s&message=CAIdentifier"
, url, operation);
@@ -567,7 +567,7 @@ scep_http_request(const char *url, chunk_t pkcs7, scep_op_t op
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
- pfreeany(complete_url);
+ free(complete_url);
return (res == CURLE_OK);
#else /* !LIBCURL */