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 %endmacro
%macro mload_kernel_code_label_u32(label) %macro mload_kernel_code_label_u32(label)
// stack: shift // stack: u32_shift
%mul_const(4)
// stack: byte_shift
PUSH $label PUSH $label
ADD ADD
// stack: label + shift // stack: label + byte_shift
%mload_kernel_code_u32 %mload_kernel_code_u32
// stack: u32 // stack: u32
%endmacro %endmacro

View File

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

View File

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