Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-blobsha256
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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-blobsha256
Commits
f9027544
Commit
f9027544
authored
Apr 21, 2016
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make the SHA256_CTX local to the inline digest function
parent
32cf40bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
+8
-10
vmod_blobsha256.c
src/vmod_blobsha256.c
+8
-10
No files found.
src/vmod_blobsha256.c
View file @
f9027544
...
...
@@ -86,9 +86,10 @@ errmsg(VRT_CTX, const char *fmt, ...)
}
static
inline
void
digest
(
SHA256_CTX
*
restrict
const
ctx
,
VCL_BLOB
restrict
const
b
,
uint8_t
*
restrict
digest
)
digest
(
VCL_BLOB
restrict
const
b
,
uint8_t
*
restrict
digest
)
{
SHA256_CTX
ctx
[
1
];
SHA256_Init
(
ctx
);
SHA256_Update
(
ctx
,
b
->
priv
,
b
->
len
);
SHA256_Final
(
digest
,
ctx
);
...
...
@@ -114,10 +115,9 @@ vmod_hmac__init(VRT_CTX, struct vmod_blobsha256_hmac **hmacp,
if
(
key
->
len
<=
SHA256_BLOCKSZ
)
memcpy
(
k
,
key
->
priv
,
key
->
len
);
else
{
SHA256_CTX
hctx
[
1
];
digest
(
hctx
,
key
,
k
);
}
else
digest
(
key
,
k
);
for
(
int
i
=
0
;
i
<
SHA256_BLOCKSZ
;
i
++
)
{
innerk
[
i
]
=
k
[
i
]
^
0x36
;
outerk
[
i
]
=
k
[
i
]
^
0x5c
;
...
...
@@ -185,7 +185,6 @@ vmod_blob__init(VRT_CTX, struct vmod_blobsha256_blob **blobp,
const
char
*
vcl_name
,
VCL_BLOB
b
)
{
struct
vmod_blobsha256_blob
*
blob
;
SHA256_CTX
hctx
[
1
];
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
AN
(
blobp
);
...
...
@@ -203,7 +202,7 @@ vmod_blob__init(VRT_CTX, struct vmod_blobsha256_blob **blobp,
blob
->
hash
.
len
=
SHA256_LEN
;
blob
->
hash
.
free
=
NULL
;
digest
(
hctx
,
b
,
blob
->
hash
.
priv
);
digest
(
b
,
blob
->
hash
.
priv
);
}
VCL_BLOB
...
...
@@ -233,7 +232,6 @@ vmod_hash(VRT_CTX, VCL_BLOB msg)
{
struct
vmod_priv
*
b
;
char
*
snap
;
SHA256_CTX
hctx
[
1
];
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
if
(
INIT_FINI
(
ctx
))
{
...
...
@@ -256,7 +254,7 @@ vmod_hash(VRT_CTX, VCL_BLOB msg)
}
b
->
len
=
SHA256_LEN
;
b
->
free
=
NULL
;
digest
(
hctx
,
msg
,
b
->
priv
);
digest
(
msg
,
b
->
priv
);
return
b
;
}
...
...
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