Skip to content

Commit e69a50c

Browse files
authored
Remove support for NIST KAT RNG (#75)
1 parent 74680d8 commit e69a50c

File tree

2 files changed

+1
-29
lines changed

2 files changed

+1
-29
lines changed

examples/rand.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,6 @@
1111
print("liboqs version:", oqs_version())
1212
print("liboqs-python version:", oqs_python_version())
1313

14-
# set the entropy seed to some values
15-
entropy_seed = [0] * 48
16-
for i in range(0, 48):
17-
entropy_seed[i] = i
18-
19-
oqsrand.randombytes_nist_kat_init_256bit(bytes(entropy_seed))
20-
oqsrand.randombytes_switch_algorithm("NIST-KAT")
21-
print('{:17s}'.format("NIST-KAT:"), ' '.join('{:02X}'.format(x) for x in oqsrand.randombytes(32)))
22-
2314
# we do not yet support OpenSSL under Windows
2415
if platform.system() != "Windows":
2516
oqsrand.randombytes_switch_algorithm("OpenSSL")

oqs/rand.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,8 @@ def randombytes_switch_algorithm(alg_name):
2727
"""
2828
Switches the core OQS_randombytes to use the specified algorithm. See <oqs/rand.h> liboqs headers for more details.
2929
30-
:param alg_name: algorithm name, possible values are "system", "NIST-KAT", "OpenSSL".
30+
:param alg_name: algorithm name, possible values are "system" and "OpenSSL".
3131
"""
3232
if oqs.native().OQS_randombytes_switch_algorithm(
3333
oqs.ct.create_string_buffer(alg_name.encode())) != oqs.OQS_SUCCESS:
3434
raise RuntimeError('Can not switch algorithm')
35-
36-
37-
def randombytes_nist_kat_init_256bit(entropy_input, personalization_string=None):
38-
"""
39-
Initializes the NIST DRBG with the an entropy seed. The security parameter is 256 bits.
40-
41-
:param entropy_input: entropy input seed, must be exactly 48 bytes long.
42-
:param personalization_string: optional personalization string, which, if present, must be at least 48 bytes long.
43-
"""
44-
if len(entropy_input) != 48:
45-
raise ValueError('The entropy source must be exactly 48 bytes long')
46-
47-
if personalization_string is not None:
48-
if len(personalization_string) < 48:
49-
raise ValueError('The personalization string must be either empty or at least 48 bytes long')
50-
oqs.native().OQS_randombytes_nist_kat_init_256bit(oqs.ct.create_string_buffer(entropy_input),
51-
oqs.ct.create_string_buffer(personalization_string))
52-
53-
oqs.native().OQS_randombytes_nist_kat_init_256bit(oqs.ct.create_string_buffer(entropy_input), 0)

0 commit comments

Comments
 (0)