-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from JoaoDiogoDuarte/main
Implemented X-Wing (ref and avx2) in libjade
- Loading branch information
Showing
19 changed files
with
849 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 1,4 @@ | ||
.ci | ||
*.tar.gz | ||
libjade-* | ||
.vscode |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,26 @@ | ||
name: X-Wing | ||
type: kem | ||
checksumsmall: 844bca7a113f642135f10d7ab047f8fbc137a6d0c7bbe64dbde0b48c46681872 | ||
checksumbig: 05451934bd516a3b885896e7e448d9739ed1ccc67339f438db230bd479f026bb | ||
claimed-nist-level: 3 | ||
claimed-security: IND-CCA2 | ||
length-public-key: 1216 | ||
length-ciphertext: 1120 | ||
length-secret-key: 2464 | ||
length-shared-secret: 32 | ||
principal-submitters: | ||
- TODO | ||
auxiliary-submitters: | ||
- TODO | ||
implementations: | ||
- name: amd64/ref | ||
version: TODO | ||
supported_platforms: | ||
- architecture: x86_64 | ||
operating_systems: | ||
- Linux | ||
- Darwin | ||
required_flags: # FIXME | ||
- avx2 | ||
- bmi2 | ||
- popcnt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,3 @@ | ||
SAFETY_FLAGS := -nocheckalignment | ||
SRCS := kem.jazz | ||
include ../../../../Makefile.common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,47 @@ | ||
#ifndef JADE_KEM_xwing_amd64_avx2_API_H | ||
#define JADE_KEM_xwing_amd64_avx2_API_H | ||
|
||
#include <stdint.h> | ||
|
||
#define JADE_KEM_xwing_amd64_avx2_PUBLICKEYBYTES 1216 | ||
#define JADE_KEM_xwing_amd64_avx2_SECRETKEYBYTES 2464 | ||
#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 | ||
|
||
#define JADE_KEM_xwing_amd64_avx2_ALGNAME "X-Wing" | ||
#define JADE_KEM_xwing_amd64_avx2_ARCH "amd64" | ||
#define JADE_KEM_xwing_amd64_avx2_IMPL "ref" | ||
|
||
int jade_kem_xwing_amd64_avx2_keypair_derand( | ||
uint8_t *public_key, | ||
uint8_t *secret_key, | ||
const uint8_t *coins | ||
); | ||
|
||
int jade_kem_xwing_amd64_avx2_keypair( | ||
uint8_t *public_key, | ||
uint8_t *secret_key | ||
); | ||
|
||
int jade_kem_xwing_amd64_avx2_enc_derand( | ||
uint8_t *ciphertext, | ||
uint8_t *shared_secret, | ||
const uint8_t *public_key, | ||
const uint8_t *coins | ||
); | ||
|
||
int jade_kem_xwing_amd64_avx2_enc( | ||
uint8_t *ciphertext, | ||
uint8_t *shared_secret, | ||
const uint8_t *public_key | ||
); | ||
|
||
int jade_kem_xwing_amd64_avx2_dec( | ||
uint8_t *shared_secret, | ||
const uint8_t *ciphertext, | ||
const uint8_t *secret_key | ||
); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,70 @@ | ||
require "params.jinc" | ||
require "kem.jinc" | ||
from Jade require "common/tofromstack.jinc" | ||
|
||
export fn jade_kem_xwing_amd64_avx2_keypair_derand(reg u64 public_key secret_key coins) -> reg u64 | ||
{ | ||
reg u64 r; | ||
stack u8[96] stack_coins; | ||
|
||
public_key = public_key; | ||
secret_key = secret_key; | ||
|
||
stack_coins = __tostack96u8(stack_coins, coins); | ||
|
||
_crypto_xkem_keypair_derand_jazz(public_key, secret_key, stack_coins); | ||
|
||
?{}, r = #set0(); | ||
return r; | ||
} | ||
|
||
|
||
export fn jade_kem_xwing_amd64_avx2_keypair(reg u64 public_key secret_key) -> reg u64 | ||
{ | ||
reg u64 r; | ||
stack u8[96] stack_coins; | ||
|
||
public_key = public_key; | ||
secret_key = secret_key; | ||
stack_coins = #randombytes(stack_coins); | ||
_crypto_xkem_keypair_derand_jazz(public_key, secret_key, stack_coins); | ||
?{}, r = #set0(); | ||
return r; | ||
} | ||
|
||
export fn jade_kem_xwing_amd64_avx2_enc_derand(reg u64 ciphertext shared_secret public_key coins) -> reg u64 | ||
{ | ||
reg u64 r; | ||
stack u8[64] stack_coins; | ||
|
||
ciphertext = ciphertext; | ||
shared_secret = shared_secret; | ||
public_key = public_key; | ||
stack_coins = __tostack64u8(stack_coins, coins); | ||
_crypto_xkem_enc_derand_jazz(ciphertext, shared_secret, public_key, stack_coins); | ||
?{}, r = #set0(); | ||
return r; | ||
} | ||
|
||
export fn jade_kem_xwing_amd64_avx2_enc(reg u64 ciphertext shared_secret public_key) -> reg u64 | ||
{ | ||
reg u64 r; | ||
stack u8[64] stack_coins; | ||
|
||
ciphertext = ciphertext; | ||
shared_secret = shared_secret; | ||
public_key = public_key; | ||
stack_coins = #randombytes(stack_coins); | ||
_crypto_xkem_enc_derand_jazz(ciphertext, shared_secret, public_key, stack_coins); | ||
?{}, r = #set0(); | ||
return r; | ||
} | ||
|
||
export fn jade_kem_xwing_amd64_avx2_dec(reg u64 shared_secret ciphertext secret_key) -> reg u64 | ||
{ | ||
reg u64 r; | ||
__crypto_xkem_dec_jazz(shared_secret, ciphertext, secret_key); | ||
?{}, r = #set0(); | ||
return r; | ||
} | ||
|
Oops, something went wrong.