Skip to content

Commit

Permalink
Added checksums, fixed bad param and cleaned up code
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaoDiogoDuarte committed Feb 20, 2024
1 parent 202f10a commit 242496f
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/crypto_kem/xwing/META.yml
Original file line number Diff line number Diff line change
@@ -1,7 1,7 @@
name: X-Wing
type: kem
checksumsmall:
checksumbig:
checksumsmall: 844bca7a113f642135f10d7ab047f8fbc137a6d0c7bbe64dbde0b48c46681872
checksumbig: 05451934bd516a3b885896e7e448d9739ed1ccc67339f438db230bd479f026bb
claimed-nist-level: 3
claimed-security: IND-CCA2
length-public-key: 1216
Expand Down
2 changes: 1 addition & 1 deletion src/crypto_kem/xwing/amd64/avx2/include/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 5,7 @@

#define JADE_KEM_xwing_amd64_avx2_PUBLICKEYBYTES 1216
#define JADE_KEM_xwing_amd64_avx2_SECRETKEYBYTES 2464
#define JADE_KEM_xwing_amd64_avx2_CIPHERTEXTBYTES 1200
#define JADE_KEM_xwing_amd64_avx2_CIPHERTEXTBYTES 1120
#define JADE_KEM_xwing_amd64_avx2_KEYPAIRCOINBYTES 96
#define JADE_KEM_xwing_amd64_avx2_ENCCOINBYTES 64
#define JADE_KEM_xwing_amd64_avx2_BYTES 32
Expand Down
6 changes: 2 additions & 4 deletions src/crypto_kem/xwing/amd64/avx2/kem.jazz
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 6,13 @@ export fn jade_kem_xwing_amd64_avx2_keypair_derand(reg u64 public_key secret_key
{
reg u64 r;
stack u8[96] stack_coins;
reg ptr u8[96] stack_coins_p;

public_key = public_key;
secret_key = secret_key;

stack_coins_p = stack_coins;
stack_coins_p = __tostack96u8(stack_coins_p, coins);
stack_coins = __tostack96u8(stack_coins, coins);

_crypto_xkem_keypair_derand_jazz(public_key, secret_key, stack_coins_p);
_crypto_xkem_keypair_derand_jazz(public_key, secret_key, stack_coins);

?{}, r = #set0();
return r;
Expand Down
2 changes: 1 addition & 1 deletion src/crypto_kem/xwing/amd64/ref/include/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 5,7 @@

#define JADE_KEM_xwing_amd64_ref_PUBLICKEYBYTES 1216
#define JADE_KEM_xwing_amd64_ref_SECRETKEYBYTES 2464
#define JADE_KEM_xwing_amd64_ref_CIPHERTEXTBYTES 1200
#define JADE_KEM_xwing_amd64_ref_CIPHERTEXTBYTES 1120
#define JADE_KEM_xwing_amd64_ref_KEYPAIRCOINBYTES 96
#define JADE_KEM_xwing_amd64_ref_ENCCOINBYTES 64
#define JADE_KEM_xwing_amd64_ref_BYTES 32
Expand Down
6 changes: 2 additions & 4 deletions src/crypto_kem/xwing/amd64/ref/kem.jazz
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 6,13 @@ export fn jade_kem_xwing_amd64_ref_keypair_derand(reg u64 public_key secret_key
{
reg u64 r;
stack u8[96] stack_coins;
reg ptr u8[96] stack_coins_p;

public_key = public_key;
secret_key = secret_key;

stack_coins_p = stack_coins;
stack_coins_p = __tostack96u8(stack_coins_p, coins);
stack_coins = __tostack96u8(stack_coins, coins);

_crypto_xkem_keypair_derand_jazz(public_key, secret_key, stack_coins_p);
_crypto_xkem_keypair_derand_jazz(public_key, secret_key, stack_coins);

?{}, r = #set0();
return r;
Expand Down
2 changes: 1 addition & 1 deletion src/crypto_kem/xwing/amd64/ref/kem.jinc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 29,7 @@ fn _crypto_xkem_keypair_derand_jazz(reg u64 pkp, reg u64 skp, reg ptr u8[3*XWING

inline int i;
for i=0 to X25519_PUBLICKEYBYTES {
[skp i] = [pkp i];
(u8)[skp i] = (u8)[pkp i];
}
}

Expand Down

0 comments on commit 242496f

Please sign in to comment.