Skip to content

Commit

Permalink
sct: crypto_xof
Browse files Browse the repository at this point in the history
  • Loading branch information
tfaoliveira committed Jun 26, 2024
1 parent 43fd681 commit a283669
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/common/keccak/keccak1600/amd64/spec/keccak1600.jinc
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ inline fn __xtr_bytes_spec(
inline fn __keccak1600_spec(reg u64 out outlen in inlen, reg u8 trail_byte, reg u64 rate)
{
stack u64[25] state;
stack u64 s_out s_outlen s_in s_inlen s_rate;
#mmx reg u64 s_out s_outlen s_in s_inlen s_rate;
stack u8 s_trail_byte;

s_out = out;
Expand Down
4 changes: 2 additions & 2 deletions src/crypto_xof/shake128/amd64/avx2/shake128.jinc
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from Jade require "common/keccak/keccak1600/amd64/avx2/keccak1600.jinc"

inline fn __shake128_avx2(reg u64 out outlen in inlen)
inline fn __shake128_avx2(reg u64 out outlen in inlen, #msf reg u64 ms)
{
reg u64 rate;
reg u8 trail_byte;

trail_byte = 0x1F;
rate = (1344/8);

__keccak1600_avx2(out, outlen, in, inlen, trail_byte, rate);
__keccak1600_avx2(out, outlen, in, inlen, trail_byte, rate, ms);
}


6 changes: 5 additions & 1 deletion src/crypto_xof/shake128/amd64/avx2/xof.jazz
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ require "shake128.jinc"
export fn jade_xof_shake128_amd64_avx2(reg u64 output output_length input input_length) -> reg u64
{
reg u64 r;
__shake128_avx2(output, output_length, input, input_length);
#msf reg u64 ms;

ms = #init_msf();

__shake128_avx2(output, output_length, input, input_length, ms);
?{}, r = #set0();
return r;
}
Expand Down
3 changes: 3 additions & 0 deletions src/crypto_xof/shake128/amd64/bmi1/xof.jazz
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ require "shake128.jinc"
export fn jade_xof_shake128_amd64_bmi1(reg u64 output output_length input input_length) -> reg u64
{
reg u64 r;

_ = #init_msf();

__shake128_bmi1(output, output_length, input, input_length);
?{}, r = #set0();
return r;
Expand Down
3 changes: 3 additions & 0 deletions src/crypto_xof/shake128/amd64/ref/xof.jazz
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ require "shake128.jinc"
export fn jade_xof_shake128_amd64_ref(reg u64 output output_length input input_length) -> reg u64
{
reg u64 r;

_ = #init_msf();

__shake128_ref(output, output_length, input, input_length);
?{}, r = #set0();
return r;
Expand Down
3 changes: 3 additions & 0 deletions src/crypto_xof/shake128/amd64/ref1/xof.jazz
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ require "shake128.jinc"
export fn jade_xof_shake128_amd64_ref1(reg u64 output output_length input input_length) -> reg u64
{
reg u64 r;

_ = #init_msf();

__shake128_ref1(output, output_length, input, input_length);
?{}, r = #set0();
return r;
Expand Down
4 changes: 2 additions & 2 deletions src/crypto_xof/shake256/amd64/avx2/shake256.jinc
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from Jade require "common/keccak/keccak1600/amd64/avx2/keccak1600.jinc"

inline fn __shake256_avx2(reg u64 out outlen in inlen)
inline fn __shake256_avx2(reg u64 out outlen in inlen, #msf reg u64 ms)
{
reg u64 rate;
reg u8 trail_byte;

trail_byte = 0x1F;
rate = (1088/8);

__keccak1600_avx2(out, outlen, in, inlen, trail_byte, rate);
__keccak1600_avx2(out, outlen, in, inlen, trail_byte, rate, ms);
}


7 changes: 6 additions & 1 deletion src/crypto_xof/shake256/amd64/avx2/xof.jazz
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ require "shake256.jinc"
export fn jade_xof_shake256_amd64_avx2(reg u64 output output_length input input_length) -> reg u64
{
reg u64 r;
__shake256_avx2(output, output_length, input, input_length);
#msf reg u64 ms;

ms = #init_msf();

__shake256_avx2(output, output_length, input, input_length, ms);

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

_ = #init_msf();

__shake256_bmi1(output, output_length, input, input_length);
?{}, r = #set0();
return r;
Expand Down
3 changes: 3 additions & 0 deletions src/crypto_xof/shake256/amd64/ref/xof.jazz
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ require "shake256.jinc"
export fn jade_xof_shake256_amd64_ref(reg u64 output output_length input input_length) -> reg u64
{
reg u64 r;

_ = #init_msf();

__shake256_ref(output, output_length, input, input_length);
?{}, r = #set0();
return r;
Expand Down
3 changes: 3 additions & 0 deletions src/crypto_xof/shake256/amd64/ref1/xof.jazz
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ require "shake256.jinc"
export fn jade_xof_shake256_amd64_ref1(reg u64 output output_length input input_length) -> reg u64
{
reg u64 r;

_ = #init_msf();

__shake256_ref1(output, output_length, input, input_length);
?{}, r = #set0();
return r;
Expand Down
3 changes: 3 additions & 0 deletions src/crypto_xof/shake256/amd64/spec/xof.jazz
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ require "shake256.jinc"
export fn jade_xof_shake256_amd64_spec(reg u64 output output_length input input_length) -> reg u64
{
reg u64 r;

_ = #init_msf();

__shake256_spec(output, output_length, input, input_length);
?{}, r = #set0();
return r;
Expand Down

0 comments on commit a283669

Please sign in to comment.