mirror of
https://git.proxmox.com/git/proxmox
synced 2025-08-07 22:50:49 +00:00
replace deprecated 'affine_coordinates_gfp' call
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
65f05daf7e
commit
e499b084c8
16
src/key.rs
16
src/key.rs
@ -106,9 +106,8 @@ impl<P: HasPublic> TryFrom<&openssl::ec::EcKey<P>> for EcPublicKey {
|
|||||||
let mut ctx = openssl::bn::BigNumContext::new()?;
|
let mut ctx = openssl::bn::BigNumContext::new()?;
|
||||||
let mut x = openssl::bn::BigNum::new()?;
|
let mut x = openssl::bn::BigNum::new()?;
|
||||||
let mut y = openssl::bn::BigNum::new()?;
|
let mut y = openssl::bn::BigNum::new()?;
|
||||||
let _: () = key
|
key.public_key()
|
||||||
.public_key()
|
.affine_coordinates(group, &mut x, &mut y, &mut ctx)?;
|
||||||
.affine_coordinates_gfp(group, &mut x, &mut y, &mut ctx)?;
|
|
||||||
|
|
||||||
Ok(EcPublicKey {
|
Ok(EcPublicKey {
|
||||||
crv: "P-256",
|
crv: "P-256",
|
||||||
@ -117,3 +116,14 @@ impl<P: HasPublic> TryFrom<&openssl::ec::EcKey<P>> for EcPublicKey {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_key_conversion() -> Result<(), Error> {
|
||||||
|
let key = openssl::ec::EcKey::generate(
|
||||||
|
openssl::ec::EcGroup::from_curve_name(openssl::nid::Nid::X9_62_PRIME256V1)?.as_ref(),
|
||||||
|
)?;
|
||||||
|
|
||||||
|
let _ = EcPublicKey::try_from(&key).expect("failed to jsonify ec key");
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user