add IND-CPA/IND-CCA2 security field to METADATA. add test for it as well

This commit is contained in:
Matthias J. Kannwischer 2019-05-13 13:17:41 +02:00
parent ba04db65d7
commit 1597e62514
15 changed files with 19 additions and 0 deletions

View File

@ -25,6 +25,7 @@ See the section [API](#API) below.
name: Name name: Name
type: <kem|signature> type: <kem|signature>
claimed-nist-level: <N> claimed-nist-level: <N>
claimed-security: IND-CPA/IND-CCA2 # KEM only
length-public-key: <N> # KEM and signature length-public-key: <N> # KEM and signature
length-secret-key: <N> # KEM and signature length-secret-key: <N> # KEM and signature
length-ciphertext: <N> # KEM only length-ciphertext: <N> # KEM only

View File

@ -1,6 +1,7 @@
name: FrodoKEM-1344-AES name: FrodoKEM-1344-AES
type: kem type: kem
claimed-nist-level: 5 claimed-nist-level: 5
claimed-security: IND-CCA2
length-public-key: 21520 length-public-key: 21520
length-secret-key: 43088 length-secret-key: 43088
length-ciphertext: 21632 length-ciphertext: 21632

View File

@ -1,6 +1,7 @@
name: FrodoKEM-1344-SHAKE name: FrodoKEM-1344-SHAKE
type: kem type: kem
claimed-nist-level: 5 claimed-nist-level: 5
claimed-security: IND-CCA2
length-public-key: 21520 length-public-key: 21520
length-secret-key: 43088 length-secret-key: 43088
length-ciphertext: 21632 length-ciphertext: 21632

View File

@ -1,6 +1,7 @@
name: FrodoKEM-640-AES name: FrodoKEM-640-AES
type: kem type: kem
claimed-nist-level: 1 claimed-nist-level: 1
claimed-security: IND-CCA2
length-public-key: 9616 length-public-key: 9616
length-secret-key: 19888 length-secret-key: 19888
length-ciphertext: 9720 length-ciphertext: 9720

View File

@ -1,6 +1,7 @@
name: FrodoKEM-640-SHAKE name: FrodoKEM-640-SHAKE
type: kem type: kem
claimed-nist-level: 1 claimed-nist-level: 1
claimed-security: IND-CCA2
length-public-key: 9616 length-public-key: 9616
length-secret-key: 19888 length-secret-key: 19888
length-ciphertext: 9720 length-ciphertext: 9720

View File

@ -1,6 +1,7 @@
name: FrodoKEM-976-AES name: FrodoKEM-976-AES
type: kem type: kem
claimed-nist-level: 3 claimed-nist-level: 3
claimed-security: IND-CCA2
length-public-key: 15632 length-public-key: 15632
length-secret-key: 31296 length-secret-key: 31296
length-ciphertext: 15744 length-ciphertext: 15744

View File

@ -1,6 +1,7 @@
name: FrodoKEM-976-SHAKE name: FrodoKEM-976-SHAKE
type: kem type: kem
claimed-nist-level: 3 claimed-nist-level: 3
claimed-security: IND-CCA2
length-public-key: 15632 length-public-key: 15632
length-secret-key: 31296 length-secret-key: 31296
length-ciphertext: 15744 length-ciphertext: 15744

View File

@ -1,6 +1,7 @@
name: Kyber1024 name: Kyber1024
type: kem type: kem
claimed-nist-level: 5 claimed-nist-level: 5
claimed-security: IND-CCA2
length-public-key: 1568 length-public-key: 1568
length-ciphertext: 1568 length-ciphertext: 1568
length-secret-key: 3168 length-secret-key: 3168

View File

@ -1,6 +1,7 @@
name: Kyber512 name: Kyber512
type: kem type: kem
claimed-nist-level: 1 claimed-nist-level: 1
claimed-security: IND-CCA2
length-public-key: 800 length-public-key: 800
length-ciphertext: 736 length-ciphertext: 736
length-secret-key: 1632 length-secret-key: 1632

View File

@ -1,6 +1,7 @@
name: Kyber768 name: Kyber768
type: kem type: kem
claimed-nist-level: 3 claimed-nist-level: 3
claimed-security: IND-CCA2
length-public-key: 1184 length-public-key: 1184
length-ciphertext: 1088 length-ciphertext: 1088
length-secret-key: 2400 length-secret-key: 2400

View File

@ -1,6 +1,7 @@
name: ntru-hps2048509 name: ntru-hps2048509
type: kem type: kem
claimed-nist-level: 1 claimed-nist-level: 1
claimed-security: IND-CCA2
length-public-key: 699 length-public-key: 699
length-secret-key: 935 length-secret-key: 935
length-ciphertext: 699 length-ciphertext: 699

View File

@ -1,6 +1,7 @@
name: ntru-hps2048677 name: ntru-hps2048677
type: kem type: kem
claimed-nist-level: 3 claimed-nist-level: 3
claimed-security: IND-CCA2
length-public-key: 930 length-public-key: 930
length-secret-key: 1234 length-secret-key: 1234
length-ciphertext: 930 length-ciphertext: 930

View File

@ -1,6 +1,7 @@
name: ntru-hps4096821 name: ntru-hps4096821
type: kem type: kem
claimed-nist-level: 5 claimed-nist-level: 5
claimed-security: IND-CCA2
length-public-key: 1230 length-public-key: 1230
length-secret-key: 1590 length-secret-key: 1590
length-ciphertext: 1230 length-ciphertext: 1230

View File

@ -1,6 +1,7 @@
name: ntru-hrss701 name: ntru-hrss701
type: kem type: kem
claimed-nist-level: 3 claimed-nist-level: 3
claimed-security: IND-CCA2
length-public-key: 1138 length-public-key: 1138
length-secret-key: 1450 length-secret-key: 1450
length-ciphertext: 1138 length-ciphertext: 1138

View File

@ -62,6 +62,7 @@ EXPECTED_FIELDS = {
} }
KEM_FIELDS = { KEM_FIELDS = {
'claimed-security' : {'type' : str, 'values' : ['IND-CPA', 'IND-CCA2'] },
'length-ciphertext': {'type': int, 'min': 1}, 'length-ciphertext': {'type': int, 'min': 1},
'length-shared-secret': {'type': int, 'min': 1}, 'length-shared-secret': {'type': int, 'min': 1},
'nistkat-sha256': {'type': str, 'length': 64}, 'nistkat-sha256': {'type': str, 'length': 64},
@ -123,6 +124,10 @@ def check_element(field, element, props):
raise ValueError("Value of field '{}' should be length {}" raise ValueError("Value of field '{}' should be length {}"
" but was length {}" " but was length {}"
.format(field, props['length'], actual_len)) .format(field, props['length'], actual_len))
if 'values' in props and element not in props['values']:
raise ValueError("'{}' should be in {}"
.format(element, props['values']))
if type_ == list: # recursively check the elements if type_ == list: # recursively check the elements
for el in element: for el in element: