Skip to content

Commit

Permalink
Merge pull request #119 from formosa-crypto/fix/sct
Browse files Browse the repository at this point in the history
fix sct for mlkem/xwing
  • Loading branch information
tfaoliveira-sb committed Apr 18, 2024
2 parents 0426954 b1d3012 commit 8baa43f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/crypto_kem/mlkem/mlkem768/amd64/avx2/indcpa.jinc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 4,7 @@ require "polyvec.jinc"
require "gen_matrix.jinc"

inline
fn __indcpa_keypair(reg u64 pkp, reg u64 skp, reg ptr u8[MLKEM_SYMBYTES] randomnessp)
fn __indcpa_keypair(#spill_to_mmx reg u64 pkp skp, reg ptr u8[MLKEM_SYMBYTES] randomnessp)
{
stack u16[MLKEM_K*MLKEM_VECN] aa;
stack u16[MLKEM_VECN] e pkpv skpv;
Expand Down
11 changes: 11 additions & 0 deletions src/crypto_kem/mlkem/mlkem768/amd64/avx2/kem.jazz
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 7,8 @@ export fn jade_kem_mlkem_mlkem768_amd64_avx2_keypair_derand(reg u64 public_key s
reg ptr u8[MLKEM_SYMBYTES*2] randomnessp;
inline int i;

_ = #init_msf();

public_key = public_key;
secret_key = secret_key;

Expand All @@ -29,6 31,8 @@ export fn jade_kem_mlkem_mlkem768_amd64_avx2_enc_derand(reg u64 ciphertext share
reg ptr u8[MLKEM_SYMBYTES] randomnessp;
inline int i;

_ = #init_msf();

ciphertext = ciphertext;
shared_secret = shared_secret;
public_key = public_key;
Expand Down Expand Up @@ -56,6 60,8 @@ export fn jade_kem_mlkem_mlkem768_amd64_avx2_keypair(reg u64 public_key secret_k

randomnessp = randomness;
randomnessp = #randombytes(randomnessp);
_ = #init_msf();

__crypto_kem_keypair_jazz(public_key, secret_key, randomnessp);
?{}, r = #set0();
return r;
Expand All @@ -73,6 79,8 @@ export fn jade_kem_mlkem_mlkem768_amd64_avx2_enc(reg u64 ciphertext shared_secre

randomnessp = randomness;
randomnessp = #randombytes(randomnessp);
_ = #init_msf();

__crypto_kem_enc_jazz(ciphertext, shared_secret, public_key, randomnessp);
?{}, r = #set0();
return r;
Expand All @@ -81,6 89,9 @@ export fn jade_kem_mlkem_mlkem768_amd64_avx2_enc(reg u64 ciphertext shared_secre
export fn jade_kem_mlkem_mlkem768_amd64_avx2_dec(reg u64 shared_secret ciphertext secret_key) -> reg u64
{
reg u64 r;

_ = #init_msf();

__crypto_kem_dec_jazz(shared_secret, ciphertext, secret_key);
?{}, r = #set0();
return r;
Expand Down

0 comments on commit 8baa43f

Please sign in to comment.