Merge pull request #756 from urbit/fix-zuse-crub-overflow

tail-call optimizes +ctra, +ctrb, and +ctrc in |aes
This commit is contained in:
Anthony Arroyo 2018-07-02 11:22:49 -07:00 committed by GitHub
commit 1dd61041eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1967,11 +1967,14 @@
%+ mix txt %+ mix txt
%^ rsh 3 (sub (mul 16 blocks) len) %^ rsh 3 (sub (mul 16 blocks) len)
%+ rep 7 %+ rep 7
%- flop =| seed=(list @ux)
|- ^- (list @ux) |- ^+ seed
?: =(blocks 0) ~ ?: =(blocks 0) seed
:- (encrypt ctr) %= $
$(ctr (inc mod ctr), blocks (dec blocks)) seed [(encrypt ctr) seed]
ctr (inc mod ctr)
blocks (dec blocks)
==
:: :: ++de:ctra:aes:crypto :: :: ++de:ctra:aes:crypto
++ de :: decrypt ++ de :: decrypt
en en
@ -1991,11 +1994,14 @@
%+ mix txt %+ mix txt
%^ rsh 3 (sub (mul 16 blocks) len) %^ rsh 3 (sub (mul 16 blocks) len)
%+ rep 7 %+ rep 7
%- flop =| seed=(list @ux)
|- ^- (list @ux) |- ^+ seed
?: =(blocks 0) ~ ?: =(blocks 0) seed
:- (encrypt ctr) %= $
$(ctr (inc mod ctr), blocks (dec blocks)) seed [(encrypt ctr) seed]
ctr (inc mod ctr)
blocks (dec blocks)
==
:: :: ++de:ctrb:aes:crypto :: :: ++de:ctrb:aes:crypto
++ de :: decrypt ++ de :: decrypt
en en
@ -2015,11 +2021,14 @@
%+ mix txt %+ mix txt
%^ rsh 3 (sub (mul 16 blocks) len) %^ rsh 3 (sub (mul 16 blocks) len)
%+ rep 7 %+ rep 7
%- flop =| seed=(list @ux)
|- ^- (list @ux) |- ^+ seed
?: =(blocks 0) ~ ?: =(blocks 0) seed
:- (encrypt ctr) %= $
$(ctr (inc mod ctr), blocks (dec blocks)) seed [(encrypt ctr) seed]
ctr (inc mod ctr)
blocks (dec blocks)
==
:: :: ++de:ctrc:aes:crypto :: :: ++de:ctrc:aes:crypto
++ de :: decrypt ++ de :: decrypt
en en