Skip to content

Commit

Permalink
Implementation of Composite Sig (#317)
Browse files Browse the repository at this point in the history
* Add implementation of Composite signatures

Signed-off-by: Felipe Ventura <[email protected]>
  • Loading branch information
feventura authored Mar 19, 2024
1 parent f581687 commit 9dc9824
Show file tree
Hide file tree
Showing 30 changed files with 3,122 additions and 573 deletions.
13 changes: 13 additions & 0 deletions ALGORITHMS.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,23 @@ adapting the OIDs of all supported signature algorithms as per the table below.
| mldsa44 | 1.3.6.1.4.1.2.267.12.4.4 |Yes| OQS_OID_MLDSA44
| p256_mldsa44 | 1.3.9999.7.1 |Yes| OQS_OID_P256_MLDSA44
| rsa3072_mldsa44 | 1.3.9999.7.2 |Yes| OQS_OID_RSA3072_MLDSA44
| mldsa44_pss2048 | 2.16.840.1.114027.80.8.1.1 |Yes| OQS_OID_MLDSA44_pss2048
| mldsa44_rsa2048 | 2.16.840.1.114027.80.8.1.2 |Yes| OQS_OID_MLDSA44_rsa2048
| mldsa44_ed25519 | 2.16.840.1.114027.80.8.1.3 |Yes| OQS_OID_MLDSA44_ed25519
| mldsa44_p256 | 2.16.840.1.114027.80.8.1.4 |Yes| OQS_OID_MLDSA44_p256
| mldsa44_bp256 | 2.16.840.1.114027.80.8.1.5 |Yes| OQS_OID_MLDSA44_bp256
| mldsa65 | 1.3.6.1.4.1.2.267.12.6.5 |Yes| OQS_OID_MLDSA65
| p384_mldsa65 | 1.3.9999.7.3 |Yes| OQS_OID_P384_MLDSA65
| mldsa65_pss3072 | 2.16.840.1.114027.80.8.1.6 |Yes| OQS_OID_MLDSA65_pss3072
| mldsa65_rsa3072 | 2.16.840.1.114027.80.8.1.7 |Yes| OQS_OID_MLDSA65_rsa3072
| mldsa65_p256 | 2.16.840.1.114027.80.8.1.8 |Yes| OQS_OID_MLDSA65_p256
| mldsa65_bp256 | 2.16.840.1.114027.80.8.1.9 |Yes| OQS_OID_MLDSA65_bp256
| mldsa65_ed25519 | 2.16.840.1.114027.80.8.1.10 |Yes| OQS_OID_MLDSA65_ed25519
| mldsa87 | 1.3.6.1.4.1.2.267.12.8.7 |Yes| OQS_OID_MLDSA87
| p521_mldsa87 | 1.3.9999.7.4 |Yes| OQS_OID_P521_MLDSA87
| mldsa87_p384 | 2.16.840.1.114027.80.8.1.11 |Yes| OQS_OID_MLDSA87_p384
| mldsa87_bp384 | 2.16.840.1.114027.80.8.1.12 |Yes| OQS_OID_MLDSA87_bp384
| mldsa87_ed448 | 2.16.840.1.114027.80.8.1.13 |Yes| OQS_OID_MLDSA87_ed448
| falcon512 | 1.3.9999.3.11 |Yes| OQS_OID_FALCON512
| p256_falcon512 | 1.3.9999.3.12 |Yes| OQS_OID_P256_FALCON512
| rsa3072_falcon512 | 1.3.9999.3.13 |Yes| OQS_OID_RSA3072_FALCON512
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ This implementation makes available the following quantum safe algorithms:
### Signature algorithms

- **CRYSTALS-Dilithium**:`dilithium2`\*, `p256_dilithium2`\*, `rsa3072_dilithium2`\*, `dilithium3`\*, `p384_dilithium3`\*, `dilithium5`\*, `p521_dilithium5`\*
- **ML-DSA**:`mldsa44`\*, `p256_mldsa44`\*, `rsa3072_mldsa44`\*, `mldsa65`\*, `p384_mldsa65`\*, `mldsa87`\*, `p521_mldsa87`\*
- **ML-DSA**:`mldsa44`\*, `p256_mldsa44`\*, `rsa3072_mldsa44`\*, `mldsa44_pss2048`\*, `mldsa44_rsa2048`\*, `mldsa44_ed25519`\*, `mldsa44_p256`\*, `mldsa44_bp256`\*, `mldsa65`\*, `p384_mldsa65`\*, `mldsa65_pss3072`\*, `mldsa65_rsa3072`\*, `mldsa65_p256`\*, `mldsa65_bp256`\*, `mldsa65_ed25519`\*, `mldsa87`\*, `p521_mldsa87`\*, `mldsa87_p384`\*, `mldsa87_bp384`\*, `mldsa87_ed448`\*
- **Falcon**:`falcon512`\*, `p256_falcon512`\*, `rsa3072_falcon512`\*, `falconpadded512`\*, `p256_falconpadded512`\*, `rsa3072_falconpadded512`\*, `falcon1024`\*, `p521_falcon1024`\*, `falconpadded1024`\*, `p521_falconpadded1024`\*

- **SPHINCS-SHA2**:`sphincssha2128fsimple`\*, `p256_sphincssha2128fsimple`\*, `rsa3072_sphincssha2128fsimple`\*, `sphincssha2128ssimple`\*, `p256_sphincssha2128ssimple`\*, `rsa3072_sphincssha2128ssimple`\*, `sphincssha2192fsimple`\*, `p384_sphincssha2192fsimple`\*, `sphincssha2192ssimple`, `p384_sphincssha2192ssimple`, `sphincssha2256fsimple`, `p521_sphincssha2256fsimple`, `sphincssha2256ssimple`, `p521_sphincssha2256ssimple`
Expand All @@ -66,8 +66,11 @@ TLS operations. This designation [can be changed by modifying the

In order to support parallel use of classic and quantum-safe cryptography
this provider also provides different hybrid algorithms, combining classic
and quantum-safe methods: These are listed above with a prefix denoting a
classic algorithm, e.g., for elliptic curve: "p256_".
and quantum-safe methods.
There are two types of combinations:
The Hybrids are listed above with a prefix denoting a classic algorithm, e.g., for elliptic curve: "p256_".
The [Composite](https://datatracker.ietf.org/doc/draft-ounsworth-pq-composite-sigs/) are listed above with a suffix denoting a
classic algorithm, e.g., for elliptic curve: "_p256".

A full list of algorithms, their interoperability code points and OIDs as well
as a method to dynamically adapt them, e.g., for interoperability testing are
Expand Down Expand Up @@ -186,6 +189,7 @@ Contributors to the `oqsprovider` include:
- Alex Zaslavsky
- Will Childs-Klein
- Thomas Bailleux
- Felipe Ventura

History
-------
Expand Down
3 changes: 3 additions & 0 deletions oqs-template/ALGORITHMS.md/oids.fragment
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
{%- for classical_alg in variant['mix_with'] %}
| {{ classical_alg['name'] }}_{{variant['name']}} | {{ classical_alg['oid'] }} | {%- if variant['enable'] -%} Yes {%- else -%} No {%- endif -%} | OQS_OID_{{ classical_alg['name']|upper }}_{{ variant['name']|upper }}
{%- endfor %}
{%- for composite_alg in variant['composite'] %}
| {{variant['name']}}_{{ composite_alg['name'] }} | {{ composite_alg['oid'] }} | {%- if variant['enable'] -%} Yes {%- else -%} No {%- endif -%} | OQS_OID_{{ variant['name']|upper }}_{{ composite_alg['name'] }}
{%- endfor %}
{%- endfor %}
{%- endfor %}

Expand Down
1 change: 1 addition & 0 deletions oqs-template/README.md/algs.fragment
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
`{{ variant['name'] }}`
{%- if variant['enable'] -%} \* {%- endif -%}
{%- for classical_alg in variant['mix_with'] -%} , `{{ classical_alg['name']}}_{{ variant['name'] }}`{%- if variant['enable'] -%} \* {%- endif -%}{%- endfor -%}
{%- for composite_alg in variant['composite'] -%} , `{{ variant['name'] }}_{{ composite_alg['name']}}`{%- if variant['enable'] -%} \* {%- endif -%}{%- endfor -%}
{%- if not loop.last %}, {% endif -%}
{%- endfor -%}
{%- endif -%}
Expand Down
70 changes: 70 additions & 0 deletions oqs-template/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,23 @@ sigs:
# 'pretty_name': 'RSA3072',
# 'oid': '1.3.9999.1.3',
# 'code_point': '0xfe02'}]
# composite:[{'name': 'p256',
# 'pretty_name': 'ECDSA p256',
# 'security': '128',
# 'oid': '2.16.840.1.114027.80.1.8'}]
-
# The Composite OIDs are kept up to date by @feventura (Entrust)
# These are prototype OIDs and are in line with draft-ounsworth-pq-composite-sigs-13
# OID scheme for composite variants:
# joint-iso-itu-t (2)
# country (16)
# us (840)
# organization (1)
# entrust (114027)
# algorithm (80)
# composite (8)
# signature (1)
# -
# OID scheme for hybrid variants of Dilithium:
# iso (1)
# identified-organization (3)
Expand All @@ -439,6 +455,8 @@ sigs:
# IBM (2)
# qsc (267)
# Dilithium-r3 (7)


family: 'CRYSTALS-Dilithium'
variants:
-
Expand Down Expand Up @@ -548,6 +566,26 @@ sigs:
'pretty_name': 'RSA3072',
'oid': '1.3.9999.7.2',
'code_point': '0xfed4'}]
composite: [{'name': 'pss2048',
'pretty_name': 'RSA PSS 2048',
'security': '112',
'oid': '2.16.840.1.114027.80.8.1.1'},
{'name': 'rsa2048',
'pretty_name': 'RSA2028',
'security': '112',
'oid': '2.16.840.1.114027.80.8.1.2'},
{'name': 'ed25519',
'pretty_name': 'ED25519',
'security': '128',
'oid': '2.16.840.1.114027.80.8.1.3'},
{'name': 'p256',
'pretty_name': 'ECDSA p256',
'security': '128',
'oid': '2.16.840.1.114027.80.8.1.4'},
{'name': 'bp256',
'pretty_name': 'ECDSA brainpoolP256r1',
'security': '256',
'oid': '2.16.840.1.114027.80.8.1.5'}]
-
name: 'mldsa65'
pretty_name: 'ML-DSA-65'
Expand All @@ -559,6 +597,26 @@ sigs:
'pretty_name': 'ECDSA p384',
'oid': '1.3.9999.7.3',
'code_point': '0xfed5'}]
composite: [{'name': 'pss3072',
'pretty_name': 'RSA PSS 3072',
'security': '128',
'oid': '2.16.840.1.114027.80.8.1.6'},
{'name': 'rsa3072',
'pretty_name': 'RSA 3072',
'security': '128',
'oid': '2.16.840.1.114027.80.8.1.7'},
{'name': 'p256',
'pretty_name': 'ECDSA p256',
'security': '128',
'oid': '2.16.840.1.114027.80.8.1.8'},
{'name': 'bp256',
'pretty_name': 'ECDSA brainpoolP256r1',
'security': '256',
'oid': '2.16.840.1.114027.80.8.1.9'},
{'name': 'ed25519',
'pretty_name': 'ED25519',
'security': '128',
'oid': '2.16.840.1.114027.80.8.1.10'}]
-
name: 'mldsa87'
pretty_name: 'ML-DSA-87'
Expand All @@ -570,6 +628,18 @@ sigs:
'pretty_name': 'ECDSA p521',
'oid': '1.3.9999.7.4',
'code_point': '0xfed6'}]
composite: [{'name': 'p384',
'pretty_name': 'ECDSA p384',
'security': '192',
'oid': '2.16.840.1.114027.80.8.1.11'},
{'name': 'bp384',
'pretty_name': 'ECDSA brainpoolP384r1',
'security': '384',
'oid': '2.16.840.1.114027.80.8.1.12'},
{'name': 'ed448',
'pretty_name': 'ED448',
'security': '192',
'oid': '2.16.840.1.114027.80.8.1.13'}]
-
# iso (1)
# identified-organization (3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ MAKE_DECODER(, "{{ variant['name'] }}", {{ variant['name'] }}, oqsx, SubjectPubl
MAKE_DECODER(, "{{ classical_alg['name'] }}_{{ variant['name'] }}", {{ classical_alg['name'] }}_{{ variant['name'] }}, oqsx, PrivateKeyInfo);
MAKE_DECODER(, "{{ classical_alg['name'] }}_{{ variant['name'] }}", {{ classical_alg['name'] }}_{{ variant['name'] }}, oqsx, SubjectPublicKeyInfo);
{%- endfor -%}
{%- for composite_alg in variant['composite'] %}
MAKE_DECODER(, "{{ variant['name'] }}_{{ composite_alg['name'] }}", {{ variant['name'] }}_{{ composite_alg['name'] }}, oqsx, PrivateKeyInfo);
MAKE_DECODER(, "{{ variant['name'] }}_{{ composite_alg['name'] }}", {{ variant['name'] }}_{{ composite_alg['name'] }}, oqsx, SubjectPublicKeyInfo);
{%- endfor -%}
{%- endfor %}
{%- endfor %}

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
# define {{ classical_alg['name'] }}_{{ variant['name'] }}_input_type "{{ classical_alg['name'] }}_{{ variant['name'] }}"
# define {{ classical_alg['name'] }}_{{ variant['name'] }}_pem_type "{{ classical_alg['name'] }}_{{ variant['name'] }}"
{%- endfor -%}
{%- for composite_alg in variant['composite'] %}
# define {{ variant['name'] }}_{{ composite_alg['name'] }}_evp_type 0
# define {{ variant['name'] }}_{{ composite_alg['name'] }}_input_type "{{ variant['name'] }}_{{ composite_alg['name'] }}"
# define {{ variant['name'] }}_{{ composite_alg['name'] }}_pem_type "{{ variant['name'] }}_{{ composite_alg['name'] }}"
{%- endfor -%}
{%- endfor %}
{%- endfor %}

Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ MAKE_ENCODER(, {{ classical_alg['name'] }}_{{ variant['name'] }}, oqsx, SubjectP
MAKE_ENCODER(, {{ classical_alg['name'] }}_{{ variant['name'] }}, oqsx, SubjectPublicKeyInfo, pem);
MAKE_TEXT_ENCODER(, {{ classical_alg['name'] }}_{{ variant['name'] }});
{%- endfor -%}
{%- for composite_alg in variant['composite'] %}
MAKE_ENCODER(, {{ variant['name'] }}_{{ composite_alg['name'] }}, oqsx, EncryptedPrivateKeyInfo, der);
MAKE_ENCODER(, {{ variant['name'] }}_{{ composite_alg['name'] }}, oqsx, EncryptedPrivateKeyInfo, pem);
MAKE_ENCODER(, {{ variant['name'] }}_{{ composite_alg['name'] }}, oqsx, PrivateKeyInfo, der);
MAKE_ENCODER(, {{ variant['name'] }}_{{ composite_alg['name'] }}, oqsx, PrivateKeyInfo, pem);
MAKE_ENCODER(, {{ variant['name'] }}_{{ composite_alg['name'] }}, oqsx, SubjectPublicKeyInfo, der);
MAKE_ENCODER(, {{ variant['name'] }}_{{ composite_alg['name'] }}, oqsx, SubjectPublicKeyInfo, pem);
MAKE_TEXT_ENCODER(, {{ variant['name'] }}_{{ composite_alg['name'] }});
{%- endfor -%}
{%- endfor %}
{%- endfor %}

13 changes: 13 additions & 0 deletions oqs-template/oqsprov/oqs_kmgmt.c/keymgmt_constructors.fragment
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ static void *{{ classical_alg['name'] }}_{{variant['name']}}_gen_init(void *prov
return oqsx_gen_init(provctx, selection, {{variant['oqs_meth']}}, "{{ classical_alg['name'] }}_{{variant['name']}}", KEY_TYPE_HYB_SIG, {{variant['security']}}, {{ count.val }});
}

{%- endfor -%}
{%- for composite_alg in variant['composite'] %}
{%- set count.val = count.val + 1 %}
static void *{{ variant['name'] }}_{{ composite_alg['name'] }}_new_key(void *provctx)
{
return oqsx_key_new(PROV_OQS_LIBCTX_OF(provctx), {{variant['oqs_meth']}}, "{{ variant['name'] }}_{{ composite_alg['name'] }}", KEY_TYPE_CMP_SIG, NULL, {{composite_alg['security']}}, {{ count.val }});
}

static void *{{ variant['name'] }}_{{ composite_alg['name'] }}_gen_init(void *provctx, int selection)
{
return oqsx_gen_init(provctx, selection, {{variant['oqs_meth']}}, "{{ variant['name'] }}_{{ composite_alg['name'] }}", KEY_TYPE_CMP_SIG, {{composite_alg['security']}}, {{ count.val }});
}

{%- endfor -%}
{%- endfor %}
{% endfor %}
Expand Down
3 changes: 3 additions & 0 deletions oqs-template/oqsprov/oqs_kmgmt.c/keymgmt_functions.fragment
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ MAKE_SIG_KEYMGMT_FUNCTIONS({{variant['name']}})
{%- for classical_alg in variant['mix_with'] %}
MAKE_SIG_KEYMGMT_FUNCTIONS({{ classical_alg['name'] }}_{{variant['name']}})
{%- endfor -%}
{%- for composite_alg in variant['composite'] %}
MAKE_SIG_KEYMGMT_FUNCTIONS({{variant['name']}}_{{ composite_alg['name'] }})
{%- endfor -%}
{%- endfor %}
{%- endfor %}
{% for kem in config['kems'] %}
Expand Down
3 changes: 3 additions & 0 deletions oqs-template/oqsprov/oqs_prov.h/alg_functions.fragment
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ extern const OSSL_DISPATCH oqs_{{ variant['name'] }}_keymgmt_functions[];
{%- for classical_alg in variant['mix_with'] -%}
extern const OSSL_DISPATCH oqs_{{ classical_alg['name'] }}_{{ variant['name'] }}_keymgmt_functions[];
{%- endfor -%}
{%- for composite_alg in variant['composite'] -%}
extern const OSSL_DISPATCH oqs_{{ variant['name'] }}_{{ composite_alg['name'] }}_keymgmt_functions[];
{%- endfor -%}
{%- endfor %}
{%- endfor %}
{% for kem in config['kems'] %}
Expand Down
11 changes: 11 additions & 0 deletions oqs-template/oqsprov/oqs_prov.h/endecoder_functions.fragment
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ extern const OSSL_DISPATCH oqs_{{ classical_alg['name'] }}_{{ variant['name'] }}
extern const OSSL_DISPATCH oqs_PrivateKeyInfo_der_to_{{ classical_alg['name'] }}_{{ variant['name'] }}_decoder_functions[];
extern const OSSL_DISPATCH oqs_SubjectPublicKeyInfo_der_to_{{ classical_alg['name'] }}_{{ variant['name'] }}_decoder_functions[];
{%- endfor -%}
{%- for composite_alg in variant['composite'] -%}
extern const OSSL_DISPATCH oqs_{{ variant['name'] }}_{{ composite_alg['name'] }}_to_PrivateKeyInfo_der_encoder_functions[];
extern const OSSL_DISPATCH oqs_{{ variant['name'] }}_{{ composite_alg['name'] }}_to_PrivateKeyInfo_pem_encoder_functions[];
extern const OSSL_DISPATCH oqs_{{ variant['name'] }}_{{ composite_alg['name'] }}_to_EncryptedPrivateKeyInfo_der_encoder_functions[];
extern const OSSL_DISPATCH oqs_{{ variant['name'] }}_{{ composite_alg['name'] }}_to_EncryptedPrivateKeyInfo_pem_encoder_functions[];
extern const OSSL_DISPATCH oqs_{{ variant['name'] }}_{{ composite_alg['name'] }}_to_SubjectPublicKeyInfo_der_encoder_functions[];
extern const OSSL_DISPATCH oqs_{{ variant['name'] }}_{{ composite_alg['name'] }}_to_SubjectPublicKeyInfo_pem_encoder_functions[];
extern const OSSL_DISPATCH oqs_{{ variant['name'] }}_{{ composite_alg['name'] }}_to_text_encoder_functions[];
extern const OSSL_DISPATCH oqs_PrivateKeyInfo_der_to_{{ variant['name'] }}_{{ composite_alg['name'] }}_decoder_functions[];
extern const OSSL_DISPATCH oqs_SubjectPublicKeyInfo_der_to_{{ variant['name'] }}_{{ composite_alg['name'] }}_decoder_functions[];
{%- endfor -%}
{%- endfor %}
{%- endfor %}

4 changes: 4 additions & 0 deletions oqs-template/oqsprov/oqsdecoders.inc/make.fragment
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ DECODER_w_structure("{{ variant['name'] }}", der, SubjectPublicKeyInfo, {{ varia
DECODER_w_structure("{{ classical_alg['name'] }}_{{ variant['name'] }}", der, PrivateKeyInfo, {{ classical_alg['name'] }}_{{ variant['name'] }}),
DECODER_w_structure("{{ classical_alg['name'] }}_{{ variant['name'] }}", der, SubjectPublicKeyInfo, {{ classical_alg['name'] }}_{{ variant['name'] }}),
{%- endfor %}
{%- for composite_alg in variant['composite'] -%}
DECODER_w_structure("{{ variant['name'] }}_{{ composite_alg['name'] }}", der, PrivateKeyInfo, {{ variant['name'] }}_{{ composite_alg['name'] }}),
DECODER_w_structure("{{ variant['name'] }}_{{ composite_alg['name'] }}", der, SubjectPublicKeyInfo, {{ variant['name'] }}_{{ composite_alg['name'] }}),
{%- endfor %}
#endif
{%- endfor %}
{%- endfor %}
Expand Down
9 changes: 9 additions & 0 deletions oqs-template/oqsprov/oqsencoders.inc/make.fragment
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ ENCODER_w_structure("{{ classical_alg['name'] }}_{{ variant['name'] }}", {{ clas
ENCODER_w_structure("{{ classical_alg['name'] }}_{{ variant['name'] }}", {{ classical_alg['name'] }}_{{ variant['name'] }}, pem, SubjectPublicKeyInfo),
ENCODER_TEXT("{{ classical_alg['name'] }}_{{ variant['name'] }}", {{ classical_alg['name'] }}_{{ variant['name'] }}),
{% endfor -%}
{% for composite_alg in variant['composite'] -%}
ENCODER_w_structure("{{ variant['name'] }}_{{ composite_alg['name'] }}", {{ variant['name'] }}_{{ composite_alg['name'] }}, der, PrivateKeyInfo),
ENCODER_w_structure("{{ variant['name'] }}_{{ composite_alg['name'] }}", {{ variant['name'] }}_{{ composite_alg['name'] }}, pem, PrivateKeyInfo),
ENCODER_w_structure("{{ variant['name'] }}_{{ composite_alg['name'] }}", {{ variant['name'] }}_{{ composite_alg['name'] }}, der, EncryptedPrivateKeyInfo),
ENCODER_w_structure("{{ variant['name'] }}_{{ composite_alg['name'] }}", {{ variant['name'] }}_{{ composite_alg['name'] }}, pem, EncryptedPrivateKeyInfo),
ENCODER_w_structure("{{ variant['name'] }}_{{ composite_alg['name'] }}", {{ variant['name'] }}_{{ composite_alg['name'] }}, der, SubjectPublicKeyInfo),
ENCODER_w_structure("{{ variant['name'] }}_{{ composite_alg['name'] }}", {{ variant['name'] }}_{{ composite_alg['name'] }}, pem, SubjectPublicKeyInfo),
ENCODER_TEXT("{{ variant['name'] }}_{{ composite_alg['name'] }}", {{ variant['name'] }}_{{ composite_alg['name'] }}),
{% endfor -%}
#endif
{%- endfor %}
{%- endfor %}
Expand Down
6 changes: 6 additions & 0 deletions oqs-template/oqsprov/oqsprov.c/assign_sig_oids.fragment
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
{%- for variant in sig['variants'] %}
{%- set count.val = count.val + 1 -%}
{%- for classical_alg in variant['mix_with'] %}
{%- set count.val = count.val + 1 -%}
{%- endfor %}
{%- for composite_alg in variant['composite'] %}
{%- set count.val = count.val + 1 -%}
{%- endfor %}
{%- endfor %}
Expand Down Expand Up @@ -40,6 +43,9 @@ const char* oqs_oid_alg_list[OQS_OID_CNT] =
{%- for classical_alg in variant['mix_with'] %}
"{{ classical_alg['oid'] }}" , "{{ classical_alg['name'] }}_{{ variant['name'] }}",
{%- endfor %}
{%- for composite_alg in variant['composite'] %}
"{{ composite_alg['oid'] }}" , "{{ variant['name'] }}_{{ composite_alg['name'] }}",
{%- endfor %}
{%- endfor %}
{%- endfor %}

5 changes: 5 additions & 0 deletions oqs-template/oqsprov/oqsprov.c/encoding_patching.fragment
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
if (getenv("OQS_ENCODING_{{ classical_alg['name']|upper }}_{{variant['name']|upper}}")) oqs_alg_encoding_list[{{ cnt.val }}] = getenv("OQS_ENCODING_{{ classical_alg['name']|upper }}_{{variant['name']|upper}}");
if (getenv("OQS_ENCODING_{{ classical_alg['name']|upper }}_{{variant['name']|upper}}_ALGNAME")) oqs_alg_encoding_list[{{ cnt.val + 1 }}] = getenv("OQS_ENCODING_{{ classical_alg['name']|upper }}_{{variant['name']|upper}}_ALGNAME");
{%- endfor %}
{%- for composite_alg in variant['composite'] %}
{%- set cnt.val = cnt.val + 2 %}
if (getenv("OQS_ENCODING_{{variant['name']|upper}}_{{ composite_alg['name']|upper }}")) oqs_alg_encoding_list[{{ cnt.val }}] = getenv("OQS_ENCODING_{{variant['name']|upper}}_{{ composite_alg['name']|upper }}");
if (getenv("OQS_ENCODING_{{variant['name']|upper}}_{{ composite_alg['name']|upper }}_ALGNAME")) oqs_alg_encoding_list[{{ cnt.val + 1 }}] = getenv("OQS_ENCODING_{{variant['name']|upper}}_{{ composite_alg['name']|upper }}_ALGNAME");
{%- endfor %}
{%- endfor %}
{%- endfor %}

Loading

0 comments on commit 9dc9824

Please sign in to comment.