Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-ece
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-ece
Commits
dbd9d1bb
Commit
dbd9d1bb
authored
Sep 18, 2019
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement input and output stats for decryption VFPs.
parent
5cdfb762
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
79 additions
and
1 deletion
+79
-1
ece.vsc
src/ece.vsc
+12
-0
decrypt.vtc
src/tests/decrypt.vtc
+22
-0
roundtrip.vtc
src/tests/roundtrip.vtc
+2
-0
vfp_common.h
src/vfp_common.h
+21
-0
vfp_decrypt.c
src/vfp_decrypt.c
+22
-1
No files found.
src/ece.vsc
View file @
dbd9d1bb
...
...
@@ -12,4 +12,16 @@
Total number of en-/decryption operations
.. varnish_vsc:: out
:type: counter
:oneliner: Output bytes
Total number of bytes output by the en-/decrypter
.. varnish_vsc:: in
:type: counter
:oneliner: Input bytes
Total number of input bytes processed by the en-/decrypter
.. varnish_vsc_end:: ece
src/tests/decrypt.vtc
View file @
dbd9d1bb
...
...
@@ -71,6 +71,8 @@ logexpect l1 -v v1 -d 1 -g vxid -q "VfpAcct" {
} -run
varnish v1 -expect ECE.vfp.ece_decrypt.ops == 2
varnish v1 -expect ECE.vfp.ece_decrypt.in == 126
varnish v1 -expect ECE.vfp.ece_decrypt.out == 30
## Corner cases
...
...
@@ -130,6 +132,8 @@ client c1 {
logexpect l1 -wait
varnish v1 -expect ECE.vfp.ece_decrypt.ops == 3
varnish v1 -expect ECE.vfp.ece_decrypt.in == 147
varnish v1 -expect ECE.vfp.ece_decrypt.out == 30
## Errors
...
...
@@ -174,6 +178,8 @@ client c1 {
logexpect l1 -wait
varnish v1 -expect ECE.vfp.ece_decrypt.ops == 4
varnish v1 -expect ECE.vfp.ece_decrypt.in == 150
varnish v1 -expect ECE.vfp.ece_decrypt.out == 30
server s1 -wait
server s1 {
...
...
@@ -191,6 +197,8 @@ client c1 {
} -run
varnish v1 -expect ECE.vfp.ece_decrypt.ops == 5
varnish v1 -expect ECE.vfp.ece_decrypt.in == 150
varnish v1 -expect ECE.vfp.ece_decrypt.out == 30
server s1 -wait
server s1 {
...
...
@@ -218,6 +226,8 @@ client c1 {
logexpect l1 -wait
varnish v1 -expect ECE.vfp.ece_decrypt.ops == 6
varnish v1 -expect ECE.vfp.ece_decrypt.in == 172
varnish v1 -expect ECE.vfp.ece_decrypt.out == 30
server s1 -wait
server s1 {
...
...
@@ -237,6 +247,8 @@ client c1 {
} -run
varnish v1 -expect ECE.vfp.ece_decrypt.ops == 7
varnish v1 -expect ECE.vfp.ece_decrypt.in == 193
varnish v1 -expect ECE.vfp.ece_decrypt.out == 30
server s1 -wait
server s1 {
...
...
@@ -264,6 +276,8 @@ client c1 {
logexpect l1 -wait
varnish v1 -expect ECE.vfp.ece_decrypt.ops == 8
varnish v1 -expect ECE.vfp.ece_decrypt.in == 214
varnish v1 -expect ECE.vfp.ece_decrypt.out == 30
server s1 -wait
server s1 {
...
...
@@ -291,6 +305,8 @@ client c1 {
logexpect l1 -wait
varnish v1 -expect ECE.vfp.ece_decrypt.ops == 9
varnish v1 -expect ECE.vfp.ece_decrypt.in == 235
varnish v1 -expect ECE.vfp.ece_decrypt.out == 30
server s1 -wait
server s1 {
...
...
@@ -318,6 +334,8 @@ client c1 {
logexpect l1 -wait
varnish v1 -expect ECE.vfp.ece_decrypt.ops == 10
varnish v1 -expect ECE.vfp.ece_decrypt.in == 258
varnish v1 -expect ECE.vfp.ece_decrypt.out == 30
server s1 -wait
server s1 {
...
...
@@ -347,6 +365,8 @@ client c1 {
logexpect l1 -wait
varnish v1 -expect ECE.vfp.ece_decrypt.ops == 11
varnish v1 -expect ECE.vfp.ece_decrypt.in == 279
varnish v1 -expect ECE.vfp.ece_decrypt.out == 30
server s1 -wait
server s1 -start
...
...
@@ -383,3 +403,5 @@ client c1 {
logexpect l1 -wait
varnish v1 -expect ECE.vfp.ece_decrypt.ops == 12
varnish v1 -expect ECE.vfp.ece_decrypt.in == 300
varnish v1 -expect ECE.vfp.ece_decrypt.out == 30
src/tests/roundtrip.vtc
View file @
dbd9d1bb
...
...
@@ -151,6 +151,8 @@ logexpect l1 -v v1 -d 1 -g vxid -q "VfpAcct" {
varnish v1 -expect ECE.vfp.ece_encrypt.ops == 6
varnish v1 -expect ECE.vfp.ece_decrypt.ops == 6
varnish v1 -expect ECE.vfp.ece_decrypt.in > 199975
varnish v1 -expect ECE.vfp.ece_decrypt.out == 199975
# Repeat the test with custom VFPs
varnish v1 -vcl+backend {
...
...
src/vfp_common.h
View file @
dbd9d1bb
...
...
@@ -193,6 +193,27 @@ outputLen(struct ece_stream *stream, unsigned char *ptr)
return
(
stream
->
next_out
-
ptr
);
}
static
inline
uint8_t
*
hdrBufIn
(
struct
ece_hdrbuf
*
hdr
)
{
CHECK_OBJ_NOTNULL
(
hdr
,
ECE_HDRBUF_MAGIC
);
return
(
hdr
->
next_in
);
}
static
inline
uint8_t
*
recBufIn
(
struct
ece_stream
*
stream
)
{
CHECK_OBJ_NOTNULL
(
stream
,
ECE_STREAM_MAGIC
);
return
(
stream
->
rec_next
);
}
static
inline
uint8_t
*
streamIn
(
struct
ece_stream
*
stream
)
{
CHECK_OBJ_NOTNULL
(
stream
,
ECE_STREAM_MAGIC
);
return
(
stream
->
next_in
);
}
static
inline
void
seq_inc
(
struct
ece_crypto
*
crypto
)
{
...
...
src/vfp_decrypt.c
View file @
dbd9d1bb
...
...
@@ -287,20 +287,31 @@ vfp_decrypt_pull(struct vfp_ctx *ctx, struct vfp_entry *ent, void *ptr,
{
struct
ece
*
ece
;
struct
ece_stream
*
stream
;
unsigned
char
*
p
=
ptr
;
struct
ece_hdrbuf
*
hdr
;
const
struct
vfp_cfg
*
cfg
;
struct
VSC_ece
*
stats
;
unsigned
char
*
p
=
ptr
,
*
inb4
;
enum
vfp_status
vp
=
VFP_OK
;
CHECK_OBJ_NOTNULL
(
ctx
,
VFP_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ent
,
VFP_ENTRY_MAGIC
);
CAST_OBJ_NOTNULL
(
ece
,
ent
->
priv1
,
ECE_MAGIC
);
CHECK_OBJ_NOTNULL
(
ece
->
stream
,
ECE_STREAM_MAGIC
);
CHECK_OBJ_NOTNULL
(
ece
->
hdr
,
ECE_HDRBUF_MAGIC
);
AN
(
ent
->
vfp
);
CAST_OBJ_NOTNULL
(
cfg
,
ent
->
vfp
->
priv1
,
VFP_CFG_MAGIC
);
AN
(
ptr
);
AN
(
lenp
);
assert
(
*
lenp
>=
0
);
stream
=
ece
->
stream
;
hdr
=
ece
->
hdr
;
stats
=
cfg
->
stats
;
if
(
ece
->
rs
==
0
)
{
inb4
=
hdrBufIn
(
hdr
);
vp
=
decrypt_init
(
ctx
,
ece
,
ent
);
if
(
stats
!=
NULL
)
stats
->
in
+=
hdrBufIn
(
hdr
)
-
inb4
;
if
(
vp
==
VFP_ERROR
)
return
(
vp
);
if
(
vp
==
VFP_NULL
)
{
...
...
@@ -320,9 +331,14 @@ vfp_decrypt_pull(struct vfp_ctx *ctx, struct vfp_entry *ent, void *ptr,
AN
(
ece
->
buf
);
setOutputBuf
(
stream
,
ptr
,
*
lenp
);
inb4
=
recBufIn
(
stream
);
flushRecBuf
(
stream
);
if
(
stats
!=
NULL
)
stats
->
in
+=
recBufIn
(
stream
)
-
inb4
;
if
(
isOutputBufFull
(
stream
))
{
*
lenp
=
outputLen
(
stream
,
p
);
if
(
stats
!=
NULL
)
stats
->
out
+=
*
lenp
;
return
(
VFP_OK
);
}
...
...
@@ -335,7 +351,10 @@ vfp_decrypt_pull(struct vfp_ctx *ctx, struct vfp_entry *ent, void *ptr,
setInputBuf
(
stream
,
ece
->
buf
,
len
);
}
if
(
!
isInputBufEmpty
(
stream
))
{
inb4
=
streamIn
(
stream
);
vp
=
decrypt
(
ctx
,
ece
,
vp
);
if
(
stats
!=
NULL
)
stats
->
in
+=
streamIn
(
stream
)
-
inb4
;
if
(
vp
==
VFP_ERROR
)
return
(
vp
);
}
...
...
@@ -343,6 +362,8 @@ vfp_decrypt_pull(struct vfp_ctx *ctx, struct vfp_entry *ent, void *ptr,
ERR
(
ctx
,
"message truncated"
);
*
lenp
=
outputLen
(
stream
,
p
);
if
(
stats
!=
NULL
)
stats
->
out
+=
*
lenp
;
return
(
vp
);
}
...
...
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