Commit 0ba09bfd authored by Nils Goroll's avatar Nils Goroll

cstyle(9)

parent e6bb4125
......@@ -268,18 +268,18 @@ ws_alloc_digest(VRT_CTX, const size_t digestsz, void **digestp,
snap = WS_Snapshot(ctx->ws);
if ((b = WS_Alloc(ctx->ws, sizeof *b)) == NULL) {
VERRNOMEM(ctx, "allocating blob in %s.%s()", context, caller);
return NULL;
return (NULL);
}
if ((b->blob = *digestp = WS_Alloc(ctx->ws, digestsz)) == NULL) {
WS_Reset(ctx->ws, snap);
VERRNOMEM(ctx, "allocating hash result in %s.%s()", context,
caller);
return NULL;
return (NULL);
}
b->type = BLOB_BLOBDIGEST_DIGEST_TYPE;
b->len = digestsz;
return b;
return (b);
}
static VCL_BLOB
......@@ -334,7 +334,7 @@ get_scope(const struct vrt_ctx * const restrict ctx,
VERR(ctx, "%s.%s(): object has TOP scope - only "
"accessible in client VCL context",
h->vcl_name, method);
return NULL;
return (NULL);
}
assert(ctx->req->topreq);
......@@ -348,7 +348,7 @@ get_scope(const struct vrt_ctx * const restrict ctx,
if (priv == NULL) {
ERR(ctx, "no priv - out of workspace?");
return NULL;
return (NULL);
}
AN(priv);
......@@ -363,7 +363,7 @@ get_scope(const struct vrt_ctx * const restrict ctx,
if (task == NULL) {
VERRNOMEM(ctx, "allocating task data in %s.%s()",
h->vcl_name, method);
return NULL;
return (NULL);
}
task->magic = VMOD_BLOBDIGEST_DIGEST_TASK_MAGIC;
memcpy(&task->ctx, &h->ctx, sizeof(hash_ctx));
......@@ -372,7 +372,7 @@ get_scope(const struct vrt_ctx * const restrict ctx,
priv->len = sizeof(struct digest_task);
priv->free = NULL;
}
return task;
return (task);
}
VCL_VOID
......@@ -431,31 +431,31 @@ vmod_digest_update(VRT_CTX, struct vmod_blobdigest_digest *h, VCL_BLOB b)
if (h->result != NULL) {
VERR(ctx, "already finalized in %s.update()", h->vcl_name);
return 0;
return (0);
}
task = get_scope(ctx, h, "update");
if (task == NULL)
return 0;
return (0);
if (b == NULL) {
VERR(ctx, "null BLOB passed to %s.update()", h->vcl_name);
return 0;
return (0);
}
if (INIT_FINI(ctx)) {
if (b->len > 0 && b->blob != NULL)
update(h->hash, &h->ctx, b->blob, b->len);
return 1;
return (1);
}
if (task->result != NULL) {
VERR(ctx, "already finalized in %s.update()", h->vcl_name);
return 0;
return (0);
}
if (b->len > 0 && b->blob != NULL)
update(h->hash, &task->ctx, b->blob, b->len);
return 1;
return (1);
}
VCL_BLOB
......@@ -540,7 +540,7 @@ hmac_final(VRT_CTX, enum algorithm hash, VCL_BLOB restrict msg,
b = ws_alloc_digest(ctx, digestsz, &digest, context, caller);
if (b == NULL)
return NULL;
return (NULL);
AN(digest);
......@@ -589,14 +589,14 @@ vmod_hmac_hmac(VRT_CTX, struct vmod_blobdigest_hmac *h, VCL_BLOB msg)
CHECK_OBJ_NOTNULL(h, VMOD_BLOBDIGEST_HMAC_MAGIC);
if (msg == NULL || msg->blob == NULL) {
VERR(ctx, "msg is NULL in %s.hmac()", h->vcl_name);
return NULL;
return (NULL);
}
memcpy(&inner_ctx, &h->inner_ctx, sizeof(hash_ctx));
memcpy(&outer_ctx, &h->outer_ctx, sizeof(hash_ctx));
return hmac_final(ctx, h->hash, msg, &inner_ctx, &outer_ctx,
h->vcl_name, "hmac");
return (hmac_final(ctx, h->hash, msg, &inner_ctx, &outer_ctx,
h->vcl_name, "hmac"));
}
VCL_DURATION
......@@ -647,13 +647,13 @@ vmod_hash(VRT_CTX, VCL_ENUM hashs, VCL_BLOB msg)
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
if (msg == NULL)
return NULL;
return (NULL);
b = ws_alloc_digest(ctx, hashspec[hash].digestsz, &r,
"blobdigest", "hash");
if (b == NULL)
return NULL;
return (NULL);
AN(r);
digest(hash, hctx, msg, r);
......@@ -669,21 +669,21 @@ vmod_hmacf(VRT_CTX, VCL_ENUM hashs, VCL_BLOB key, VCL_BLOB msg)
if (key == NULL || key->blob == NULL) {
ERR(ctx, "key is NULL in blobdigest.hmacf()");
return NULL;
return (NULL);
}
if (msg == NULL || msg->blob == NULL) {
ERR(ctx, "msg is NULL in blobdigest.hmacf()");
return NULL;
return (NULL);
}
hmac_init(hash, key, &inner_ctx, &outer_ctx);
return hmac_final(ctx, hash, msg, &inner_ctx, &outer_ctx, "blobdigest",
"hmacf");
return (hmac_final(ctx, hash, msg, &inner_ctx, &outer_ctx, "blobdigest",
"hmacf"));
}
VCL_STRING
vmod_version(VRT_CTX __attribute__((unused)))
{
return VERSION;
return (VERSION);
}
/* vend.h is varinshd private */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment