Daniel's comments

This commit is contained in:
Dmitry Vagner 2022-09-29 13:58:49 -07:00
parent e1cdd8248a
commit abff978826
4 changed files with 15 additions and 23 deletions

View File

@ -72,10 +72,12 @@
%endmacro
%macro mload_kernel_code_label_u32(label)
// stack: shift
// stack: u32_shift
%mul_const(4)
// stack: byte_shift
PUSH $label
ADD
// stack: label + shift
// stack: label + byte_shift
%mload_kernel_code_u32
// stack: u32
%endmacro

View File

@ -135,8 +135,7 @@ update_round_vars:
SWAP7
// stack: rnd, rnd, STATE, F', K , 16, rounds, sides, virt, retdest
SWAP8
POP
%mul_const(4)
POP
%mload_kernel_code_label_u32(k_data)
SWAP7
POP
@ -207,7 +206,7 @@ pre_rol:
ADD
DUP8
ADD
%u32
%as_u32
// stack: a, box, b, c, d, e, F, K, boxes, rounds, sides, virt
PUSH mid_rol
SWAP2
@ -220,14 +219,10 @@ mid_rol:
DUP5
// stack: e, a, b, c, d, e, F, K, boxes, rounds, sides, virt
ADD
%u32
%as_u32
// stack: a, b, c, d, e, F, K, boxes, rounds, sides, virt
SWAP1
SWAP2
PUSH post_rol
SWAP1
PUSH 10
// stack: 10, c, post_rol, b, a, d, e, F, K, boxes, rounds, sides, virt
%stack (a, b, c) -> (10, c, post_rol, a, b)
// stack: 10, c, post_rol, a, b, d, e, F, K, boxes, rounds, sides, virt
%jump(rol)
post_rol:
// stack: c, a, b, d, e, F, K, boxes , rounds, sides, virt

View File

@ -16,7 +16,7 @@ global rol:
// stack: n, x, x >> (32-n), retdest
SHL
// stack: x << n, x >> (32-n), retdest
%u32
%as_u32
// stack: u32(x << n), x >> (32-n), retdest
OR
// stack: u32(x << n) | (x >> (32-n)), retdest

View File

@ -230,7 +230,7 @@
// stack: max
%endmacro
%macro u32
%macro as_u32
%and_const(0xffffffff)
%endmacro
@ -243,15 +243,14 @@
%endmacro
%macro add3_u32
// stack: x, y, z
// stack: x , y , z
ADD
// stack: x+y, z
// stack: x + y , z
ADD
// stack: x+y+z
%u32
// stack: x + y + z
%as_u32
%endmacro
// given u32 bytestring abcd return dcba
%macro reverse_bytes_u32
// stack: abcd
@ -292,7 +291,3 @@
OR
// stack: dcba
%endmacro
%macro break
%jump(0xdeadbeef)
%endmacro