Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-blobdigest
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-blobdigest
Commits
7f4e2abf
Unverified
Commit
7f4e2abf
authored
May 28, 2023
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename ERR macros -> FAIL
parent
0f4d0d8a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
+19
-19
vmod_blobdigest.c
src/vmod_blobdigest.c
+19
-19
No files found.
src/vmod_blobdigest.c
View file @
7f4e2abf
...
...
@@ -41,17 +41,17 @@
#include "byte_order.h"
#define
ERR
(ctx, msg) \
#define
FAIL
(ctx, msg) \
VRT_fail((ctx), "vmod blobdigest error: " msg)
#define V
ERR
(ctx, fmt, ...) \
#define V
FAIL
(ctx, fmt, ...) \
VRT_fail((ctx), "vmod blobdigest error: " fmt, __VA_ARGS__)
#define V
ERR
NOMEM(ctx, fmt, ...) \
V
ERR
((ctx), fmt ", out of space", __VA_ARGS__)
#define V
FAIL
NOMEM(ctx, fmt, ...) \
V
FAIL
((ctx), fmt ", out of space", __VA_ARGS__)
#define
ERR
NOMEM(ctx, msg) \
ERR
((ctx), msg ", out of space")
#define
FAIL
NOMEM(ctx, msg) \
FAIL
((ctx), msg ", out of space")
#define INIT_FINI(ctx) (((ctx)->method & (VCL_MET_INIT | VCL_MET_FINI)) != 0)
...
...
@@ -268,7 +268,7 @@ ws_alloc_digest(VRT_CTX, const size_t digestsz, void **digestp,
spc
=
WS_Alloc
(
ctx
->
ws
,
PRNDUP
(
digestsz
)
+
sizeof
*
b
);
if
(
spc
==
NULL
)
{
V
ERR
NOMEM
(
ctx
,
"WS_Alloc in %s.%s()"
,
context
,
caller
);
V
FAIL
NOMEM
(
ctx
,
"WS_Alloc in %s.%s()"
,
context
,
caller
);
return
(
NULL
);
}
...
...
@@ -292,7 +292,7 @@ heap_alloc_digest(VRT_CTX, const size_t digestsz, void **digestp,
spc
=
malloc
(
PRNDUP
(
digestsz
)
+
sizeof
*
b
);
if
(
spc
==
NULL
)
{
V
ERR
NOMEM
(
ctx
,
"malloc in %s.%s()"
,
context
,
caller
);
V
FAIL
NOMEM
(
ctx
,
"malloc in %s.%s()"
,
context
,
caller
);
return
(
NULL
);
}
...
...
@@ -329,7 +329,7 @@ get_scope(const struct vrt_ctx * const restrict ctx,
break
;
case
TOP
:
{
if
(
ctx
->
req
==
NULL
)
{
V
ERR
(
ctx
,
"%s.%s(): object has TOP scope - only "
V
FAIL
(
ctx
,
"%s.%s(): object has TOP scope - only "
"accessible in client VCL context"
,
h
->
vcl_name
,
method
);
return
(
NULL
);
...
...
@@ -347,7 +347,7 @@ get_scope(const struct vrt_ctx * const restrict ctx,
}
if
(
priv
==
NULL
)
{
ERR
(
ctx
,
"no priv - out of workspace?"
);
FAIL
(
ctx
,
"no priv - out of workspace?"
);
return
(
NULL
);
}
...
...
@@ -361,7 +361,7 @@ get_scope(const struct vrt_ctx * const restrict ctx,
else
{
task
=
WS_Alloc
(
ws
,
sizeof
(
struct
digest_task
));
if
(
task
==
NULL
)
{
V
ERR
NOMEM
(
ctx
,
"allocating task data in %s.%s()"
,
V
FAIL
NOMEM
(
ctx
,
"allocating task data in %s.%s()"
,
h
->
vcl_name
,
method
);
return
(
NULL
);
}
...
...
@@ -431,7 +431,7 @@ vmod_digest_update(VRT_CTX, struct vmod_blobdigest_digest *h, VCL_BLOB b)
CHECK_OBJ_NOTNULL
(
h
,
VMOD_BLOBDIGEST_DIGEST_MAGIC
);
if
(
h
->
result
!=
NULL
)
{
V
ERR
(
ctx
,
"already finalized in %s.update()"
,
h
->
vcl_name
);
V
FAIL
(
ctx
,
"already finalized in %s.update()"
,
h
->
vcl_name
);
return
(
0
);
}
...
...
@@ -440,14 +440,14 @@ vmod_digest_update(VRT_CTX, struct vmod_blobdigest_digest *h, VCL_BLOB b)
return
(
0
);
if
(
b
==
NULL
)
{
V
ERR
(
ctx
,
"null BLOB passed to %s.update()"
,
h
->
vcl_name
);
V
FAIL
(
ctx
,
"null BLOB passed to %s.update()"
,
h
->
vcl_name
);
return
(
0
);
}
hctx
=
INIT_FINI
(
ctx
)
?
&
h
->
ctx
:
&
task
->
ctx
;
if
(
task
->
result
!=
NULL
)
{
V
ERR
(
ctx
,
"already finalized in %s.update()"
,
h
->
vcl_name
);
V
FAIL
(
ctx
,
"already finalized in %s.update()"
,
h
->
vcl_name
);
return
(
0
);
}
if
(
b
->
len
>
0
&&
b
->
blob
!=
NULL
)
...
...
@@ -563,7 +563,7 @@ vmod_hmac__init(VRT_CTX, struct vmod_blobdigest_hmac **hmacp,
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
AN
(
vcl_name
);
if
(
key
==
NULL
||
key
->
blob
==
NULL
)
{
V
ERR
(
ctx
,
"key is NULL in %s constructor"
,
vcl_name
);
V
FAIL
(
ctx
,
"key is NULL in %s constructor"
,
vcl_name
);
return
;
}
AN
(
hmacp
);
...
...
@@ -585,7 +585,7 @@ vmod_hmac_hmac(VRT_CTX, struct vmod_blobdigest_hmac *h, VCL_BLOB msg)
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
h
,
VMOD_BLOBDIGEST_HMAC_MAGIC
);
if
(
msg
==
NULL
||
msg
->
blob
==
NULL
)
{
V
ERR
(
ctx
,
"msg is NULL in %s.hmac()"
,
h
->
vcl_name
);
V
FAIL
(
ctx
,
"msg is NULL in %s.hmac()"
,
h
->
vcl_name
);
return
(
NULL
);
}
...
...
@@ -604,7 +604,7 @@ vmod_hmac_hmac_bench(VRT_CTX, struct vmod_blobdigest_hmac *h, VCL_INT n,
uintptr_t
snap
;
if
(
n
<=
0
)
{
ERR
(
ctx
,
"number of rounds must be greater than zero"
);
FAIL
(
ctx
,
"number of rounds must be greater than zero"
);
return
(
-
1
);
}
snap
=
WS_Snapshot
(
ctx
->
ws
);
...
...
@@ -665,11 +665,11 @@ vmod_hmacf(VRT_CTX, VCL_ENUM hashs, VCL_BLOB key, VCL_BLOB msg)
hash_ctx
inner_ctx
,
outer_ctx
;
if
(
key
==
NULL
||
key
->
blob
==
NULL
)
{
ERR
(
ctx
,
"key is NULL in blobdigest.hmacf()"
);
FAIL
(
ctx
,
"key is NULL in blobdigest.hmacf()"
);
return
(
NULL
);
}
if
(
msg
==
NULL
||
msg
->
blob
==
NULL
)
{
ERR
(
ctx
,
"msg is NULL in blobdigest.hmacf()"
);
FAIL
(
ctx
,
"msg is NULL in blobdigest.hmacf()"
);
return
(
NULL
);
}
hmac_init
(
hash
,
key
,
&
inner_ctx
,
&
outer_ctx
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment