Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

first cut removing default algs, biker2, adding biker3 #26

Merged
merged 4 commits into from
Jul 10, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions oqs-template/generate-extras.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
# These fields for 'name_group' are added in addition to the ones specified in generate.yml
kems:
-
name_group: 'oqs_kem_default'
nid: '0x01FF'
nid_hybrid: '0x2FFF'
nid_ecx_hybrid: '0x2FFE'
oqs_alg: 'OQS_KEM_alg_default'
bit_security: 128
kem-extras:
frodo640aes:
nid_ecx_hybrid: '0x2F40'
Expand All @@ -16,10 +8,6 @@ kem-extras:
nid_ecx_hybrid: '0x2F42'
frodo976shake:
nid_ecx_hybrid: '0x2F43'
bike1l1cpa:
nid_ecx_hybrid: '0x2F46'
bike1l3cpa:
nid_ecx_hybrid: '0x2F47'
kyber512:
nid_ecx_hybrid: '0x2F26'
bhess marked this conversation as resolved.
Show resolved Hide resolved
kyber768:
Expand Down
9 changes: 8 additions & 1 deletion oqs-template/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,14 @@ def load_config():
config_extras = yaml.safe_load(config_extras)
for sig in config['sigs']:
sig['variants'] = [variant for variant in sig['variants'] if variant['enable']]
config['kems'] = config['kems'] + config_extras['kems']

# remove KEMs without NID (old stuff)
newkems = []
for kem in config['kems']:
if 'nid' in kem:
newkems.append(kem)
config['kems']=newkems

for kem in config['kems']:
if kem['name_group'] in config_extras['kem-extras']:
kem.update(config_extras['kem-extras'][kem['name_group']])
Expand Down
18 changes: 2 additions & 16 deletions oqsprov/oqs_kmgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,16 +396,6 @@ static int oqsx_gen_set_params(void *genctx, const OSSL_PARAM params[])


///// OQS_TEMPLATE_FRAGMENT_KEYMGMT_CONSTRUCTORS_START
static void *oqs_sig_default_new_key(void *provctx)
{
return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_default, "oqs_sig_default", 0, NULL, 128);
}

static void *oqs_sig_default_gen_init(void *provctx, int selection)
{
return oqsx_gen_init(provctx, selection, OQS_SIG_alg_default, 0, 128);
}

static void *dilithium2_new_key(void *provctx)
{
return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), OQS_SIG_alg_dilithium_2, "dilithium2", 0, NULL, 128);
Expand Down Expand Up @@ -673,7 +663,6 @@ static void *sphincsshake256128frobust_gen_init(void *provctx, int selection)
};

