Skip to content

Commit 4b6ffb7

Browse files
committed
Remove af_alg_iv::as_slice and trait implementations that depend on it
These trait implementations exposed an unsound API (see #1501)
1 parent 0d37400 commit 4b6ffb7

File tree

2 files changed

+2
-52
lines changed

2 files changed

+2
-52
lines changed

src/unix/linux_like/android/mod.rs

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -591,38 +591,13 @@ cfg_if! {
591591
}
592592
}
593593

594-
impl af_alg_iv {
595-
fn as_slice(&self) -> &[u8] {
596-
unsafe {
597-
::core::slice::from_raw_parts(
598-
self.iv.as_ptr(),
599-
self.ivlen as usize
600-
)
601-
}
602-
}
603-
}
604-
605-
impl PartialEq for af_alg_iv {
606-
fn eq(&self, other: &af_alg_iv) -> bool {
607-
*self.as_slice() == *other.as_slice()
608-
}
609-
}
610-
611-
impl Eq for af_alg_iv {}
612-
613594
impl ::fmt::Debug for af_alg_iv {
614595
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
615596
f.debug_struct("af_alg_iv")
616-
.field("iv", &self.as_slice())
597+
.field("ivlen", &self.ivlen)
617598
.finish()
618599
}
619600
}
620-
621-
impl ::hash::Hash for af_alg_iv {
622-
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
623-
self.as_slice().hash(state);
624-
}
625-
}
626601
}
627602
}
628603

src/unix/linux_like/linux/mod.rs

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -781,39 +781,14 @@ cfg_if! {
781781
}
782782
}
783783

784-
impl af_alg_iv {
785-
fn as_slice(&self) -> &[u8] {
786-
unsafe {
787-
::core::slice::from_raw_parts(
788-
self.iv.as_ptr(),
789-
self.ivlen as usize
790-
)
791-
}
792-
}
793-
}
794-
795-
impl PartialEq for af_alg_iv {
796-
fn eq(&self, other: &af_alg_iv) -> bool {
797-
*self.as_slice() == *other.as_slice()
798-
}
799-
}
800-
801-
impl Eq for af_alg_iv {}
802-
803784
impl ::fmt::Debug for af_alg_iv {
804785
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
805786
f.debug_struct("af_alg_iv")
806-
.field("iv", &self.as_slice())
787+
.field("ivlen", &self.ivlen)
807788
.finish()
808789
}
809790
}
810791

811-
impl ::hash::Hash for af_alg_iv {
812-
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
813-
self.as_slice().hash(state);
814-
}
815-
}
816-
817792
impl PartialEq for mq_attr {
818793
fn eq(&self, other: &mq_attr) -> bool {
819794
self.mq_flags == other.mq_flags &&

0 commit comments

Comments
 (0)