renamed empty_chunk to chunk_empty

This commit is contained in:
Andreas Steffen 2009-04-17 11:00:37 +00:00
parent 3a80181b61
commit 0dd4bc0333
23 changed files with 90 additions and 90 deletions

View File

@ -838,7 +838,7 @@ load_acerts(void)
{ {
while (n--) while (n--)
{ {
chunk_t blob = empty_chunk; chunk_t blob = chunk_empty;
bool pgp = FALSE; bool pgp = FALSE;
if (load_coded_file(filelist[n]->d_name, NULL, "acert", &blob, &pgp)) if (load_coded_file(filelist[n]->d_name, NULL, "acert", &blob, &pgp))

View File

@ -108,7 +108,7 @@ asn1_algorithmIdentifier(int oid)
case OID_SHA1: case OID_SHA1:
return ASN1_sha1_id; return ASN1_sha1_id;
default: default:
return empty_chunk; return chunk_empty;
} }
} }
@ -159,7 +159,7 @@ asn1_build_known_oid(int n)
if (n < 0 || n >= OID_MAX) if (n < 0 || n >= OID_MAX)
{ {
return empty_chunk; return chunk_empty;
} }
i = oid_names[n].level + 1; i = oid_names[n].level + 1;
@ -567,7 +567,7 @@ extract_object(asn1Object_t const *objects,
chunk_t *blob1; chunk_t *blob1;
u_char *start_ptr; u_char *start_ptr;
*object = empty_chunk; *object = chunk_empty;
if (obj.flags & ASN1_END) /* end of loop or option found */ if (obj.flags & ASN1_END) /* end of loop or option found */
{ {

View File

@ -90,7 +90,7 @@ trusted_ca(chunk_t a, chunk_t b, int *pathlen)
while ((*pathlen)++ < MAX_CA_PATH_LEN) while ((*pathlen)++ < MAX_CA_PATH_LEN)
{ {
x509cert_t *cacert = get_authcert(a, empty_chunk, empty_chunk, AUTH_CA); x509cert_t *cacert = get_authcert(a, chunk_empty, chunk_empty, AUTH_CA);
/* cacert not found or self-signed root cacert-> exit */ /* cacert not found or self-signed root cacert-> exit */
if (cacert == NULL || same_dn(cacert->issuer, a)) if (cacert == NULL || same_dn(cacert->issuer, a))

View File

@ -50,7 +50,7 @@ get_mycert(cert_t cert)
case CERT_X509_SIGNATURE: case CERT_X509_SIGNATURE:
return cert.u.x509->certificate; return cert.u.x509->certificate;
default: default:
return empty_chunk; return chunk_empty;
} }
} }
@ -112,7 +112,7 @@ load_coded_file(const char *filename, prompt_pass_t *pass, const char *type
/* a conversion error has occured */ /* a conversion error has occured */
plog(" %s", ugh); plog(" %s", ugh);
free(blob->ptr); free(blob->ptr);
*blob = empty_chunk; *blob = chunk_empty;
} }
else else
{ {
@ -130,7 +130,7 @@ load_rsa_private_key(const char* filename, prompt_pass_t *pass
{ {
err_t ugh = NULL; err_t ugh = NULL;
bool pgp = FALSE; bool pgp = FALSE;
chunk_t blob = empty_chunk; chunk_t blob = chunk_empty;
const char *path = concatenate_paths(PRIVATE_KEY_PATH, filename); const char *path = concatenate_paths(PRIVATE_KEY_PATH, filename);
@ -160,7 +160,7 @@ bool
load_cert(const char *filename, const char *label, cert_t *cert) load_cert(const char *filename, const char *label, cert_t *cert)
{ {
bool pgp = FALSE; bool pgp = FALSE;
chunk_t blob = empty_chunk; chunk_t blob = chunk_empty;
/* initialize cert struct */ /* initialize cert struct */
cert->type = CERT_NONE; cert->type = CERT_NONE;

View File

@ -822,7 +822,7 @@ extract_end(struct end *dst, const whack_end_t *src, const char *which)
} }
} }
dst->ca = empty_chunk; dst->ca = chunk_empty;
/* decode CA distinguished name, if any */ /* decode CA distinguished name, if any */
if (src->ca != NULL) if (src->ca != NULL)
@ -838,7 +838,7 @@ extract_end(struct end *dst, const whack_end_t *src, const char *which)
if (ugh != NULL) if (ugh != NULL)
{ {
plog("bad CA string '%s': %s (ignored)", src->ca, ugh); plog("bad CA string '%s': %s (ignored)", src->ca, ugh);
dst->ca = empty_chunk; dst->ca = chunk_empty;
} }
} }
} }
@ -3777,7 +3777,7 @@ get_peer_ca_and_groups(struct connection *c, const ietfAttrList_t **peer_list)
} }
return p1st->st_peer_pubkey->issuer; return p1st->st_peer_pubkey->issuer;
} }
return empty_chunk; return chunk_empty;
} }
struct connection * struct connection *

