-
Notifications
You must be signed in to change notification settings - Fork 19
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 #116 from formosa-crypto/feature/xwing
xwing
- Loading branch information
Showing
20 changed files
with
722 additions
and
20 deletions.
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
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: d80f0bfdf6d38a189cfffe48c048973521c02456bde1934475c38e0819c4afae | ||
checksumbig: 607234d1da70d4441c64c8bb3deff3f22728a38942500457c92dbcdaf393d0c0 | ||
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,92 @@ | ||
from Jade require "common/tofromstack.jinc" | ||
|
||
from Jade require "crypto_kem/mlkem/mlkem768/amd64/avx2/kem.jinc" | ||
from Jade require "crypto_kem/xwing/amd64/ref/kem.jinc" | ||
from Jade require "crypto_kem/xwing/amd64/ref/params.jinc" | ||
|
||
export fn jade_kem_xwing_amd64_avx2_keypair_derand(reg u64 public_key secret_key coins) -> reg u64 | ||
{ | ||
reg u64 r; | ||
stack u8[XWING_KEYPAIRCOINBYTES] stack_coins; | ||
|
||
_ = #init_msf(); | ||
|
||
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[XWING_KEYPAIRCOINBYTES] stack_coins; | ||
|
||
_ = #init_msf(); | ||
|
||
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[XWING_ENCCOINBYTES] stack_coins; | ||
|
||
_ = #init_msf(); | ||
|
||
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[XWING_ENCCOINBYTES] stack_coins; | ||
|
||
_ = #init_msf(); | ||
|
||
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; | ||
|
||
_ = #init_msf(); | ||
|
||
shared_secret = shared_secret; | ||
ciphertext = ciphertext; | ||
secret_key = secret_key; | ||
|
||
_crypto_xkem_dec_jazz(shared_secret, ciphertext, secret_key); | ||
|
||
?{}, r = #set0(); | ||
return r; | ||
} | ||
|
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 |
Oops, something went wrong.