Refine sig for set_public_key_affine_coordinates

This functions signature was originally defined to require mutable
references for `x` / `y` as the underpinning OpenSSL C API
was not `const`.

However the actual OpenSSL implementation makes no changes. This being
the case we've chosen to reflect non mutability at the Rust level.
This commit is contained in:
Bradley Beddoes 2017-08-09 14:20:22 +10:00
parent 16e8fbc31e
commit c966583877
1 changed files with 5 additions and 5 deletions

View File

@ -462,8 +462,8 @@ impl EcKeyBuilderRef {
/// Sets the public key based on affine coordinates. /// Sets the public key based on affine coordinates.
pub fn set_public_key_affine_coordinates(&mut self, pub fn set_public_key_affine_coordinates(&mut self,
x: &mut BigNumRef, x: &BigNumRef,
y: &mut BigNumRef) y: &BigNumRef)
-> Result<&mut EcKeyBuilderRef, ErrorStack> { -> Result<&mut EcKeyBuilderRef, ErrorStack> {
unsafe { unsafe {
cvt(ffi::EC_KEY_set_public_key_affine_coordinates(self.as_ptr(), cvt(ffi::EC_KEY_set_public_key_affine_coordinates(self.as_ptr(),
@ -571,12 +571,12 @@ mod test {
let y = data_encoding::base64url::decode_nopad("4Etl6SRW2YiLUrN5vfvVHuhp7x8PxltmWWlbbM4IFyM".as_bytes()) let y = data_encoding::base64url::decode_nopad("4Etl6SRW2YiLUrN5vfvVHuhp7x8PxltmWWlbbM4IFyM".as_bytes())
.unwrap(); .unwrap();
let mut xbn = BigNum::from_slice(&x).unwrap(); let xbn = BigNum::from_slice(&x).unwrap();
let mut ybn = BigNum::from_slice(&y).unwrap(); let ybn = BigNum::from_slice(&y).unwrap();
let mut builder = EcKeyBuilder::new().unwrap(); let mut builder = EcKeyBuilder::new().unwrap();
builder.set_group(&group).unwrap(); builder.set_group(&group).unwrap();
builder.set_public_key_affine_coordinates(&mut xbn, &mut ybn).unwrap(); builder.set_public_key_affine_coordinates(&xbn, &ybn).unwrap();
let ec_key = builder.build(); let ec_key = builder.build();
assert!(ec_key.check_key().is_ok()); assert!(ec_key.check_key().is_ok());