Remove `af_alg_iv::as_slice` and trait implementations that depend on it
These trait implementations exposed an unsound API (see https://github.com/rust-lang/libc/issues/1501)
This commit is contained in:
parent
0d374002b8
commit
4b6ffb7aaf
|
@ -591,38 +591,13 @@ cfg_if! {
|
|||
}
|
||||
}
|
||||
|
||||
impl af_alg_iv {
|
||||
fn as_slice(&self) -> &[u8] {
|
||||
unsafe {
|
||||
::core::slice::from_raw_parts(
|
||||
self.iv.as_ptr(),
|
||||
self.ivlen as usize
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for af_alg_iv {
|
||||
fn eq(&self, other: &af_alg_iv) -> bool {
|
||||
*self.as_slice() == *other.as_slice()
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for af_alg_iv {}
|
||||
|
||||
impl ::fmt::Debug for af_alg_iv {
|
||||
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
|
||||
f.debug_struct("af_alg_iv")
|
||||
.field("iv", &self.as_slice())
|
||||
.field("ivlen", &self.ivlen)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl ::hash::Hash for af_alg_iv {
|
||||
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
|
||||
self.as_slice().hash(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -781,39 +781,14 @@ cfg_if! {
|
|||
}
|
||||
}
|
||||
|
||||
impl af_alg_iv {
|
||||
fn as_slice(&self) -> &[u8] {
|
||||
unsafe {
|
||||
::core::slice::from_raw_parts(
|
||||
self.iv.as_ptr(),
|
||||
self.ivlen as usize
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for af_alg_iv {
|
||||
fn eq(&self, other: &af_alg_iv) -> bool {
|
||||
*self.as_slice() == *other.as_slice()
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for af_alg_iv {}
|
||||
|
||||
impl ::fmt::Debug for af_alg_iv {
|
||||
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
|
||||
f.debug_struct("af_alg_iv")
|
||||
.field("iv", &self.as_slice())
|
||||
.field("ivlen", &self.ivlen)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl ::hash::Hash for af_alg_iv {
|
||||
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
|
||||
self.as_slice().hash(state);
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for mq_attr {
|
||||
fn eq(&self, other: &mq_attr) -> bool {
|
||||
self.mq_flags == other.mq_flags &&
|
||||
|
|
Loading…
Reference in New Issue