1 //! ECDH key agreement tests 2 3 use super::*; 4 5 define_test_set!( 6 "ECDH", 7 "ecdh_test_schema.json", 8 "ecdh_ecpoint_test_schema.json" 9 ); 10 11 define_algorithm_map!("ECDH" => Ecdh); 12 13 define_test_set_names!( 14 EcdhBrainpool224r1 => "ecdh_brainpoolP224r1", 15 EcdhBrainpool256r1 => "ecdh_brainpoolP256r1", 16 EcdhBrainpool320r1 => "ecdh_brainpoolP320r1", 17 EcdhBrainpool384r1 => "ecdh_brainpoolP384r1", 18 EcdhBrainpool512r1 => "ecdh_brainpoolP512r1", 19 EcdhSecp224r1 => "ecdh_secp224r1", 20 EcdhSecp256k1 => "ecdh_secp256k1", 21 EcdhSecp256r1 => "ecdh_secp256r1", 22 EcdhSecp384r1 => "ecdh_secp384r1", 23 EcdhSecp521r1 => "ecdh_secp521r1", 24 EcdhSecp224r1Ecpoint => "ecdh_secp224r1_ecpoint", 25 EcdhSecp256r1Ecpoint => "ecdh_secp256r1_ecpoint", 26 EcdhSecp384r1Ecpoint => "ecdh_secp384r1_ecpoint", 27 EcdhSecp521r1Ecpoint => "ecdh_secp521r1_ecpoint", 28 EcdhMisc => "ecdh" 29 ); 30 31 #[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Deserialize)] 32 pub enum TestFlag { 33 AddSubChain, 34 #[allow(non_camel_case_types)] 35 CVE_2017_10176, 36 CompressedPoint, 37 GroupIsomorphism, 38 InvalidAsn, 39 InvalidPublic, 40 IsomorphicPublicKey, 41 ModifiedPrime, 42 UnnamedCurve, 43 UnusedParam, 44 WeakPublicKey, 45 WrongOrder, 46 } 47 48 #[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Deserialize)] 49 pub enum EcdhEncoding { 50 #[serde(rename = "asn")] 51 Asn1, 52 #[serde(rename = "ecpoint")] 53 EcPoint, 54 } 55 56 define_typeid!(TestGroupTypeId => "EcdhTest", "EcdhEcpointTest"); 57 58 define_test_group!(curve: EllipticCurve, encoding: EcdhEncoding); 59 60 define_test!( 61 "public" => public_key: Vec<u8>, 62 "private" => private_key: Vec<u8>, 63 "shared" => shared_secret: Vec<u8>, 64 ); 65