@@ -151,6 +151,7 @@ def test_unsupported_generator_generate_dh(self, backend):
151
151
with pytest .raises (ValueError ):
152
152
dh .generate_parameters (7 , 512 , backend )
153
153
154
+ @pytest .mark .skip_fips (reason = "non-FIPS parameters" )
154
155
def test_dh_parameters_supported (self , backend ):
155
156
valid_p = int (
156
157
b"907c7211ae61aaaba1825ff53b6cb71ac6df9f1a424c033f4a0a41ac42fad3a9"
@@ -171,6 +172,12 @@ def test_dh_parameters_supported(self, backend):
171
172
)
172
173
def test_dh_parameters_allows_rfc3526_groups (self , backend , vector ):
173
174
p = int_from_bytes (binascii .unhexlify (vector ["p" ]), "big" )
175
+ if (
176
+ backend ._fips_enabled
177
+ and p .bit_length () < backend ._fips_dh_min_modulus
178
+ ):
179
+ pytest .skip ("modulus too small for FIPS mode" )
180
+
174
181
params = dh .DHParameterNumbers (p , int (vector ["g" ]))
175
182
param = params .parameters (backend )
176
183
key = param .generate_private_key ()
@@ -180,6 +187,7 @@ def test_dh_parameters_allows_rfc3526_groups(self, backend, vector):
180
187
roundtripped_key = key .private_numbers ().private_key (backend )
181
188
assert key .private_numbers () == roundtripped_key .private_numbers ()
182
189
190
+ @pytest .mark .skip_fips (reason = "non-FIPS parameters" )
183
191
@pytest .mark .parametrize (
184
192
"vector" ,
185
193
load_vectors_from_file (
@@ -227,6 +235,7 @@ def test_convert_to_numbers(self, backend, with_q):
227
235
deserialized_private , dh .DHPrivateKeyWithSerialization
228
236
)
229
237
238
+ @pytest .mark .skip_fips (reason = "FIPS requires specific parameters" )
230
239
def test_numbers_unsupported_parameters (self , backend ):
231
240
# p is set to P_1536 + 1 because when calling private_key we want it to
232
241
# fail the DH_check call OpenSSL does, but we specifically want it to
@@ -415,6 +424,7 @@ def test_dh_vectors(self, backend, vector):
415
424
416
425
assert int_from_bytes (symkey , "big" ) == int (vector ["k" ], 16 )
417
426
427
+ @pytest .mark .skip_fips (reason = "non-FIPS parameters" )
418
428
@pytest .mark .parametrize (
419
429
"vector" ,
420
430
load_vectors_from_file (
@@ -477,6 +487,7 @@ def test_private_bytes_rejects_invalid(self, encoding, fmt, backend):
477
487
with pytest .raises (ValueError ):
478
488
key .private_bytes (encoding , fmt , serialization .NoEncryption ())
479
489
490
+ @pytest .mark .skip_fips (reason = "non-FIPS parameters" )
480
491
@pytest .mark .parametrize (
481
492
("key_path" , "loader_func" , "encoding" , "is_dhx" ),
482
493
[
@@ -521,6 +532,7 @@ def test_private_bytes_match(
521
532
)
522
533
assert serialized == key_bytes
523
534
535
+ @pytest .mark .skip_fips (reason = "non-FIPS parameters" )
524
536
@pytest .mark .parametrize (
525
537
("key_path" , "loader_func" , "vec_path" , "is_dhx" ),
526
538
[
0 commit comments