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
ea2047ee
Commit
ea2047ee
authored
Jan 24, 2019
by
Nils Goroll
Committed by
Geoff Simmons
Mar 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cstyle(9)
parent
532bb498
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
28 deletions
+28
-28
vmod_blobdigest.c
src/vmod_blobdigest.c
+28
-28
No files found.
src/vmod_blobdigest.c
View file @
ea2047ee
...
...
@@ -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
;
caller
);
return
(
NULL
)
;
}
b
->
type
=
BLOB_BLOBDIGEST_DIGEST_TYPE
;
b
->
len
=
digestsz
;
return
b
;
return
(
b
)
;
}
static
VCL_BLOB
...
...
@@ -332,9 +332,9 @@ get_scope(const struct vrt_ctx * const restrict ctx,
case
TOP
:
{
if
(
ctx
->
req
==
NULL
)
{
VERR
(
ctx
,
"%s.%s(): object has TOP scope - only "
"accessible in client VCL context"
,
h
->
vcl_name
,
method
);
return
NULL
;
"accessible in client VCL context"
,
h
->
vcl_name
,
method
);
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
);
...
...
@@ -362,8 +362,8 @@ get_scope(const struct vrt_ctx * const restrict ctx,
task
=
WS_Alloc
(
ws
,
sizeof
(
struct
digest_task
));
if
(
task
==
NULL
)
{
VERRNOMEM
(
ctx
,
"allocating task data in %s.%s()"
,
h
->
vcl_name
,
method
);
return
NULL
;
h
->
vcl_name
,
method
);
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 */
...
...
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