Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-gcrypt
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-gcrypt
Commits
c5227cab
Commit
c5227cab
authored
Jan 24, 2019
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
69c40e1d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
14 deletions
+11
-14
vmod_gcrypt.c
src/vmod_gcrypt.c
+9
-12
vmod_gcrypt.vcc
src/vmod_gcrypt.vcc
+2
-2
No files found.
src/vmod_gcrypt.c
View file @
c5227cab
...
...
@@ -41,11 +41,11 @@
#include <fcntl.h>
#include <float.h>
#include "vcl.h"
#include "cache/cache.h"
#include "vrt.h"
//#include "vcl.h"
//#include "vrt.h"
#include "vas.h"
#include "vdef.h"
//
#include "vdef.h"
#include "vqueue.h"
#include "vcc_if.h"
...
...
@@ -469,10 +469,10 @@ vmod_symmetric_encrypt(VRT_CTX, struct vmod_gcrypt_symmetric *symmetric,
{
size_t
len
,
blocklen
;
uintptr_t
snap
;
void
*
plaintext
;
struct
vmod_priv
*
ciphertext
;
void
*
plaintext
,
*
ciphertext
;
gcry_error_t
err
=
GPG_ERR_NO_ERROR
;
gcry_cipher_hd_t
*
hd
;
VCL_BLOB
b
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
symmetric
,
VMOD_GCRYPT_SYMMETRIC_MAGIC
);
...
...
@@ -483,11 +483,6 @@ vmod_symmetric_encrypt(VRT_CTX, struct vmod_gcrypt_symmetric *symmetric,
}
snap
=
WS_Snapshot
(
ctx
->
ws
);
if
((
ciphertext
=
WS_Alloc
(
ctx
->
ws
,
sizeof
(
*
ciphertext
)))
==
NULL
)
{
VERRNOMEM
(
ctx
,
"Allocating BLOB result in %s.encrypt()"
,
symmetric
->
vcl_name
);
return
NULL
;
}
blocklen
=
gcry_cipher_get_algo_blklen
(
symmetric
->
algo
);
AN
(
blocklen
);
if
(
symmetric
->
padding
!=
NONE
)
{
...
...
@@ -504,7 +499,7 @@ vmod_symmetric_encrypt(VRT_CTX, struct vmod_gcrypt_symmetric *symmetric,
plaintext
=
plainblob
->
priv
;
len
=
plainblob
->
len
;
}
if
((
ciphertext
->
priv
=
WS_Alloc
(
ctx
->
ws
,
len
))
==
NULL
)
{
if
((
ciphertext
=
WS_Alloc
(
ctx
->
ws
,
len
))
==
NULL
)
{
VERRNOMEM
(
ctx
,
"Allocating ciphertext result in %s.encrypt"
,
symmetric
->
vcl_name
);
goto
fail
;
...
...
@@ -546,13 +541,15 @@ vmod_symmetric_encrypt(VRT_CTX, struct vmod_gcrypt_symmetric *symmetric,
goto
fail
;
}
}
if
((
err
=
gcry_cipher_encrypt
(
*
hd
,
ciphertext
->
priv
,
len
,
plaintext
,
if
((
err
=
gcry_cipher_encrypt
(
*
hd
,
ciphertext
,
len
,
plaintext
,
len
))
!=
GPG_ERR_NO_ERROR
)
{
VERR
(
ctx
,
"in %s.encrypt(): %s/%s"
,
symmetric
->
vcl_name
,
gcry_strsource
(
err
),
gcry_strerror
(
err
));
goto
fail
;
}
b
=
VRT_
ciphertext
->
len
=
len
;
ciphertext
->
free
=
NULL
;
return
ciphertext
;
...
...
src/vmod_gcrypt.vcc
View file @
c5227cab
...
...
@@ -339,7 +339,7 @@ Examples::
cbc_cts=true, secure=true);
}
$Method BLOB .encrypt(BLOB plaintext,
BLOB iv=0, BLOB ctr=0
)
$Method BLOB .encrypt(BLOB plaintext,
[BLOB iv], [BLOB ctr]
)
Encrypt the contents of ``plaintext`` according to the parameters
specified for this ``symmetric`` object, and return the ciphertext as
...
...
@@ -396,7 +396,7 @@ Examples::
iv=blobcode.decode(BASE64, resp.http.X-IV-256)));
}
$Method BLOB .decrypt(BLOB ciphertext,
BLOB iv=0, BLOB ctr=0
)
$Method BLOB .decrypt(BLOB ciphertext,
[BLOB iv], [BLOB ctr]
)
Decrypt the contents of ``ciphertext`` according to the parameters
specified for this ``symmetric`` object, and return the plaintext as
...
...
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