Skip to content

Commit

Permalink
sct: crypto_hash sha3-* ref and bmi1
Browse files Browse the repository at this point in the history
  • Loading branch information
tfaoliveira committed Jun 26, 2024
1 parent b639b73 commit 43fd681
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/common/keccak/keccak1600/amd64/bmi1/keccak1600.jinc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ inline fn __absorb_bmi1(
reg u64 rate // rate already in bytes -- it is returned bc of spills
) -> reg ptr u64[25], reg u64
{
stack u64 s_in s_inlen s_rate;
#mmx reg u64 s_in s_inlen s_rate;
reg u8 trail_byte;

// intermediate blocks
Expand Down Expand Up @@ -174,13 +174,13 @@ inline fn __xtr_bytes_bmi1(

inline fn __squeeze_bmi1(
reg mut ptr u64[25] state,
stack u64 s_out,
reg u64 outlen,
reg u64 rate
#mmx reg u64 s_out,
reg u64 outlen,
reg u64 rate
)
{
reg u64 out;
stack u64 s_outlen s_rate;
#mmx reg u64 s_outlen s_rate;

// intermediate blocks
while ( outlen > rate )
Expand Down Expand Up @@ -213,7 +213,7 @@ inline fn __keccak1600_bmi1(reg u64 out outlen in inlen, reg u8 trail_byte, reg
{
stack u64[25] _state;
reg ptr u64[25] state;
stack u64 s_out s_outlen;
#mmx reg u64 s_out s_outlen;
stack u8 s_trail_byte;

s_out = out;
Expand Down
2 changes: 1 addition & 1 deletion src/common/keccak/keccak1600/amd64/bmi1/keccakf1600.jinc
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ inline fn __round_bmi1(reg ptr u64[25] e a, reg u64 rc) -> reg ptr u64[25]
inline fn __keccakf1600_bmi1(reg ptr u64[25] a) -> reg ptr u64[25]
{
reg ptr u64[24] RC;
stack ptr u64[24] s_RC;
#mmx reg ptr u64[24] s_RC;
stack u64[25] s_e;
reg ptr u64[25] e;
reg u64 c rc;
Expand Down
8 changes: 4 additions & 4 deletions src/common/keccak/keccak1600/amd64/ref/keccak1600.jinc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ inline fn __absorb_ref(
reg u64 rate // rate already in bytes -- it is returned bc of spills
) -> stack u64[25], reg u64
{
stack u64 s_in s_inlen s_rate;
#mmx reg u64 s_in s_inlen s_rate;
reg u8 trail_byte;

// intermediate blocks
Expand Down Expand Up @@ -171,13 +171,13 @@ inline fn __xtr_bytes_ref(

inline fn __squeeze_ref(
stack u64[25] state,
stack u64 s_out,
#mmx reg u64 s_out,
reg u64 outlen,
reg u64 rate
)
{
reg u64 out;
stack u64 s_outlen s_rate;
#mmx reg u64 s_outlen s_rate;

// intermediate blocks
while ( outlen > rate )
Expand Down Expand Up @@ -205,7 +205,7 @@ inline fn __squeeze_ref(
inline fn __keccak1600_ref(reg u64 out outlen in inlen, reg u8 trail_byte, reg u64 rate)
{
stack u64[25] state;
stack u64 s_out s_outlen;
#mmx reg u64 s_out s_outlen;
stack u8 s_trail_byte;

s_out = out;
Expand Down
3 changes: 3 additions & 0 deletions src/crypto_hash/sha3-224/amd64/bmi1/hash.jazz
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ require "sha3-224.jinc"
export fn jade_hash_sha3_224_amd64_bmi1(reg u64 hash input input_length) -> reg u64
{
reg u64 r;

_ = #init_msf();

__sha3_224_bmi1(hash, input, input_length);
?{}, r = #set0();
return r;
Expand Down
3 changes: 3 additions & 0 deletions src/crypto_hash/sha3-224/amd64/ref/hash.jazz
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ require "sha3-224.jinc"
export fn jade_hash_sha3_224_amd64_ref(reg u64 hash input input_length) -> reg u64
{
reg u64 r;

_ = #init_msf();

__sha3_224_ref(hash, input, input_length);
?{}, r = #set0();
return r;
Expand Down
3 changes: 3 additions & 0 deletions src/crypto_hash/sha3-256/amd64/bmi1/hash.jazz
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ require "sha3-256.jinc"
export fn jade_hash_sha3_256_amd64_bmi1(reg u64 hash input input_length) -> reg u64
{
reg u64 r;

_ = #init_msf();

__sha3_256_bmi1(hash, input, input_length);
?{}, r = #set0();
return r;
Expand Down
3 changes: 3 additions & 0 deletions src/crypto_hash/sha3-256/amd64/ref/hash.jazz
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ require "sha3-256.jinc"
export fn jade_hash_sha3_256_amd64_ref(reg u64 hash input input_length) -> reg u64
{
reg u64 r;

_ = #init_msf();

__sha3_256_ref(hash, input, input_length);
?{}, r = #set0();
return r;
Expand Down
3 changes: 3 additions & 0 deletions src/crypto_hash/sha3-384/amd64/bmi1/hash.jazz
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ require "sha3-384.jinc"
export fn jade_hash_sha3_384_amd64_bmi1(reg u64 hash input input_length) -> reg u64
{
reg u64 r;

_ = #init_msf();

__sha3_384_bmi1(hash, input, input_length);
?{}, r = #set0();
return r;
Expand Down
3 changes: 3 additions & 0 deletions src/crypto_hash/sha3-384/amd64/ref/hash.jazz
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ require "sha3-384.jinc"
export fn jade_hash_sha3_384_amd64_ref(reg u64 hash input input_length) -> reg u64
{
reg u64 r;

_ = #init_msf();

__sha3_384_ref(hash, input, input_length);
?{}, r = #set0();
return r;
Expand Down
3 changes: 3 additions & 0 deletions src/crypto_hash/sha3-512/amd64/bmi1/hash.jazz
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ require "sha3-512.jinc"
export fn jade_hash_sha3_512_amd64_bmi1(reg u64 hash input input_length) -> reg u64
{
reg u64 r;

_ = #init_msf();

__sha3_512_bmi1(hash, input, input_length);
?{}, r = #set0();
return r;
Expand Down
3 changes: 3 additions & 0 deletions src/crypto_hash/sha3-512/amd64/ref/hash.jazz
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ require "sha3-512.jinc"
export fn jade_hash_sha3_512_amd64_ref(reg u64 hash input input_length) -> reg u64
{
reg u64 r;

_ = #init_msf();

__sha3_512_ref(hash, input, input_length);
?{}, r = #set0();
return r;
Expand Down

0 comments on commit 43fd681

Please sign in to comment.