main

Imports

Imports #

. "github.com/mmcloughlin/avo/build"
. "github.com/mmcloughlin/avo/operand"
. "github.com/mmcloughlin/avo/reg"
"os"
. "github.com/mmcloughlin/avo/build"
. "github.com/mmcloughlin/avo/operand"
. "github.com/mmcloughlin/avo/reg"
. "github.com/mmcloughlin/avo/build"
. "github.com/mmcloughlin/avo/operand"
. "github.com/mmcloughlin/avo/reg"

Constants & Variables

BYTE_FLIP_MASK var #

var BYTE_FLIP_MASK = Y13

CTX var #

var CTX = RSI

INP var #

var INP = RDI

INP_END_SIZE var #

var INP_END_SIZE = 8

INP_SIZE var #

var INP_SIZE = 8

K256Ptr var #

Pointers for memoizing Data section symbols

var K256Ptr *Mem

NUM_BYTES var #

var NUM_BYTES GPPhysical = RDX

SRND var #

var SRND = RSI

STACK_SIZE var #

var STACK_SIZE = *ast.BinaryExpr

T1 var #

var T1 = R12L

TBL var #

var TBL = RBP

XDWORD0 var #

var XDWORD0 VecPhysical = Y4

XDWORD1 var #

var XDWORD1 = Y5

XDWORD2 var #

var XDWORD2 = Y6

XDWORD3 var #

var XDWORD3 = Y7

XFER var #

var XFER = Y9

XFER_SIZE var #

Offsets

var XFER_SIZE = *ast.BinaryExpr

XTMP0 var #

var XTMP0 = Y0

XTMP1 var #

var XTMP1 = Y1

XTMP2 var #

var XTMP2 = Y2

XTMP3 var #

var XTMP3 = Y3

XTMP4 var #

var XTMP4 = Y8

XTMP5 var #

var XTMP5 = Y11

XWORD0 var #

var XWORD0 = X4

XWORD1 var #

var XWORD1 = X5

XWORD2 var #

var XWORD2 = X6

XWORD3 var #

var XWORD3 = X7

X_BYTE_FLIP_MASK var #

var X_BYTE_FLIP_MASK = X13

_INP var #

var _INP = *ast.BinaryExpr

_INP_END var #

var _INP_END = *ast.BinaryExpr

_K var #

var _K = []uint32{...}

_XFER var #

var _XFER = 0

a var #

var a = EAX

abefSave var #

var abefSave = X9

b var #

var b = EBX

c var #

var c = ECX

cdghSave var #

var cdghSave = X10

d var #

var d = R8L

dataPtr var #

var dataPtr = RSI

digestPtr var #

var digestPtr GPPhysical = RDI

e var #

var e = EDX

f var #

var f = R9L

flip_maskPtr var #

Pointers for memoizing Data section symbols

var flip_maskPtr *Mem

g var #

var g = R10L

h var #

var h = R11L

m0 var #

var m0 = X3

m1 var #

var m1 = X4

m2 var #

var m2 = X5

m3 var #

var m3 = X6

m4 var #

var m4 = X7

msg var #

var msg VecPhysical = X0

numBytes var #

var numBytes = RDX

old_h var #

var old_h = R11L

sha256Constants var #

var sha256Constants = RAX

shufMask var #

var shufMask = X8

shuff_00BAPtr var #

Pointers for memoizing Data section symbols

var shuff_00BAPtr *Mem

shuff_DC00Ptr var #

Pointers for memoizing Data section symbols

var shuff_DC00Ptr *Mem

state0 var #

var state0 = X1

state1 var #

var state1 = X2

y0 var #

var y0 = R13L

y1 var #

var y1 = R14L

y2 var #

var y2 = R15L

y3 var #

var y3 = EDI

Type Aliases

VecFunc type #

type VecFunc func(a VecPhysical, b VecPhysical)

Functions

K256_DATA function #

Round specific constants

func K256_DATA() Mem

addm function #

addm (mem), reg - Add reg to mem using reg-mem add and store

func addm(P1 Mem, P2 GPPhysical)

avx2_do_last_block function #

func avx2_do_last_block()

avx2_last_block_enter function #

func avx2_last_block_enter()

avx2_loop0 function #

func avx2_loop0()

avx2_loop1 function #

for w0 - w47

func avx2_loop1()

avx2_loop2 function #

w48 - w63 processed with no scheduling (last 16 rounds)

func avx2_loop2()

avx2_loop3 function #

Do second block using previously scheduled results

func avx2_loop3()

avx2_only_one_block function #

Load initial digest

func avx2_only_one_block()

blockAMD64 function #

func blockAMD64()

blockAVX2 function #

func blockAVX2()

blockSHANI function #

func blockSHANI()

doRoundN0 function #

func doRoundN0(disp int, a GPPhysical, b GPPhysical, c GPPhysical, d GPPhysical, e GPPhysical, f GPPhysical, g GPPhysical, h GPPhysical, old_h GPPhysical)

doRoundN1 function #

func doRoundN1(disp int, a GPPhysical, b GPPhysical, c GPPhysical, d GPPhysical, e GPPhysical, f GPPhysical, g GPPhysical, h GPPhysical, old_h GPPhysical)

doRoundN2 function #

func doRoundN2(disp int, a GPPhysical, b GPPhysical, c GPPhysical, d GPPhysical, e GPPhysical, f GPPhysical, g GPPhysical, h GPPhysical, old_h GPPhysical)

doRoundN3 function #

func doRoundN3(disp int, a GPPhysical, b GPPhysical, c GPPhysical, d GPPhysical, e GPPhysical, f GPPhysical, g GPPhysical, h GPPhysical, old_h GPPhysical)

