Inconsistent aliases for K-163 #4

Closed
opened 2025-07-08 08:33:53 -04:00 by AtHeartEngineer · 0 comments

Originally created by @CRTified on 1/1/2024

Hi, I've noticed some inconsistencies with the aliases assigned.

A simple sanity check revealed that something is wrong:

❯ find -mindepth 2 -name "*.json" -exec jq '.curves[] | {name: .name, aliases: .aliases} | select(.aliases != null)' {} \; | jq -s '.[] | .aliases | length' | sort | uniq -c
     27 1
     36 2
     14 3

This counts the number of occurrences of alias-lists with 1, 2 and 3 entries (which means 2 names, 3 names or 4 names for a curve).

  • If there is a curve with two names, it should appear in pairs, but there are 27 entries with one alias.

Take for example K-163. It is also known as only sect163k1. The sect163k1 however is also known as ansit163k1 and wap-wsg-idm-ecid-wtls3](https://neuromancer.sk/std/wtls/wap-wsg-idm-ecid-wtls3).

However, ansit163k1 has no aliases defined at all!

This should be fixable with the following patch, I'll open a PR, just sitting in a train right now so it might take a moment.

diff --git a/nist/curves.json b/nist/curves.json
index 22e09fd..8ed8713 100644
--- a/nist/curves.json
+++ b/nist/curves.json
@@ -342,7 +342,9 @@
       "order": "0x04000000000000000000020108a2e0cc0d99f8a5ef",
       "cofactor": "0x2",
       "aliases": [
-        "secg/sect163k1"
+        "secg/sect163k1",
+        "x963/ansit163k1",
+        "wtls/wap-wsg-idm-ecid-wtls3"
       ],
       "characteristics": {
         "discriminant": "1",
diff --git a/x963/curves.json b/x963/curves.json
index 3a778ed..921694a 100644
--- a/x963/curves.json
+++ b/x963/curves.json
@@ -46,6 +46,11 @@
       },
       "order": "0x04000000000000000000020108a2e0cc0d99f8a5ef",
       "cofactor": "0x2",
+      "aliases": [
+        "secg/sect163k1",
+        "nist/k-163",
+        "wtls/wap-wsg-idm-ecid-wtls3"
+      ],
       "generator": {
         "x": {
           "raw": "0x02fe13c0537bbc11acaa07d793de4e6d5e5c94eee8"

At least with this patch, the sanity check is true:

❯ find -mindepth 2 -name "*.json" -exec jq '.curves[] | {name: .name, aliases: .aliases} | select(.aliases != null)' {} \; | jq -s '.[] | .aliases | length' | sort | uniq -c
     26 1
     36 2
     16 3

26 is a multiple of 2, 36 a multiple of 3 and 16 a multiple of 4.

*Originally created by @CRTified on 1/1/2024* Hi, I've noticed some inconsistencies with the aliases assigned. A simple sanity check revealed that *something* is wrong: ``` ❯ find -mindepth 2 -name "*.json" -exec jq '.curves[] | {name: .name, aliases: .aliases} | select(.aliases != null)' {} \; | jq -s '.[] | .aliases | length' | sort | uniq -c 27 1 36 2 14 3 ``` This counts the number of occurrences of alias-lists with 1, 2 and 3 entries (which means 2 names, 3 names or 4 names for a curve). - If there is a curve with two names, it should appear in pairs, but there are 27 entries with one alias. Take for example [K-163](https://neuromancer.sk/std/nist/K-163). It is also known as only [sect163k1](https://neuromancer.sk/std/secg/sect163k1). The [sect163k1](https://neuromancer.sk/std/secg/sect163k1) however is also known as [ansit163k1](https://neuromancer.sk/std/x963/ansit163k1) and wap-wsg-idm-ecid-wtls3](https://neuromancer.sk/std/wtls/wap-wsg-idm-ecid-wtls3). However, ansit163k1 has no aliases defined at all! This should be fixable with the following patch, I'll open a PR, just sitting in a train right now so it might take a moment. ```patch diff --git a/nist/curves.json b/nist/curves.json index 22e09fd..8ed8713 100644 --- a/nist/curves.json +++ b/nist/curves.json @@ -342,7 +342,9 @@ "order": "0x04000000000000000000020108a2e0cc0d99f8a5ef", "cofactor": "0x2", "aliases": [ - "secg/sect163k1" + "secg/sect163k1", + "x963/ansit163k1", + "wtls/wap-wsg-idm-ecid-wtls3" ], "characteristics": { "discriminant": "1", diff --git a/x963/curves.json b/x963/curves.json index 3a778ed..921694a 100644 --- a/x963/curves.json +++ b/x963/curves.json @@ -46,6 +46,11 @@ }, "order": "0x04000000000000000000020108a2e0cc0d99f8a5ef", "cofactor": "0x2", + "aliases": [ + "secg/sect163k1", + "nist/k-163", + "wtls/wap-wsg-idm-ecid-wtls3" + ], "generator": { "x": { "raw": "0x02fe13c0537bbc11acaa07d793de4e6d5e5c94eee8" ``` At least with this patch, the sanity check is true: ``` ❯ find -mindepth 2 -name "*.json" -exec jq '.curves[] | {name: .name, aliases: .aliases} | select(.aliases != null)' {} \; | jq -s '.[] | .aliases | length' | sort | uniq -c 26 1 36 2 16 3 ``` 26 is a multiple of 2, 36 a multiple of 3 and 16 a multiple of 4.
Sign in to join this conversation.