1
1
mirror of https://github.com/henrydcase/pqc.git synced 2024-11-26 09:21:28 +00:00

Move secret key length to implementation meta

This commit is contained in:
Joost Rijneveld 2019-04-08 11:28:28 +02:00
parent 6257e9ea48
commit fe010541ec
No known key found for this signature in database
GPG Key ID: A4FE39CF49CBC553
4 changed files with 6 additions and 4 deletions

View File

@ -2,7 +2,6 @@ name: FrodoKEM-640-SHAKE
type: kem type: kem
claimed-nist-level: 1 claimed-nist-level: 1
length-public-key: 9616 length-public-key: 9616
length-secret-key: 19888
length-ciphertext: 9720 length-ciphertext: 9720
length-shared-secret: 16 length-shared-secret: 16
testvectors-sha256: 8f922de02d41005fcc3c4164b2ab74c4c7b588ed69e34e22607d1ae4ab13d2c5 testvectors-sha256: 8f922de02d41005fcc3c4164b2ab74c4c7b588ed69e34e22607d1ae4ab13d2c5
@ -22,3 +21,4 @@ auxiliary-submitters:
implementations: implementations:
- name: clean - name: clean
version: https://github.com/Microsoft/PQCrypto-LWEKE/commit/437e228fca580a82435cab09f30ae14b03183119 version: https://github.com/Microsoft/PQCrypto-LWEKE/commit/437e228fca580a82435cab09f30ae14b03183119
length-secret-key: 19888

View File

@ -2,7 +2,6 @@ name: Kyber768
type: kem type: kem
claimed-nist-level: 3 claimed-nist-level: 3
length-public-key: 1088 length-public-key: 1088
length-secret-key: 2400
length-ciphertext: 1152 length-ciphertext: 1152
length-shared-secret: 32 length-shared-secret: 32
testvectors-sha256: 2f5cf9937959eb4a3bc910f71e830e9e0de029b28093c6192d2c3e915913016f testvectors-sha256: 2f5cf9937959eb4a3bc910f71e830e9e0de029b28093c6192d2c3e915913016f
@ -20,3 +19,4 @@ auxiliary-submitters:
implementations: implementations:
- name: clean - name: clean
version: https://github.com/pq-crystals/kyber/commit/ab996e7460e5356b0e23aa034e7c2fe6922e60e6 version: https://github.com/pq-crystals/kyber/commit/ab996e7460e5356b0e23aa034e7c2fe6922e60e6
length-secret-key: 2400

View File

@ -42,7 +42,6 @@ EXPECTED_FIELDS = {
'type': {'type': str}, 'type': {'type': str},
'claimed-nist-level': {'type': int, 'min': 1, 'max': 5}, 'claimed-nist-level': {'type': int, 'min': 1, 'max': 5},
'length-public-key': {'type': int, 'min': 1}, 'length-public-key': {'type': int, 'min': 1},
'length-secret-key': {'type': int, 'min': 1},
'testvectors-sha256': {'type': str, 'length': 64}, 'testvectors-sha256': {'type': str, 'length': 64},
'principal-submitter': {'type': str}, 'principal-submitter': {'type': str},
'auxiliary-submitters': {'type': list, 'elements': {'type': str}}, 'auxiliary-submitters': {'type': list, 'elements': {'type': str}},
@ -53,6 +52,7 @@ EXPECTED_FIELDS = {
'spec': { 'spec': {
'name': {'type': str}, 'name': {'type': str},
'version': {'type': str}, 'version': {'type': str},
'length-secret-key': {'type': int, 'min': 1},
}, },
}, },
}, },

View File

@ -13,6 +13,8 @@ def test_metadata_sizes():
def check_metadata_sizes(implementation): def check_metadata_sizes(implementation):
metadata = implementation.scheme.metadata() metadata = implementation.scheme.metadata()
impl_meta = next((impl for impl in metadata['implementations']
if impl['name'] == implementation.name), None)
helpers.make('printparams', helpers.make('printparams',
TYPE=implementation.scheme.type, TYPE=implementation.scheme.type,
SCHEME=implementation.scheme.name, SCHEME=implementation.scheme.name,
@ -30,7 +32,7 @@ def check_metadata_sizes(implementation):
parsed = json.loads(out) parsed = json.loads(out)
assert parsed['CRYPTO_SECRETKEYBYTES'] == metadata['length-secret-key'] assert parsed['CRYPTO_SECRETKEYBYTES'] == impl_meta['length-secret-key']
assert parsed['CRYPTO_PUBLICKEYBYTES'] == metadata['length-public-key'] assert parsed['CRYPTO_PUBLICKEYBYTES'] == metadata['length-public-key']
if implementation.scheme.type == 'kem': if implementation.scheme.type == 'kem':