done function #

func done()

done_hash function #

func done_hash()

end function #

func end()

flip_mask_DATA function #

shuffle byte order from LE to BE

func flip_mask_DATA() Mem

loop function #

func loop()

main function #

func main()

msgSchedule0 function #

Wt = Mt; for 0 <= t <= 15

func msgSchedule0(index int)

msgSchedule1 function #

Wt = SIGMA1(Wt-2) + Wt-7 + SIGMA0(Wt-15) + Wt-16; for 16 <= t <= 63 SIGMA0(x) = ROTR(7,x) XOR ROTR(18,x) XOR SHR(3,x) SIGMA1(x) = ROTR(17,x) XOR ROTR(19,x) XOR SHR(10,x)

func msgSchedule1(index int)

nop function #

nop instead of final SHA256MSG1 for first and last few rounds

func nop(m VecPhysical, a VecPhysical)

rotateRight function #

func rotateRight(slice *[]GPPhysical) []GPPhysical

roundAndSchedN0 function #

func roundAndSchedN0(disp int, a GPPhysical, b GPPhysical, c GPPhysical, d GPPhysical, e GPPhysical, f GPPhysical, g GPPhysical, h GPPhysical, XDWORD0 VecPhysical, XDWORD1 VecPhysical, XDWORD2 VecPhysical, XDWORD3 VecPhysical)

roundAndSchedN1 function #

func roundAndSchedN1(disp int, a GPPhysical, b GPPhysical, c GPPhysical, d GPPhysical, e GPPhysical, f GPPhysical, g GPPhysical, h GPPhysical, XDWORD0 VecPhysical, XDWORD1 VecPhysical, XDWORD2 VecPhysical, XDWORD3 VecPhysical)

roundAndSchedN2 function #

func roundAndSchedN2(disp int, a GPPhysical, b GPPhysical, c GPPhysical, d GPPhysical, e GPPhysical, f GPPhysical, g GPPhysical, h GPPhysical, XDWORD0 VecPhysical, XDWORD1 VecPhysical, XDWORD2 VecPhysical, XDWORD3 VecPhysical)

roundAndSchedN3 function #

func roundAndSchedN3(disp int, a GPPhysical, b GPPhysical, c GPPhysical, d GPPhysical, e GPPhysical, f GPPhysical, g GPPhysical, h GPPhysical, XDWORD0 VecPhysical, XDWORD1 VecPhysical, XDWORD2 VecPhysical, XDWORD3 VecPhysical)

roundLoop function #

func roundLoop()

rounds0to11 function #

sha rounds 0 to 11 identical with the exception of the final msg op which is replaced with a nop for rounds where it is not needed refer to Gulley, et al for more information

func rounds0to11(m VecPhysical, a VecPhysical, c int, sha256msg1 VecFunc)

rounds12to59 function #

sha rounds 12 to 59 identical with the exception of the final msg op and the reverse copy(m,msg) in round 12 which is required after the last data load refer to Gulley, et al for more information

func rounds12to59(m VecPhysical, c int, a VecPhysical, t VecPhysical, sha256msg1 VecFunc, movop VecFunc)

sha256Round function #

Calculate T1 and T2, then e = d + T1 and a = T1 + T2. The values for e and a are stored in d and h, ready for rotation.

func sha256Round(index int, konst uint32, a GPPhysical, b GPPhysical, c GPPhysical, d GPPhysical, e GPPhysical, f GPPhysical, g GPPhysical, h GPPhysical)

sha256Round0 function #

func sha256Round0(index int, konst uint32, a GPPhysical, b GPPhysical, c GPPhysical, d GPPhysical, e GPPhysical, f GPPhysical, g GPPhysical, h GPPhysical)

sha256Round1 function #

func sha256Round1(index int, konst uint32, a GPPhysical, b GPPhysical, c GPPhysical, d GPPhysical, e GPPhysical, f GPPhysical, g GPPhysical, h GPPhysical)

sha256T1 function #

Calculate T1 in AX - uses AX, CX and DX registers. h is also used as an accumulator. Wt is passed in AX. T1 = h + BIGSIGMA1(e) + Ch(e, f, g) + Kt + Wt BIGSIGMA1(x) = ROTR(6,x) XOR ROTR(11,x) XOR ROTR(25,x) Ch(x, y, z) = (x AND y) XOR (NOT x AND z)

func sha256T1(konst uint32, e GPPhysical, f GPPhysical, g GPPhysical, h GPPhysical)

sha256T2 function #

Calculate T2 in BX - uses BX, CX, DX and DI registers. T2 = BIGSIGMA0(a) + Maj(a, b, c) BIGSIGMA0(x) = ROTR(2,x) XOR ROTR(13,x) XOR ROTR(22,x) Maj(x, y, z) = (x AND y) XOR (x AND z) XOR (y AND z)

func sha256T2(a GPPhysical, b GPPhysical, c GPPhysical)

sha256msg1 function #

final SHA256MSG1 for middle rounds that require it

func sha256msg1(m VecPhysical, a VecPhysical)

shuff_00BA_DATA function #

shuffle xBxA -> 00BA

func shuff_00BA_DATA() Mem

shuff_DC00_DATA function #

shuffle xDxC -> DC00

func shuff_DC00_DATA() Mem

vmov function #

msg copy for all but rounds 12-15

func vmov(a VecPhysical, b VecPhysical)

vmovrev function #

reverse copy for rounds 12-15

func vmovrev(a VecPhysical, b VecPhysical)

Generated with Arrow