Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-openssl
Commits
c2dcc5cc
Commit
c2dcc5cc
authored
Oct 17, 2018
by
Ramesh V Rayaprolu
Committed by
Jeff Wendling
Oct 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid panic while encrypting empty data (#109)
parent
a66df3e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
ciphers.go
ciphers.go
+6
-0
No files found.
ciphers.go
View file @
c2dcc5cc
...
...
@@ -287,6 +287,9 @@ func NewDecryptionCipherCtx(c *Cipher, e *Engine, key, iv []byte) (
}
func
(
ctx
*
encryptionCipherCtx
)
EncryptUpdate
(
input
[]
byte
)
([]
byte
,
error
)
{
if
len
(
input
)
==
0
{
return
nil
,
nil
}
outbuf
:=
make
([]
byte
,
len
(
input
)
+
ctx
.
BlockSize
())
outlen
:=
C
.
int
(
len
(
outbuf
))
res
:=
C
.
EVP_EncryptUpdate
(
ctx
.
ctx
,
(
*
C
.
uchar
)(
&
outbuf
[
0
]),
&
outlen
,
...
...
@@ -298,6 +301,9 @@ func (ctx *encryptionCipherCtx) EncryptUpdate(input []byte) ([]byte, error) {
}
func
(
ctx
*
decryptionCipherCtx
)
DecryptUpdate
(
input
[]
byte
)
([]
byte
,
error
)
{
if
len
(
input
)
==
0
{
return
nil
,
nil
}
outbuf
:=
make
([]
byte
,
len
(
input
)
+
ctx
.
BlockSize
())
outlen
:=
C
.
int
(
len
(
outbuf
))
res
:=
C
.
EVP_DecryptUpdate
(
ctx
.
ctx
,
(
*
C
.
uchar
)(
&
outbuf
[
0
]),
&
outlen
,
...
...
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