Skip to content
Snippets Groups Projects
Commit b483ce75 authored by Niels Möller's avatar Niels Möller
Browse files

New macros GHASH_REDUCE.

parent e91f1eea
No related branches found
No related tags found
No related merge requests found
...@@ -79,3 +79,14 @@ define(`OPN_XXXY', ...@@ -79,3 +79,14 @@ define(`OPN_XXXY',
ifelse(eval($# > 3), 1, ifelse(eval($# > 3), 1,
`OPN_XXXY($1, $2, shift(shift(shift($@))))dnl `OPN_XXXY($1, $2, shift(shift(shift($@))))dnl
')') ')')
C FIXME: If we allow clobber of F, no need for T register.
C Polynomial reduction D = R + x^{-64} F mod P
C where x^{-64} = x^{64} + P1 (mod P)
C GHASH_REDUCE(D, R, F, P1, T)
define(`GHASH_REDUCE', `
vpmsumd $5,$3,$4
xxswapd VSR($1),VSR($3)
vxor $5, $5, $2
vxor $1, $1, $5
')
...@@ -170,11 +170,7 @@ IF_LE(` ...@@ -170,11 +170,7 @@ IF_LE(`
vxor F,F,F3 vxor F,F,F3
vxor R,R,R3 vxor R,R,R3
C reduction GHASH_REDUCE(D, R, F, POLY_L, T)
vpmsumd T,F,POLY_L
xxswapd VSR(D),VSR(F)
vxor R,R,T
vxor D,R,D
addi DATA,DATA,0x40 addi DATA,DATA,0x40
bdnz L4x_loop bdnz L4x_loop
...@@ -228,11 +224,7 @@ IF_LE(` ...@@ -228,11 +224,7 @@ IF_LE(`
vxor F,F,F2 vxor F,F,F2
vxor R,R,R2 vxor R,R,R2
C reduction GHASH_REDUCE(D, R, F, POLY_L, T)
vpmsumd T,F,POLY_L
xxswapd VSR(D),VSR(F)
vxor R,R,T
vxor D,R,D
addi DATA,DATA,0x20 addi DATA,DATA,0x20
clrldi BLOCKS,BLOCKS,63 C 'set the high-order 63 bits to zeros' clrldi BLOCKS,BLOCKS,63 C 'set the high-order 63 bits to zeros'
...@@ -261,11 +253,7 @@ IF_LE(` ...@@ -261,11 +253,7 @@ IF_LE(`
vpmsumd F,H1L,C0 vpmsumd F,H1L,C0
vpmsumd R,H1M,C0 vpmsumd R,H1M,C0
C reduction GHASH_REDUCE(D, R, F, POLY_L, T)
vpmsumd T,F,POLY_L
xxswapd VSR(D),VSR(F)
vxor R,R,T
vxor D,R,D
addi DATA,DATA,0x10 addi DATA,DATA,0x10
clrldi BLOCKS,BLOCKS,60 C 'set the high-order 60 bits to zeros' clrldi BLOCKS,BLOCKS,60 C 'set the high-order 60 bits to zeros'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment