Skip to content

Commit 3eca538

Browse files
dstebilamaxgoedjen
andauthored
Add dashes to ssh-mldsa-* algorithms (#180) (#183)
* Add dashes to ssh-mldsa-* algorithms * Fix a few more * Just a few more * Revert "Just a few more" This reverts commit 58c23ab. * Update templates and regen. --------- Signed-off-by: Max Goedjen <[email protected]> Co-authored-by: Max Goedjen <[email protected]>
1 parent 2e9dbab commit 3eca538

File tree

14 files changed

+69
-64
lines changed

14 files changed

+69
-64
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ The following quantum-safe algorithms from liboqs are supported (assuming they h
6666
- **FrodoKEM**: `frodokem-640-aes-sha256`\*, `frodokem-976-aes-sha384`\*, `frodokem-1344-aes-sha512`\*, `frodokem-640-shake-sha256`\*, `frodokem-976-shake-sha384`\*, `frodokem-1344-shake-sha512`\*
6767
- **HQC**: `hqc-128-sha256`, `hqc-192-sha384`, `hqc-256-sha512`
6868
- **Kyber**: `kyber-512-sha256`\*, `kyber-768-sha384`\*, `kyber-1024-sha512`\*
69-
- **ML-KEM**: `mlkem512-sha256`\*, `mlkem768-sha256`\*, `mlkem1024-sha384`\*
69+
- **ML-KEM**: `ml-kem-512-sha256`\*, `ml-kem-768-sha256`\*, `ml-kem-1024-sha384`\*
7070
- **NTRU-Prime**: `ntruprime-sntrup761-sha512`\*
7171
<!--- OQS_TEMPLATE_FRAGMENT_LIST_ALL_KEXS_END -->
7272

oqs-template/generate.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ sigs:
537537
-
538538
family: 'ML-DSA'
539539
name: 'ml_dsa_44'
540+
pretty_name: 'mldsa-44'
540541
enable: true
541542
level: 1
542543
mix_with:
@@ -549,6 +550,7 @@ sigs:
549550
-
550551
family: 'ML-DSA'
551552
name: 'ml_dsa_65'
553+
pretty_name: 'mldsa-65'
552554
enable: true
553555
level: 3
554556
mix_with:
@@ -558,6 +560,7 @@ sigs:
558560
-
559561
family: 'ML-DSA'
560562
name: 'ml_dsa_87'
563+
pretty_name: 'mldsa-87'
561564
enable: true
562565
level: 5
563566
mix_with:
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{%- for sig in config['sigs'] %}
2-
"ssh-{{ sig['name']|replace('_','') }}",
2+
"ssh-{{ sig.get('pretty_name', sig['name']|replace('_','')) }}",
33
{%- for alg in sig['mix_with'] %}
4-
"ssh-{{ alg['name']|replace('_','-') }}-{{ sig['name']|replace('_','') }}",
4+
"ssh-{{ alg['name']|replace('_','-') }}-{{ sig.get('pretty_name', sig['name']|replace('_','')) }}",
55
{%- endfor -%}
66
{%- endfor %}
77

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{%- for sig in config['sigs'] %}
2-
*{{ sig['name']|replace('_','') }}*) test -z "$oldfmt" || continue ;;
2+
*{{ sig.get('pretty_name', sig['name']|replace('_','')) }}*) test -z "$oldfmt" || continue ;;
33
{%- endfor %}
44

oqs-template/ssh-keygen.c/define_key_types.fragment

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{%- for sig in config['sigs'] %}
2-
{ "{{ sig['name']|replace('_','') }}", "{{ sig['name']|upper }}", _PATH_HOST_{{ sig['name']|upper }}_KEY_FILE },
2+
{ "{{ sig.get('pretty_name', sig['name']|replace('_','')) }}", "{{ sig['name']|upper }}", _PATH_HOST_{{ sig['name']|upper }}_KEY_FILE },
33
{%- endfor %}
44
#ifdef WITH_OPENSSL
55
{%- for sig in config['sigs'] %}
66
{%- for alg in sig['mix_with'] if alg['rsa'] %}
7-
{ "{{ alg['name'] }}_{{ sig['name']|replace('_','') }}", "{{ alg['name']|upper }}_{{ sig['name']|upper }}", _PATH_HOST_{{ alg['name']|upper }}_{{ sig['name']|upper }}_KEY_FILE },
7+
{ "{{ alg['name'] }}_{{ sig.get('pretty_name', sig['name']|replace('_','')) }}", "{{ alg['name']|upper }}_{{ sig['name']|upper }}", _PATH_HOST_{{ alg['name']|upper }}_{{ sig['name']|upper }}_KEY_FILE },
88
{%- endfor %}
99
{%- endfor %}
1010
#ifdef OPENSSL_HAS_ECC
1111
{%- for sig in config['sigs'] %}
1212
{%- for alg in sig['mix_with'] if not alg['rsa'] %}
13-
{ "{{ alg['name'] }}_{{ sig['name']|replace('_','') }}", "{{ alg['name']|upper }}_{{ sig['name']|upper }}", _PATH_HOST_{{ alg['name']|upper }}_{{ sig['name']|upper }}_KEY_FILE },
13+
{ "{{ alg['name'] }}_{{ sig.get('pretty_name', sig['name']|replace('_','')) }}", "{{ alg['name']|upper }}_{{ sig['name']|upper }}", _PATH_HOST_{{ alg['name']|upper }}_{{ sig['name']|upper }}_KEY_FILE },
1414
{%- endfor %}
1515
{%- endfor %}
1616
#endif /* OPENSSL_HAS_ECC */

