@@ -22,6 +22,8 @@ use ring::{
22
22
23
23
#[ test]
24
24
fn ecdsa_from_pkcs8_test ( ) {
25
+ let rng = rand:: SystemRandom :: new ( ) ;
26
+
25
27
test:: run (
26
28
test_file ! ( "ecdsa_from_pkcs8_tests.txt" ) ,
27
29
|section, test_case| {
@@ -57,7 +59,7 @@ fn ecdsa_from_pkcs8_test() {
57
59
let error = test_case. consume_optional_string ( "Error" ) ;
58
60
59
61
match (
60
- signature:: EcdsaKeyPair :: from_pkcs8 ( this_fixed, & input) ,
62
+ signature:: EcdsaKeyPair :: from_pkcs8 ( this_fixed, & input, & rng ) ,
61
63
error. clone ( ) ,
62
64
) {
63
65
( Ok ( _) , None ) => ( ) ,
@@ -67,7 +69,7 @@ fn ecdsa_from_pkcs8_test() {
67
69
} ;
68
70
69
71
match (
70
- signature:: EcdsaKeyPair :: from_pkcs8 ( this_asn1, & input) ,
72
+ signature:: EcdsaKeyPair :: from_pkcs8 ( this_asn1, & input, & rng ) ,
71
73
error,
72
74
) {
73
75
( Ok ( _) , None ) => ( ) ,
@@ -76,8 +78,8 @@ fn ecdsa_from_pkcs8_test() {
76
78
( Err ( actual) , Some ( expected) ) => assert_eq ! ( format!( "{}" , actual) , expected) ,
77
79
} ;
78
80
79
- assert ! ( signature:: EcdsaKeyPair :: from_pkcs8( other_fixed, & input) . is_err( ) ) ;
80
- assert ! ( signature:: EcdsaKeyPair :: from_pkcs8( other_asn1, & input) . is_err( ) ) ;
81
+ assert ! ( signature:: EcdsaKeyPair :: from_pkcs8( other_fixed, & input, & rng ) . is_err( ) ) ;
82
+ assert ! ( signature:: EcdsaKeyPair :: from_pkcs8( other_asn1, & input, & rng ) . is_err( ) ) ;
81
83
82
84
Ok ( ( ) )
83
85
} ,
@@ -104,7 +106,7 @@ fn ecdsa_generate_pkcs8_test() {
104
106
println ! ( ) ;
105
107
106
108
#[ cfg( feature = "alloc" ) ]
107
- let _ = signature:: EcdsaKeyPair :: from_pkcs8 ( * alg, pkcs8. as_ref ( ) ) . unwrap ( ) ;
109
+ let _ = signature:: EcdsaKeyPair :: from_pkcs8 ( * alg, pkcs8. as_ref ( ) , & rng ) . unwrap ( ) ;
108
110
}
109
111
}
110
112
@@ -181,9 +183,11 @@ fn ecdsa_test_public_key_coverage() {
181
183
const PUBLIC_KEY : & [ u8 ] = include_bytes ! ( "ecdsa_test_public_key_p256.der" ) ;
182
184
const PUBLIC_KEY_DEBUG : & str = include_str ! ( "ecdsa_test_public_key_p256_debug.txt" ) ;
183
185
186
+ let rng = rand:: SystemRandom :: new ( ) ;
184
187
let key_pair = signature:: EcdsaKeyPair :: from_pkcs8 (
185
188
& signature:: ECDSA_P256_SHA256_FIXED_SIGNING ,
186
189
PRIVATE_KEY ,
190
+ & rng,
187
191
)
188
192
. unwrap ( ) ;
189
193
@@ -246,7 +250,7 @@ fn signature_ecdsa_sign_fixed_sign_and_verify_test() {
246
250
} ;
247
251
248
252
let private_key =
249
- signature:: EcdsaKeyPair :: from_private_key_and_public_key ( signing_alg, & d, & q)
253
+ signature:: EcdsaKeyPair :: from_private_key_and_public_key ( signing_alg, & d, & q, & rng )
250
254
. unwrap ( ) ;
251
255
252
256
let signature = private_key. sign ( & rng, & msg) . unwrap ( ) ;
@@ -300,7 +304,7 @@ fn signature_ecdsa_sign_asn1_test() {
300
304
} ;
301
305
302
306
let private_key =
303
- signature:: EcdsaKeyPair :: from_private_key_and_public_key ( signing_alg, & d, & q)
307
+ signature:: EcdsaKeyPair :: from_private_key_and_public_key ( signing_alg, & d, & q, & rng )
304
308
. unwrap ( ) ;
305
309
306
310
let signature = private_key. sign ( & rng, & msg) . unwrap ( ) ;
0 commit comments