View File

@ -351,7 +351,7 @@ load_crls(void)
while (n--) while (n--)
{ {
bool pgp = FALSE; bool pgp = FALSE;
chunk_t blob = empty_chunk; chunk_t blob = chunk_empty;
char *filename = filelist[n]->d_name; char *filename = filelist[n]->d_name;
if (load_coded_file(filename, NULL, "crl", &blob, &pgp)) if (load_coded_file(filename, NULL, "crl", &blob, &pgp))
@ -406,7 +406,7 @@ parse_x509crl(chunk_t blob, u_int level0, x509crl_t *crl)
asn1_ctx_t ctx; asn1_ctx_t ctx;
bool critical; bool critical;
chunk_t extnID; chunk_t extnID;
chunk_t userCertificate = empty_chunk; chunk_t userCertificate = chunk_empty;
chunk_t object; chunk_t object;
u_int level; u_int level;
int objectID = 0; int objectID = 0;

View File

@ -29,7 +29,7 @@
#include "log.h" #include "log.h"
#include "whack.h" /* for RC_LOG_SERIOUS */ #include "whack.h" /* for RC_LOG_SERIOUS */
const chunk_t empty_chunk = { NULL, 0 }; const chunk_t chunk_empty = { NULL, 0 };
bool bool
all_zero(const unsigned char *m, size_t len) all_zero(const unsigned char *m, size_t len)

View File

@ -81,7 +81,7 @@ typedef struct chunk chunk_t;
extern char* temporary_cyclic_buffer(void); extern char* temporary_cyclic_buffer(void);
extern const char* concatenate_paths(const char *a, const char *b); extern const char* concatenate_paths(const char *a, const char *b);
extern const chunk_t empty_chunk; extern const chunk_t chunk_empty;
/* compare two chunks */ /* compare two chunks */
extern int cmp_chunk(chunk_t a, chunk_t b); extern int cmp_chunk(chunk_t a, chunk_t b);

View File

@ -309,7 +309,7 @@ fetch_curl(char *url, chunk_t *blob)
{ {
#ifdef LIBCURL #ifdef LIBCURL
char errorbuffer[CURL_ERROR_SIZE] = ""; char errorbuffer[CURL_ERROR_SIZE] = "";
chunk_t response = empty_chunk; chunk_t response = chunk_empty;
CURLcode res; CURLcode res;
/* get it with libcurl */ /* get it with libcurl */
@ -605,7 +605,7 @@ fetch_crls(bool cache_crls)
while (req != NULL) while (req != NULL)
{ {
bool valid_crl = FALSE; bool valid_crl = FALSE;
chunk_t blob = empty_chunk; chunk_t blob = chunk_empty;
generalName_t *gn = req->distributionPoints; generalName_t *gn = req->distributionPoints;
const char *ldaphost; const char *ldaphost;
ca_info_t *ca; ca_info_t *ca;
@ -670,7 +670,7 @@ fetch_ocsp_status(ocsp_location_t* location)
{ {
#ifdef LIBCURL #ifdef LIBCURL
chunk_t request; chunk_t request;
chunk_t response = empty_chunk; chunk_t response = chunk_empty;
CURL* curl; CURL* curl;
CURLcode res; CURLcode res;

View File

@ -2457,7 +2457,7 @@ switch_connection(struct msg_digest *md, struct id *peer, bool initiator)
struct connection *c = st->st_connection; struct connection *c = st->st_connection;
chunk_t peer_ca = (st->st_peer_pubkey != NULL) chunk_t peer_ca = (st->st_peer_pubkey != NULL)
? st->st_peer_pubkey->issuer : empty_chunk; ? st->st_peer_pubkey->issuer : chunk_empty;
DBG(DBG_CONTROL, DBG(DBG_CONTROL,
char buf[BUF_LEN]; char buf[BUF_LEN];
@ -3441,7 +3441,7 @@ main_inI2_outR2(struct msg_digest *md)
} }
else else
{ {
if (!build_and_ship_CR(CERT_X509_SIGNATURE, empty_chunk if (!build_and_ship_CR(CERT_X509_SIGNATURE, chunk_empty
, &md->rbody, np)) , &md->rbody, np))
return STF_INTERNAL_ERROR; return STF_INTERNAL_ERROR;
} }

View File

@ -83,7 +83,7 @@ static pubkey_t*
allocate_RSA_public_key(const cert_t cert) allocate_RSA_public_key(const cert_t cert)
{ {
pubkey_t *pk = malloc_thing(pubkey_t); pubkey_t *pk = malloc_thing(pubkey_t);
chunk_t e = empty_chunk, n = empty_chunk; chunk_t e = chunk_empty, n = chunk_empty;
switch (cert.type) switch (cert.type)
{ {
@ -107,8 +107,8 @@ allocate_RSA_public_key(const cert_t cert)
pk->alg = PUBKEY_ALG_RSA; pk->alg = PUBKEY_ALG_RSA;
pk->id = empty_id; pk->id = empty_id;
pk->issuer = empty_chunk; pk->issuer = chunk_empty;
pk->serial = empty_chunk; pk->serial = chunk_empty;
return pk; return pk;
} }
@ -179,7 +179,7 @@ get_secret(const struct connection *c, enum PrivateKeyKind kind, bool asym)
{ {
/* roadwarrior: replace him with 0.0.0.0 */ /* roadwarrior: replace him with 0.0.0.0 */
rw_id.kind = c->spd.that.id.kind; rw_id.kind = c->spd.that.id.kind;
rw_id.name = empty_chunk; rw_id.name = chunk_empty;
happy(anyaddr(addrtypeof(&c->spd.that.host_addr), &rw_id.ip_addr)); happy(anyaddr(addrtypeof(&c->spd.that.host_addr), &rw_id.ip_addr));
his_id = &rw_id; his_id = &rw_id;
} }
@ -1137,8 +1137,8 @@ public_key_from_rsa(const RSA_public_key_t *k)
zero(p); zero(p);
p->id = empty_id; /* don't know, doesn't matter */ p->id = empty_id; /* don't know, doesn't matter */
p->issuer = empty_chunk; p->issuer = chunk_empty;
p->serial = empty_chunk; p->serial = chunk_empty;
p->alg = PUBKEY_ALG_RSA; p->alg = PUBKEY_ALG_RSA;
memcpy(p->u.rsa.keyid, k->keyid, sizeof(p->u.rsa.keyid)); memcpy(p->u.rsa.keyid, k->keyid, sizeof(p->u.rsa.keyid));
@ -1387,8 +1387,8 @@ add_public_key(const struct id *id, enum dns_auth_level dns_auth_level,
pk->dns_auth_level = dns_auth_level; pk->dns_auth_level = dns_auth_level;
pk->alg = alg; pk->alg = alg;
pk->until_time = UNDEFINED_TIME; pk->until_time = UNDEFINED_TIME;
pk->issuer = empty_chunk; pk->issuer = chunk_empty;
pk->serial = empty_chunk; pk->serial = chunk_empty;
install_public_key(pk, head); install_public_key(pk, head);
return NULL; return NULL;
@ -1468,7 +1468,7 @@ add_pgp_public_key(pgpcert_t *cert , time_t until
pk->id.name.len = PGP_FINGERPRINT_SIZE; pk->id.name.len = PGP_FINGERPRINT_SIZE;
pk->dns_auth_level = dns_auth_level; pk->dns_auth_level = dns_auth_level;
pk->until_time = until; pk->until_time = until;
delete_public_keys(&pk->id, pk->alg, empty_chunk, empty_chunk); delete_public_keys(&pk->id, pk->alg, chunk_empty, chunk_empty);
install_public_key(pk, &pubkeys); install_public_key(pk, &pubkeys);
} }

View File

@ -93,8 +93,8 @@ init_internal_addr(internal_addr_t *ia)
ia->attr_set = LEMPTY; ia->attr_set = LEMPTY;
ia->xauth_attr_set = LEMPTY; ia->xauth_attr_set = LEMPTY;
ia->xauth_secret.user_name = empty_chunk; ia->xauth_secret.user_name = chunk_empty;
ia->xauth_secret.user_password = empty_chunk; ia->xauth_secret.user_password = chunk_empty;
ia->xauth_type = XAUTH_TYPE_GENERIC; ia->xauth_type = XAUTH_TYPE_GENERIC;
ia->xauth_status = XAUTH_STATUS_FAIL; ia->xauth_status = XAUTH_STATUS_FAIL;
ia->unity_attr_set = LEMPTY; ia->unity_attr_set = LEMPTY;

View File

@ -321,7 +321,7 @@ build_ocsp_location(const x509cert_t *cert, ocsp_location_t *location)
} }
} }
location->nonce = empty_chunk; location->nonce = chunk_empty;
location->certinfo = NULL; location->certinfo = NULL;
return TRUE; return TRUE;
@ -730,7 +730,7 @@ generate_signature(chunk_t digest, smartcard_t *sc
if (!scx_establish_context(sc) || !scx_login(sc)) if (!scx_establish_context(sc) || !scx_login(sc))
{ {
scx_release_context(sc); scx_release_context(sc);
return empty_chunk; return chunk_empty;
} }
siglen = scx_get_keylength(sc); siglen = scx_get_keylength(sc);
@ -739,7 +739,7 @@ generate_signature(chunk_t digest, smartcard_t *sc
{ {
plog("failed to get keylength from smartcard"); plog("failed to get keylength from smartcard");
scx_release_context(sc); scx_release_context(sc);
return empty_chunk; return chunk_empty;
} }
DBG(DBG_CONTROL | DBG_CRYPT, DBG(DBG_CONTROL | DBG_CRYPT,
@ -779,7 +779,7 @@ build_signature(chunk_t tbsRequest)
chunk_t digest_raw = { digest_buf, MAX_DIGEST_LEN }; chunk_t digest_raw = { digest_buf, MAX_DIGEST_LEN };
if (!compute_digest(tbsRequest, OID_SHA1, &digest_raw)) if (!compute_digest(tbsRequest, OID_SHA1, &digest_raw))
return empty_chunk; return chunk_empty;
/* according to PKCS#1 v2.1 digest must be packaged into /* according to PKCS#1 v2.1 digest must be packaged into
* an ASN.1 structure for encryption * an ASN.1 structure for encryption
@ -796,7 +796,7 @@ build_signature(chunk_t tbsRequest)
/* has the RSA signature generation been successful? */ /* has the RSA signature generation been successful? */
if (sigdata.ptr == NULL) if (sigdata.ptr == NULL)
return empty_chunk; return chunk_empty;
/* include our certificate */ /* include our certificate */
certs = asn1_wrap(ASN1_CONTEXT_C_0, "m" certs = asn1_wrap(ASN1_CONTEXT_C_0, "m"
@ -929,7 +929,7 @@ build_tbs_request(ocsp_location_t *location, bool has_requestor_cert)
return asn1_wrap(ASN1_SEQUENCE, "mmm" return asn1_wrap(ASN1_SEQUENCE, "mmm"
, (has_requestor_cert) , (has_requestor_cert)
? build_requestor_name() ? build_requestor_name()
: empty_chunk : chunk_empty
, build_request_list(location) , build_request_list(location)
, build_request_ext(location)); , build_request_ext(location));
} }
@ -965,7 +965,7 @@ build_ocsp_request(ocsp_location_t *location)
/* sign tbsReuqest */ /* sign tbsReuqest */
signature = (has_requestor_cert)? build_signature(tbsRequest) signature = (has_requestor_cert)? build_signature(tbsRequest)
: empty_chunk; : chunk_empty;
unlock_certs_and_keys("build_ocsp_request"); unlock_certs_and_keys("build_ocsp_request");
@ -985,7 +985,7 @@ valid_ocsp_response(response_t *res)
lock_authcert_list("valid_ocsp_response"); lock_authcert_list("valid_ocsp_response");
authcert = get_authcert(res->responder_id_name, empty_chunk authcert = get_authcert(res->responder_id_name, chunk_empty
, res->responder_id_key, AUTH_OCSP | AUTH_CA); , res->responder_id_key, AUTH_OCSP | AUTH_CA);
if (authcert == NULL) if (authcert == NULL)
@ -1333,7 +1333,7 @@ add_ocsp_location(const ocsp_location_t *loc, ocsp_location_t **chain)
if (loc->authKeyID.ptr == NULL) if (loc->authKeyID.ptr == NULL)
{ {
location->authKeyID = empty_chunk; location->authKeyID = chunk_empty;
} }
else else
{ {
@ -1342,7 +1342,7 @@ add_ocsp_location(const ocsp_location_t *loc, ocsp_location_t **chain)
if (loc->authKeySerialNumber.ptr == NULL) if (loc->authKeySerialNumber.ptr == NULL)
{ {
location->authKeySerialNumber = empty_chunk; location->authKeySerialNumber = chunk_empty;
} }
else else
{ {

View File

@ -69,7 +69,7 @@ match(const char *pattern, const chunk_t *ch)
static bool static bool
find_boundary(const char* tag, chunk_t *line) find_boundary(const char* tag, chunk_t *line)
{ {
chunk_t name = empty_chunk; chunk_t name = chunk_empty;
if (!present("-----", line)) if (!present("-----", line))
return FALSE; return FALSE;
@ -117,7 +117,7 @@ extract_token(chunk_t *token, char termination, chunk_t *src)
u_char *eot = memchr(src->ptr, termination, src->len); u_char *eot = memchr(src->ptr, termination, src->len);
/* initialize empty token */ /* initialize empty token */
*token = empty_chunk; *token = chunk_empty;
if (eot == NULL) /* termination symbol not found */ if (eot == NULL) /* termination symbol not found */
return FALSE; return FALSE;
@ -334,8 +334,8 @@ pemtobin(chunk_t *blob, prompt_pass_t *pass, const char* label, bool *pgp)
chunk_t src = *blob; chunk_t src = *blob;
chunk_t dst = *blob; chunk_t dst = *blob;
chunk_t line = empty_chunk; chunk_t line = chunk_empty;
chunk_t iv = empty_chunk; chunk_t iv = chunk_empty;
u_char iv_buf[MAX_DIGEST_LEN]; u_char iv_buf[MAX_DIGEST_LEN];
@ -371,8 +371,8 @@ pemtobin(chunk_t *blob, prompt_pass_t *pass, const char* label, bool *pgp)
} }
if (state == PEM_HEADER) if (state == PEM_HEADER)
{ {
chunk_t name = empty_chunk; chunk_t name = chunk_empty;
chunk_t value = empty_chunk; chunk_t value = chunk_empty;
/* an empty line separates HEADER and BODY */ /* an empty line separates HEADER and BODY */
if (line.len == 0) if (line.len == 0)

View File

@ -436,7 +436,7 @@ parse_pgp(chunk_t blob, pgpcert_t *cert, RSA_private_key_t *key)
while (blob.len > 0) while (blob.len > 0)
{ {
chunk_t packet = empty_chunk; chunk_t packet = chunk_empty;
u_char packet_tag = *blob.ptr; u_char packet_tag = *blob.ptr;
DBG(DBG_PARSING, DBG(DBG_PARSING,

View File

@ -435,7 +435,7 @@ RSA_encrypt(const RSA_public_key_t *key, chunk_t in)
int i; int i;
if (padding < 8 || key->k > RSA_MAX_OCTETS) if (padding < 8 || key->k > RSA_MAX_OCTETS)
return empty_chunk; return chunk_empty;
/* add padding according to PKCS#1 7.2.1 1.+2. */ /* add padding according to PKCS#1 7.2.1 1.+2. */
*pos++ = 0x00; *pos++ = 0x00;
@ -576,7 +576,7 @@ pkcs1_build_signature(chunk_t tbs, int hash_alg, const RSA_private_key_t *key
alg_id = ASN1_sha1_id; alg_id = ASN1_sha1_id;
break; break;
default: default:
return empty_chunk; return chunk_empty;
} }
compute_digest(tbs, hash_alg, &digest); compute_digest(tbs, hash_alg, &digest);

View File

@ -251,7 +251,7 @@ pkcs7_parse_signedData(chunk_t blob, contentInfo_t *data, x509cert_t **cert
int objectID = 0; int objectID = 0;
contentInfo_t cInfo = empty_contentInfo; contentInfo_t cInfo = empty_contentInfo;
chunk_t encrypted_digest = empty_chunk; chunk_t encrypted_digest = chunk_empty;
if (!pkcs7_parse_contentInfo(blob, 0, &cInfo)) if (!pkcs7_parse_contentInfo(blob, 0, &cInfo))
return FALSE; return FALSE;
@ -378,9 +378,9 @@ pkcs7_parse_envelopedData(chunk_t blob, chunk_t *data
{ {
asn1_ctx_t ctx; asn1_ctx_t ctx;
chunk_t object; chunk_t object;
chunk_t iv = empty_chunk; chunk_t iv = chunk_empty;
chunk_t symmetric_key = empty_chunk; chunk_t symmetric_key = chunk_empty;
chunk_t encrypted_content = empty_chunk; chunk_t encrypted_content = chunk_empty;
u_char buf[BUF_LEN]; u_char buf[BUF_LEN];
u_int level; u_int level;
@ -390,7 +390,7 @@ pkcs7_parse_envelopedData(chunk_t blob, chunk_t *data
int objectID = 0; int objectID = 0;
contentInfo_t cInfo = empty_contentInfo; contentInfo_t cInfo = empty_contentInfo;
*data = empty_chunk; *data = chunk_empty;
if (!pkcs7_parse_contentInfo(blob, 0, &cInfo)) if (!pkcs7_parse_contentInfo(blob, 0, &cInfo))
goto failed; goto failed;
@ -639,7 +639,7 @@ pkcs7_build_contentInfo(contentInfo_t *cInfo)
case OID_UNKNOWN: case OID_UNKNOWN:
default: default:
fprintf(stderr, "invalid pkcs7 contentInfo type"); fprintf(stderr, "invalid pkcs7 contentInfo type");
return empty_chunk; return chunk_empty;
} }
return (cInfo->content.ptr == NULL) return (cInfo->content.ptr == NULL)
@ -682,9 +682,9 @@ pkcs7_build_signedData(chunk_t data, chunk_t attributes, const x509cert_t *cert
} }
else else
{ {
encryptedDigest = (data.ptr == NULL)? empty_chunk encryptedDigest = (data.ptr == NULL)? chunk_empty
: pkcs1_build_signature(data, digest_alg, key, FALSE); : pkcs1_build_signature(data, digest_alg, key, FALSE);
authenticatedAttributes = empty_chunk; authenticatedAttributes = chunk_empty;
} }
signerInfo = asn1_wrap(ASN1_SEQUENCE, "cmcmcm" signerInfo = asn1_wrap(ASN1_SEQUENCE, "cmcmcm"
@ -696,7 +696,7 @@ pkcs7_build_signedData(chunk_t data, chunk_t attributes, const x509cert_t *cert
, encryptedDigest); , encryptedDigest);
pkcs7Data.type = OID_PKCS7_DATA; pkcs7Data.type = OID_PKCS7_DATA;
pkcs7Data.content = (data.ptr == NULL)? empty_chunk pkcs7Data.content = (data.ptr == NULL)? chunk_empty
: asn1_simple_object(ASN1_OCTET_STRING, data); : asn1_simple_object(ASN1_OCTET_STRING, data);
signedData.type = OID_PKCS7_SIGNED_DATA; signedData.type = OID_PKCS7_SIGNED_DATA;

View File

@ -179,7 +179,7 @@ key_add_request(const whack_message_t *msg)
{ {
if (!msg->whack_addkey) if (!msg->whack_addkey)
delete_public_keys(&keyid, msg->pubkey_alg delete_public_keys(&keyid, msg->pubkey_alg
, empty_chunk, empty_chunk); , chunk_empty, chunk_empty);
if (msg->keyval.len == 0) if (msg->keyval.len == 0)
{ {

View File

@ -1764,7 +1764,7 @@ scx_get_pin(smartcard_t *sc, int whackfd)
} }
/* wrong pin - we try another round */ /* wrong pin - we try another round */
sc->pin = empty_chunk; sc->pin = chunk_empty;
} }
if (sc->valid) if (sc->valid)
@ -1790,7 +1790,7 @@ scx_free_pin(chunk_t *pin)
/* clear pin field in memory */ /* clear pin field in memory */
memset(pin->ptr, '\0', pin->len); memset(pin->ptr, '\0', pin->len);
free(pin->ptr); free(pin->ptr);
*pin = empty_chunk; *pin = chunk_empty;
} }
} }

View File

@ -410,8 +410,8 @@ update_chunk(chunk_t *ch, int n)
static err_t static err_t
init_rdn(chunk_t dn, chunk_t *rdn, chunk_t *attribute, bool *next) init_rdn(chunk_t dn, chunk_t *rdn, chunk_t *attribute, bool *next)
{ {
*rdn = empty_chunk; *rdn = chunk_empty;
*attribute = empty_chunk; *attribute = chunk_empty;
/* a DN is a SEQUENCE OF RDNs */ /* a DN is a SEQUENCE OF RDNs */
@ -444,8 +444,8 @@ get_next_rdn(chunk_t *rdn, chunk_t * attribute, chunk_t *oid, chunk_t *value
chunk_t body; chunk_t body;
/* initialize return values */ /* initialize return values */
*oid = empty_chunk; *oid = chunk_empty;
*value = empty_chunk; *value = chunk_empty;
/* if all attributes have been parsed, get next rdn */ /* if all attributes have been parsed, get next rdn */
if (attribute->len <= 0) if (attribute->len <= 0)
@ -695,8 +695,8 @@ atodn(char *src, chunk_t *dn)
chunk_t asn1_rdn_seq_len = { rdn_seq_len_buf, 0 }; chunk_t asn1_rdn_seq_len = { rdn_seq_len_buf, 0 };
chunk_t asn1_rdn_set_len = { rdn_set_len_buf, 0 }; chunk_t asn1_rdn_set_len = { rdn_set_len_buf, 0 };
chunk_t asn1_dn_seq_len = { dn_seq_len_buf, 0 }; chunk_t asn1_dn_seq_len = { dn_seq_len_buf, 0 };
chunk_t oid = empty_chunk; chunk_t oid = chunk_empty;
chunk_t name = empty_chunk; chunk_t name = chunk_empty;
int whitespace = 0; int whitespace = 0;
int rdn_seq_len = 0; int rdn_seq_len = 0;
@ -746,7 +746,7 @@ atodn(char *src, chunk_t *dn)
code_asn1_length(x501rdns[pos].oid.len, &asn1_oid_len); code_asn1_length(x501rdns[pos].oid.len, &asn1_oid_len);
/* reset oid and change state */ /* reset oid and change state */
oid = empty_chunk; oid = chunk_empty;
state = SEARCH_NAME; state = SEARCH_NAME;
} }
break; break;
@ -804,7 +804,7 @@ atodn(char *src, chunk_t *dn)
dn_seq_len += 1 + asn1_rdn_set_len.len + rdn_set_len; dn_seq_len += 1 + asn1_rdn_set_len.len + rdn_set_len;
/* reset name and change state */ /* reset name and change state */
name = empty_chunk; name = chunk_empty;
state = SEARCH_OID; state = SEARCH_OID;
} }
break; break;
@ -1162,7 +1162,7 @@ build_tbs_x509cert(x509cert_t *cert, const RSA_public_key_t *rsa)
/* version is always X.509v3 */ /* version is always X.509v3 */
chunk_t version = asn1_simple_object(ASN1_CONTEXT_C_0, ASN1_INTEGER_2); chunk_t version = asn1_simple_object(ASN1_CONTEXT_C_0, ASN1_INTEGER_2);
chunk_t extensions = empty_chunk; chunk_t extensions = chunk_empty;
if (cert->subjectAltName != NULL) if (cert->subjectAltName != NULL)
{ {
@ -1509,7 +1509,7 @@ gntoid(struct id *id, const generalName_t *gn)
break; break;
default: default:
id->kind = ID_NONE; id->kind = ID_NONE;
id->name = empty_chunk; id->name = chunk_empty;
} }
} }
@ -1686,7 +1686,7 @@ parse_generalNames(chunk_t blob, int level0, bool implicit)
*/ */
chunk_t get_directoryName(chunk_t blob, int level, bool implicit) chunk_t get_directoryName(chunk_t blob, int level, bool implicit)
{ {
chunk_t name = empty_chunk; chunk_t name = chunk_empty;
generalName_t * gn = parse_generalNames(blob, level, implicit); generalName_t * gn = parse_generalNames(blob, level, implicit);
if (gn != NULL && gn->kind == GN_DIRECTORY_NAME) if (gn != NULL && gn->kind == GN_DIRECTORY_NAME)

View File

@ -115,8 +115,8 @@ static chunk_t
build_req_info_attributes(pkcs10_t* pkcs10) build_req_info_attributes(pkcs10_t* pkcs10)
{ {
chunk_t subjectAltNames = empty_chunk; chunk_t subjectAltNames = chunk_empty;
chunk_t challengePassword = empty_chunk; chunk_t challengePassword = chunk_empty;
if (pkcs10->subjectAltNames != NULL) if (pkcs10->subjectAltNames != NULL)
{ {
@ -185,7 +185,7 @@ pkcs10_build_request(pkcs10_t *pkcs10, int signature_alg)
* *
* @param[in] key rsakey of type #rsakey_t * @param[in] key rsakey of type #rsakey_t
* @param[in] subject DER-coded subject distinguished name * @param[in] subject DER-coded subject distinguished name
* @param[in] challengePassword challenge password or empty_chunk * @param[in] challengePassword challenge password or chunk_empty
* @param[in] subjectAltNames linked list of subjectAltNames or NULL * @param[in] subjectAltNames linked list of subjectAltNames or NULL
* @return pointer to a #pkcs10_t object * @return pointer to a #pkcs10_t object
*/ */

View File

@ -477,7 +477,7 @@ scep_http_request(const char *url, chunk_t pkcs7, scep_op_t op
CURLcode res; CURLcode res;
/* initialize response */ /* initialize response */
*response = empty_chunk; *response = chunk_empty;
/* initialize curl context */ /* initialize curl context */
curl = curl_easy_init(); curl = curl_easy_init();

View File

@ -348,15 +348,15 @@ int main(int argc, char **argv)
err_t ugh = NULL; err_t ugh = NULL;
/* initialize global variables */ /* initialize global variables */
pkcs1 = empty_chunk; pkcs1 = chunk_empty;
pkcs7 = empty_chunk; pkcs7 = chunk_empty;
serialNumber = empty_chunk; serialNumber = chunk_empty;
transID = empty_chunk; transID = chunk_empty;
fingerprint = empty_chunk; fingerprint = chunk_empty;
issuerAndSubject = empty_chunk; issuerAndSubject = chunk_empty;
challengePassword = empty_chunk; challengePassword = chunk_empty;
getCertInitial = empty_chunk; getCertInitial = chunk_empty;
scep_response = empty_chunk; scep_response = chunk_empty;
log_to_stderr = TRUE; log_to_stderr = TRUE;
for (;;) for (;;)
@ -774,7 +774,7 @@ int main(int argc, char **argv)
else else
{ {
char buf[IDTOA_BUF]; char buf[IDTOA_BUF];
chunk_t dn = empty_chunk; chunk_t dn = chunk_empty;
dn.ptr = buf; dn.ptr = buf;
@ -957,8 +957,8 @@ int main(int argc, char **argv)
time_t poll_start; time_t poll_start;
x509cert_t *certs = NULL; x509cert_t *certs = NULL;
chunk_t envelopedData = empty_chunk; chunk_t envelopedData = chunk_empty;
chunk_t certData = empty_chunk; chunk_t certData = chunk_empty;
contentInfo_t data = empty_contentInfo; contentInfo_t data = empty_contentInfo;
scep_attributes_t attrs = empty_scep_attributes; scep_attributes_t attrs = empty_scep_attributes;