oqs-template/ssh-keyscan.c/add_proposal_server_host_key_algs.fragment

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
{%- for sig in config['sigs'] %}
22
case KT_{{ sig['name']|upper }}:
3-
myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = "ssh-{{ sig['name']|replace('_','') }}";
3+
myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = "ssh-{{ sig.get('pretty_name', sig['name']|replace('_','')) }}";
44
break;
55
{%- endfor %}
66
#ifdef WITH_OPENSSL
77
{%- for sig in config['sigs'] %}
88
{%- for alg in sig['mix_with'] if alg['rsa'] %}
99
case KT_{{ alg['name']|upper }}_{{ sig['name']|upper }}:
10-
myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = "ssh-{{ alg['name'] }}-{{ sig['name']|replace('_','') }}";
10+
myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = "ssh-{{ alg['name'] }}-{{ sig.get('pretty_name', sig['name']|replace('_','')) }}";
1111
break;
1212
{%- endfor %}
1313
{%- endfor %}
1414
#ifdef OPENSSL_HAS_ECC
1515
{%- for sig in config['sigs'] %}
1616
{%- for alg in sig['mix_with'] if not alg['rsa'] %}
1717
case KT_{{ alg['name']|upper }}_{{ sig['name']|upper }}:
18-
myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = "ssh-{{ alg['name']|replace('_','-') }}-{{ sig['name']|replace('_','') }}";
18+
myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = "ssh-{{ alg['name']|replace('_','-') }}-{{ sig.get('pretty_name', sig['name']|replace('_','')) }}";
1919
break;
2020
{%- endfor %}
2121
{%- endfor %}