///// OQS_TEMPLATE_FRAGMENT_KEYMGMT_FUNCTIONS_START
MAKE_SIG_KEYMGMT_FUNCTIONS(oqs_sig_default)
MAKE_SIG_KEYMGMT_FUNCTIONS(dilithium2)
MAKE_SIG_KEYMGMT_FUNCTIONS(dilithium3)
MAKE_SIG_KEYMGMT_FUNCTIONS(dilithium5)
Expand All @@ -696,8 +685,6 @@ MAKE_KEM_KEYMGMT_FUNCTIONS(frodo976aes, OQS_KEM_alg_frodokem_976_aes, 192)
MAKE_KEM_KEYMGMT_FUNCTIONS(frodo976shake, OQS_KEM_alg_frodokem_976_shake, 192)
MAKE_KEM_KEYMGMT_FUNCTIONS(frodo1344aes, OQS_KEM_alg_frodokem_1344_aes, 256)
MAKE_KEM_KEYMGMT_FUNCTIONS(frodo1344shake, OQS_KEM_alg_frodokem_1344_shake, 256)
MAKE_KEM_KEYMGMT_FUNCTIONS(bike1l1cpa, OQS_KEM_alg_bike1_l1_cpa, 128)
MAKE_KEM_KEYMGMT_FUNCTIONS(bike1l3cpa, OQS_KEM_alg_bike1_l3_cpa, 192)
MAKE_KEM_KEYMGMT_FUNCTIONS(kyber512, OQS_KEM_alg_kyber_512, 128)
MAKE_KEM_KEYMGMT_FUNCTIONS(kyber768, OQS_KEM_alg_kyber_768, 192)
MAKE_KEM_KEYMGMT_FUNCTIONS(kyber1024, OQS_KEM_alg_kyber_1024, 256)
Expand All @@ -716,8 +703,8 @@ MAKE_KEM_KEYMGMT_FUNCTIONS(sikep434, OQS_KEM_alg_sike_p434, 128)
MAKE_KEM_KEYMGMT_FUNCTIONS(sikep503, OQS_KEM_alg_sike_p503, 128)
MAKE_KEM_KEYMGMT_FUNCTIONS(sikep610, OQS_KEM_alg_sike_p610, 192)
MAKE_KEM_KEYMGMT_FUNCTIONS(sikep751, OQS_KEM_alg_sike_p751, 256)
MAKE_KEM_KEYMGMT_FUNCTIONS(bike1l1fo, OQS_KEM_alg_bike1_l1_fo, 128)
MAKE_KEM_KEYMGMT_FUNCTIONS(bike1l3fo, OQS_KEM_alg_bike1_l3_fo, 192)
MAKE_KEM_KEYMGMT_FUNCTIONS(bikel1, OQS_KEM_alg_bike_l1, 128)
MAKE_KEM_KEYMGMT_FUNCTIONS(bikel3, OQS_KEM_alg_bike_l3, 192)
MAKE_KEM_KEYMGMT_FUNCTIONS(kyber90s512, OQS_KEM_alg_kyber_512_90s, 128)
MAKE_KEM_KEYMGMT_FUNCTIONS(kyber90s768, OQS_KEM_alg_kyber_768_90s, 192)
MAKE_KEM_KEYMGMT_FUNCTIONS(kyber90s1024, OQS_KEM_alg_kyber_1024_90s, 256)
Expand All @@ -730,5 +717,4 @@ MAKE_KEM_KEYMGMT_FUNCTIONS(ntrulpr857, OQS_KEM_alg_ntruprime_ntrulpr857, 192)
MAKE_KEM_KEYMGMT_FUNCTIONS(sntrup653, OQS_KEM_alg_ntruprime_sntrup653, 128)
MAKE_KEM_KEYMGMT_FUNCTIONS(sntrup761, OQS_KEM_alg_ntruprime_sntrup761, 192)
MAKE_KEM_KEYMGMT_FUNCTIONS(sntrup857, OQS_KEM_alg_ntruprime_sntrup857, 192)
MAKE_KEM_KEYMGMT_FUNCTIONS(oqs_kem_default, OQS_KEM_alg_default, 128)
///// OQS_TEMPLATE_FRAGMENT_KEYMGMT_FUNCTIONS_END
3 changes: 0 additions & 3 deletions oqsprov/oqs_sig.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ static OSSL_FUNC_signature_settable_ctx_md_params_fn oqs_sig_settable_ctx_md_par
// OIDS:
static int get_oqs_oid(unsigned char* oidbuf, const char *oqs_name) {
///// OQS_TEMPLATE_FRAGMENT_SIG_OIDS_START
if (!strcmp(OQS_SIG_alg_default, oqs_name))
return i2d_ASN1_OBJECT(OBJ_txt2obj("1.3.9999.1.1", 1), &oidbuf);
else
if (!strcmp(OQS_SIG_alg_dilithium_2, oqs_name))
return i2d_ASN1_OBJECT(OBJ_txt2obj("1.3.6.1.4.1.2.267.7.4.4", 1), &oidbuf);
else
Expand Down
38 changes: 10 additions & 28 deletions oqsprov/oqsprov.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ extern const OSSL_DISPATCH oqs_hybrid_kem_functions[];
extern const OSSL_DISPATCH oqs_signature_functions[];

///// OQS_TEMPLATE_FRAGMENT_ALG_FUNCTIONS_START
extern const OSSL_DISPATCH oqs_oqs_sig_default_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_dilithium2_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_dilithium3_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_dilithium5_keymgmt_functions[];
Expand All @@ -76,8 +75,6 @@ extern const OSSL_DISPATCH oqs_frodo976aes_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_frodo976shake_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_frodo1344aes_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_frodo1344shake_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_bike1l1cpa_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_bike1l3cpa_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_kyber512_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_kyber768_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_kyber1024_keymgmt_functions[];
Expand All @@ -96,8 +93,8 @@ extern const OSSL_DISPATCH oqs_sikep434_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_sikep503_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_sikep610_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_sikep751_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_bike1l1fo_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_bike1l3fo_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_bikel1_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_bikel3_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_kyber90s512_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_kyber90s768_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_kyber90s1024_keymgmt_functions[];
Expand All @@ -110,16 +107,13 @@ extern const OSSL_DISPATCH oqs_ntrulpr857_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_sntrup653_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_sntrup761_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_sntrup857_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_oqs_kem_default_keymgmt_functions[];

extern const OSSL_DISPATCH oqs_ecp_frodo640aes_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecp_frodo640shake_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecp_frodo976aes_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecp_frodo976shake_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecp_frodo1344aes_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecp_frodo1344shake_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecp_bike1l1cpa_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecp_bike1l3cpa_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecp_kyber512_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecp_kyber768_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecp_kyber1024_keymgmt_functions[];
Expand All @@ -138,8 +132,8 @@ extern const OSSL_DISPATCH oqs_ecp_sikep434_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecp_sikep503_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecp_sikep610_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecp_sikep751_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecp_bike1l1fo_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecp_bike1l3fo_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecp_bikel1_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecp_bikel3_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecp_kyber90s512_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecp_kyber90s768_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecp_kyber90s1024_keymgmt_functions[];
Expand All @@ -152,16 +146,13 @@ extern const OSSL_DISPATCH oqs_ecp_ntrulpr857_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecp_sntrup653_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecp_sntrup761_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecp_sntrup857_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecp_oqs_kem_default_keymgmt_functions[];

extern const OSSL_DISPATCH oqs_ecx_frodo640aes_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecx_frodo640shake_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecx_frodo976aes_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecx_frodo976shake_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecx_frodo1344aes_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecx_frodo1344shake_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecx_bike1l1cpa_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecx_bike1l3cpa_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecx_kyber512_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecx_kyber768_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecx_kyber1024_keymgmt_functions[];
Expand All @@ -180,8 +171,8 @@ extern const OSSL_DISPATCH oqs_ecx_sikep434_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecx_sikep503_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecx_sikep610_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecx_sikep751_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecx_bike1l1fo_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecx_bike1l3fo_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecx_bikel1_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecx_bikel3_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecx_kyber90s512_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecx_kyber90s768_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecx_kyber90s1024_keymgmt_functions[];
Expand All @@ -194,12 +185,10 @@ extern const OSSL_DISPATCH oqs_ecx_ntrulpr857_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecx_sntrup653_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecx_sntrup761_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecx_sntrup857_keymgmt_functions[];
extern const OSSL_DISPATCH oqs_ecx_oqs_kem_default_keymgmt_functions[];
///// OQS_TEMPLATE_FRAGMENT_ALG_FUNCTIONS_END

static const OSSL_ALGORITHM oqsprovider_signatures[] = {
///// OQS_TEMPLATE_FRAGMENT_SIG_FUNCTIONS_START
ALG("oqs_sig_default", oqs_signature_functions),
ALG("dilithium2", oqs_signature_functions),
ALG("dilithium3", oqs_signature_functions),
ALG("dilithium5", oqs_signature_functions),
Expand Down Expand Up @@ -227,8 +216,6 @@ static const OSSL_ALGORITHM oqsprovider_asym_kems[] = {
KEMALG3(frodo976shake, 192),
KEMALG3(frodo1344aes, 256),
KEMALG3(frodo1344shake, 256),
KEMALG3(bike1l1cpa, 128),
KEMALG3(bike1l3cpa, 192),
KEMALG3(kyber512, 128),
KEMALG3(kyber768, 192),
KEMALG3(kyber1024, 256),
Expand All @@ -247,8 +234,8 @@ static const OSSL_ALGORITHM oqsprovider_asym_kems[] = {
KEMALG3(sikep503, 128),
KEMALG3(sikep610, 192),
KEMALG3(sikep751, 256),
KEMALG3(bike1l1fo, 128),
KEMALG3(bike1l3fo, 192),
KEMALG3(bikel1, 128),
KEMALG3(bikel3, 192),
KEMALG3(kyber90s512, 128),
KEMALG3(kyber90s768, 192),
KEMALG3(kyber90s1024, 256),
Expand All @@ -261,14 +248,12 @@ static const OSSL_ALGORITHM oqsprovider_asym_kems[] = {
KEMALG3(sntrup653, 128),
KEMALG3(sntrup761, 192),
KEMALG3(sntrup857, 192),
KEMALG3(oqs_kem_default, 128),
///// OQS_TEMPLATE_FRAGMENT_KEM_FUNCTIONS_END
{ NULL, NULL, NULL }
};

static const OSSL_ALGORITHM oqsprovider_keymgmt[] = {
///// OQS_TEMPLATE_FRAGMENT_KEYMGMT_FUNCTIONS_START
ALG("oqs_sig_default", oqs_oqs_sig_default_keymgmt_functions),
ALG("dilithium2", oqs_dilithium2_keymgmt_functions),
ALG("dilithium3", oqs_dilithium3_keymgmt_functions),
ALG("dilithium5", oqs_dilithium5_keymgmt_functions),
Expand All @@ -291,8 +276,6 @@ static const OSSL_ALGORITHM oqsprovider_keymgmt[] = {
KEMKMALG3(frodo976shake, 192),
KEMKMALG3(frodo1344aes, 256),
KEMKMALG3(frodo1344shake, 256),
KEMKMALG3(bike1l1cpa, 128),
KEMKMALG3(bike1l3cpa, 192),
KEMKMALG3(kyber512, 128),
KEMKMALG3(kyber768, 192),
KEMKMALG3(kyber1024, 256),
Expand All @@ -311,8 +294,8 @@ static const OSSL_ALGORITHM oqsprovider_keymgmt[] = {
KEMKMALG3(sikep503, 128),
KEMKMALG3(sikep610, 192),
KEMKMALG3(sikep751, 256),
KEMKMALG3(bike1l1fo, 128),
KEMKMALG3(bike1l3fo, 192),
KEMKMALG3(bikel1, 128),
KEMKMALG3(bikel3, 192),
KEMKMALG3(kyber90s512, 128),
KEMKMALG3(kyber90s768, 192),
KEMKMALG3(kyber90s1024, 256),
Expand All @@ -325,7 +308,6 @@ static const OSSL_ALGORITHM oqsprovider_keymgmt[] = {
KEMKMALG3(sntrup653, 128),
KEMKMALG3(sntrup761, 192),
KEMKMALG3(sntrup857, 192),
KEMKMALG3(oqs_kem_default, 128),
///// OQS_TEMPLATE_FRAGMENT_KEYMGMT_FUNCTIONS_END
//ALG("x25519_sikep434", oqs_ecx_sikep434_keymgmt_functions),
{ NULL, NULL, NULL }
Expand Down
Loading