chacha/asm/chacha*: ensure that zero length is handled (without crash).
[openssl.git] / crypto / chacha / asm / chacha-s390x.pl
index 8a097065431356178afc8b563c506c2948bbdf89..e637dc2f4fbd2ddde844ac91a9550703a0b9ea92 100755 (executable)
@@ -140,6 +140,7 @@ $code.=<<___;
 .type  ChaCha20_ctr32,\@function
 .align 32
 ChaCha20_ctr32:
+       cl${g}ije       $len,0,.Lno_data        # $len==0?
        a${g}hi $len,-64
        l${g}hi %r1,-$frame
        stm${g} %r6,%r15,`6*$SIZE_T`($sp)
@@ -271,6 +272,7 @@ $code.=<<___;
        stmg    %r0,%r3,$stdframe+4*12($sp)
 
        lm${g}  %r6,%r15,`$frame+6*$SIZE_T`($sp)
+.Lno_data:
        br      %r14
 
 .align 16