oqs-template/ssh-oqs.c/define_sig_functions.fragment

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{%- for sig in config['sigs'] %}
22
{%- set symbol_base_name = sig['name']|replace('_','') %}
3+
{%- set symbol_base_pretty_name = sig.get('pretty_name', sig['name']|replace('_','')) %}
34
/*---------------------------------------------------
45
* {{ sig['name']|upper }} METHODS
56
*---------------------------------------------------
@@ -29,7 +30,7 @@ int ssh_{{ symbol_base_name }}_sign(struct sshkey *key,
2930
if (sig == NULL) {
3031
return SSH_ERR_ALLOC_FAIL;
3132
}
32-
int r = oqs_sign(sig, "{{ symbol_base_name }}", key, sigp, lenp, data, datalen, compat);
33+
int r = oqs_sign(sig, "{{ symbol_base_pretty_name }}", key, sigp, lenp, data, datalen, compat);
3334
OQS_SIG_free(sig);
3435
return r;
3536
}
@@ -47,7 +48,7 @@ int ssh_{{ symbol_base_name }}_verify(const struct sshkey *key,
4748
if (sig == NULL) {
4849
return SSH_ERR_ALLOC_FAIL;
4950
}
50-
int r = oqs_verify(sig, "{{ symbol_base_name }}", key, signature, signaturelen, data, datalen, compat);
51+
int r = oqs_verify(sig, "{{ symbol_base_pretty_name }}", key, signature, signaturelen, data, datalen, compat);
5152
OQS_SIG_free(sig);
5253
return r;
5354
}
@@ -68,8 +69,8 @@ static const struct sshkey_impl_funcs sshkey_{{ symbol_base_name }}_funcs = {
6869
};
6970

7071
const struct sshkey_impl sshkey_{{ symbol_base_name }}_impl = {
71-
/* .name = */ "ssh-{{ symbol_base_name }}",
72-
/* .shortname = */ "{{ symbol_base_name|upper }}",
72+
/* .name = */ "ssh-{{ symbol_base_pretty_name }}",
73+
/* .shortname = */ "{{ symbol_base_pretty_name|upper }}",
7374
/* .sigalg = */ NULL,
7475
/* .type = */ KEY_{{ sig['name']|upper }},
7576
/* .nid = */ 0,
@@ -84,6 +85,7 @@ const struct sshkey_impl sshkey_{{ symbol_base_name }}_impl = {
8485
{%- for sig in config['sigs'] %}
8586
{%- for alg in sig['mix_with'] if alg['rsa'] %}
8687
{%- set symbol_base_name = alg['name']|replace('_','') + '_' + sig['name']|replace('_','') %}
88+
{%- set symbol_base_pretty_name = alg['name']|replace('_','') + '_' + sig.get('pretty_name', sig['name']|replace('_','')) %}
8789
static const struct sshkey_impl_funcs sshkey_{{ symbol_base_name }}_funcs = {
8890
/* .size = */ ssh_generic_size,
8991
/* .alloc = */ ssh_generic_alloc,
@@ -100,8 +102,8 @@ static const struct sshkey_impl_funcs sshkey_{{ symbol_base_name }}_funcs = {
100102
};
101103

102104
const struct sshkey_impl sshkey_{{ symbol_base_name }}_impl = {
103-
/* .name = */ "ssh-{{ alg['name']|replace('_','') + '-' + sig['name']|replace('_','') }}",
104-
/* .shortname = */ "{{ symbol_base_name|upper }}",
105+
/* .name = */ "ssh-{{ alg['name']|replace('_','') + '-' + sig.get('pretty_name', sig['name']|replace('_','')) }}",
106+
/* .shortname = */ "{{ symbol_base_pretty_name|upper }}",
105107
/* .sigalg = */ NULL,
106108
/* .type = */ KEY_{{ alg['name']|upper }}_{{ sig['name']|upper }},
107109
/* .nid = */ 0,
@@ -132,8 +134,8 @@ static const struct sshkey_impl_funcs sshkey_{{ symbol_base_name }}_funcs = {
132134
};
133135

134136
const struct sshkey_impl sshkey_{{ symbol_base_name }}_impl = {
135-
/* .name = */ "ssh-{{ alg['name']|replace('_','-') + '-' + sig['name']|replace('_','') }}",
136-
/* .shortname = */ "{{ alg['name']|upper + '_' + sig['name']|replace('_','')|upper }}",
137+
/* .name = */ "ssh-{{ alg['name']|replace('_','-') + '-' + sig.get('pretty_name', sig['name']|replace('_','')) }}",
138+
/* .shortname = */ "{{ alg['name']|upper + '_' + sig.get('pretty_name', sig['name']|replace('_',''))|upper }}",
137139
/* .sigalg = */ NULL,
138140
/* .type = */ KEY_{{ alg['name']|upper }}_{{ sig['name']|upper }},
139141
/* .nid = */ {{ alg['openssl_nid'] }},
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{%- for sig in config['sigs'] if sig['level'] == 1 %}
22
{%- set outer_loop_last = loop.last -%}
33
{%- for alg in sig['mix_with'] if alg['rsa'] %}
4-
strcmp(ident, "ssh-{{ alg['name'] }}-{{ sig['name']|replace('_','') }}") == 0 {%- if outer_loop_last and loop.last -%}){%- else %} || {%- endif -%}
4+
strcmp(ident, "ssh-{{ alg['name'] }}-{{ sig.get('pretty_name', sig['name']|replace('_','')) }}") == 0 {%- if outer_loop_last and loop.last -%}){%- else %} || {%- endif -%}
55
{%- endfor %}
66
{%- endfor %}
77

oqs-test/try_connection.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@
8888
"ssh-ecdsa-nistp256-sphincssha2128fsimple",
8989
"ssh-sphincssha2256fsimple",
9090
"ssh-ecdsa-nistp521-sphincssha2256fsimple",
91-
"ssh-mldsa44",
92-
"ssh-rsa3072-mldsa44",
93-
"ssh-ecdsa-nistp256-mldsa44",
94-
"ssh-mldsa65",
95-
"ssh-ecdsa-nistp384-mldsa65",
96-
"ssh-mldsa87",
97-
"ssh-ecdsa-nistp521-mldsa87",
91+
"ssh-mldsa-44",
92+
"ssh-rsa3072-mldsa-44",
93+
"ssh-ecdsa-nistp256-mldsa-44",
94+
"ssh-mldsa-65",
95+
"ssh-ecdsa-nistp384-mldsa-65",
96+
"ssh-mldsa-87",
97+
"ssh-ecdsa-nistp521-mldsa-87",
9898
"ssh-mayo2",
9999
"ssh-rsa3072-mayo2",
100100
"ssh-ecdsa-nistp256-mayo2",

regress/keygen-comment.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ for fmt in '' RFC4716 PKCS8 PEM; do
3535
*falcon1024*) test -z "$oldfmt" || continue ;;
3636
*sphincssha2128fsimple*) test -z "$oldfmt" || continue ;;
3737
*sphincssha2256fsimple*) test -z "$oldfmt" || continue ;;
38-
*mldsa44*) test -z "$oldfmt" || continue ;;
39-
*mldsa65*) test -z "$oldfmt" || continue ;;
40-
*mldsa87*) test -z "$oldfmt" || continue ;;
38+
*mldsa-44*) test -z "$oldfmt" || continue ;;
39+
*mldsa-65*) test -z "$oldfmt" || continue ;;
40+
*mldsa-87*) test -z "$oldfmt" || continue ;;
4141
*mayo2*) test -z "$oldfmt" || continue ;;
4242
*mayo3*) test -z "$oldfmt" || continue ;;
4343
*mayo5*) test -z "$oldfmt" || continue ;;

0 commit comments

Comments
 (0)