summaryrefslogtreecommitdiffstats
path: root/crypto/chacha/asm/chacha-x86_64.pl
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2016-02-13 17:13:53 +0100
committerAndy Polyakov <appro@openssl.org>2016-02-14 21:22:42 +0100
commit622a531c18187e3c59a7ab2d32ab990b397aafc2 (patch)
tree92911d60769621318bfbafd113b7a018a49fd933 /crypto/chacha/asm/chacha-x86_64.pl
parent29880e97104e5c88887e502a1d0ff570b646ec1b (diff)
chacha/asm/chacha*: ensure that zero length is handled (without crash).
RT#4305 Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/chacha/asm/chacha-x86_64.pl')
-rwxr-xr-xcrypto/chacha/asm/chacha-x86_64.pl3
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/chacha/asm/chacha-x86_64.pl b/crypto/chacha/asm/chacha-x86_64.pl
index 1a87cf8495..107fc70819 100755
--- a/crypto/chacha/asm/chacha-x86_64.pl
+++ b/crypto/chacha/asm/chacha-x86_64.pl
@@ -219,6 +219,8 @@ $code.=<<___;
.type ChaCha20_ctr32,\@function,5
.align 64
ChaCha20_ctr32:
+ cmp \$0,$len
+ je .Lno_data
mov OPENSSL_ia32cap_P+4(%rip),%r10
test \$`1<<(41-32)`,%r10d
jnz .LChaCha20_ssse3
@@ -375,6 +377,7 @@ $code.=<<___;
pop %r12
pop %rbp
pop %rbx
+.Lno_data:
ret
.size ChaCha20_ctr32,.-ChaCha20_ctr32
___