Skip to content

Commit add1460

Browse files
committed
mark AES intrinsics as safe
Mark all AES intrinsics as safe.
1 parent 47e0d61 commit add1460

File tree

1 file changed

+12
-12
lines changed
  • crates/core_arch/src/x86

1 file changed

+12
-12
lines changed

Diff for: crates/core_arch/src/x86/aes.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ unsafe extern "C" {
3535
#[target_feature(enable = "aes")]
3636
#[cfg_attr(test, assert_instr(aesdec))]
3737
#[stable(feature = "simd_x86", since = "1.27.0")]
38-
pub unsafe fn _mm_aesdec_si128(a: __m128i, round_key: __m128i) -> __m128i {
39-
aesdec(a, round_key)
38+
pub fn _mm_aesdec_si128(a: __m128i, round_key: __m128i) -> __m128i {
39+
unsafe { aesdec(a, round_key) }
4040
}
4141

4242
/// Performs the last round of an AES decryption flow on data (state) in `a`.
@@ -46,8 +46,8 @@ pub unsafe fn _mm_aesdec_si128(a: __m128i, round_key: __m128i) -> __m128i {
4646
#[target_feature(enable = "aes")]
4747
#[cfg_attr(test, assert_instr(aesdeclast))]
4848
#[stable(feature = "simd_x86", since = "1.27.0")]
49-
pub unsafe fn _mm_aesdeclast_si128(a: __m128i, round_key: __m128i) -> __m128i {
50-
aesdeclast(a, round_key)
49+
pub fn _mm_aesdeclast_si128(a: __m128i, round_key: __m128i) -> __m128i {
50+
unsafe { aesdeclast(a, round_key) }
5151
}
5252

5353
/// Performs one round of an AES encryption flow on data (state) in `a`.
@@ -57,8 +57,8 @@ pub unsafe fn _mm_aesdeclast_si128(a: __m128i, round_key: __m128i) -> __m128i {
5757
#[target_feature(enable = "aes")]
5858
#[cfg_attr(test, assert_instr(aesenc))]
5959
#[stable(feature = "simd_x86", since = "1.27.0")]
60-
pub unsafe fn _mm_aesenc_si128(a: __m128i, round_key: __m128i) -> __m128i {
61-
aesenc(a, round_key)
60+
pub fn _mm_aesenc_si128(a: __m128i, round_key: __m128i) -> __m128i {
61+
unsafe { aesenc(a, round_key) }
6262
}
6363

6464
/// Performs the last round of an AES encryption flow on data (state) in `a`.
@@ -68,8 +68,8 @@ pub unsafe fn _mm_aesenc_si128(a: __m128i, round_key: __m128i) -> __m128i {
6868
#[target_feature(enable = "aes")]
6969
#[cfg_attr(test, assert_instr(aesenclast))]
7070
#[stable(feature = "simd_x86", since = "1.27.0")]
71-
pub unsafe fn _mm_aesenclast_si128(a: __m128i, round_key: __m128i) -> __m128i {
72-
aesenclast(a, round_key)
71+
pub fn _mm_aesenclast_si128(a: __m128i, round_key: __m128i) -> __m128i {
72+
unsafe { aesenclast(a, round_key) }
7373
}
7474

7575
/// Performs the `InvMixColumns` transformation on `a`.
@@ -79,8 +79,8 @@ pub unsafe fn _mm_aesenclast_si128(a: __m128i, round_key: __m128i) -> __m128i {
7979
#[target_feature(enable = "aes")]
8080
#[cfg_attr(test, assert_instr(aesimc))]
8181
#[stable(feature = "simd_x86", since = "1.27.0")]
82-
pub unsafe fn _mm_aesimc_si128(a: __m128i) -> __m128i {
83-
aesimc(a)
82+
pub fn _mm_aesimc_si128(a: __m128i) -> __m128i {
83+
unsafe { aesimc(a) }
8484
}
8585

8686
/// Assist in expanding the AES cipher key.
@@ -95,9 +95,9 @@ pub unsafe fn _mm_aesimc_si128(a: __m128i) -> __m128i {
9595
#[cfg_attr(test, assert_instr(aeskeygenassist, IMM8 = 0))]
9696
#[rustc_legacy_const_generics(1)]
9797
#[stable(feature = "simd_x86", since = "1.27.0")]
98-
pub unsafe fn _mm_aeskeygenassist_si128<const IMM8: i32>(a: __m128i) -> __m128i {
98+
pub fn _mm_aeskeygenassist_si128<const IMM8: i32>(a: __m128i) -> __m128i {
9999
static_assert_uimm_bits!(IMM8, 8);
100-
aeskeygenassist(a, IMM8 as u8)
100+
unsafe { aeskeygenassist(a, IMM8 as u8) }
101101
}
102102

103103
#[cfg(test)]

0 commit comments

Comments
 (0)