diff --git a/esp-hal-common/src/rsa/esp32.rs b/esp-hal-common/src/rsa/esp32.rs index bff575e274f..f18b1d0f93c 100644 --- a/esp-hal-common/src/rsa/esp32.rs +++ b/esp-hal-common/src/rsa/esp32.rs @@ -59,14 +59,14 @@ impl<'d> Rsa<'d> { self.rsa.x_mem(0).as_ptr() as *mut u32, N, ); - write_bytes(self.rsa.x_mem(0).as_ptr().add(N * 4), 0, N * 4); + write_bytes(self.rsa.x_mem(0).as_ptr().add(N), 0, N); } unsafe fn write_multi_operand_b(&mut self, operand_b: &[u32; N]) { - write_bytes(self.rsa.z_mem(0).as_ptr(), 0, N * 4); + write_bytes(self.rsa.z_mem(0).as_ptr(), 0, N); copy_nonoverlapping( operand_b.as_ptr(), - self.rsa.z_mem(0).as_ptr().add(N * 4) as *mut u32, + self.rsa.z_mem(0).as_ptr().add(N) as *mut u32, N, ); } diff --git a/esp-hal-common/src/rsa/esp32cX.rs b/esp-hal-common/src/rsa/esp32cX.rs index 0a7b954e8c2..fcbd2d8293b 100644 --- a/esp-hal-common/src/rsa/esp32cX.rs +++ b/esp-hal-common/src/rsa/esp32cX.rs @@ -108,7 +108,7 @@ impl<'d> Rsa<'d> { unsafe fn write_multi_operand_b(&mut self, operand_b: &[u32; N]) { copy_nonoverlapping( operand_b.as_ptr(), - self.rsa.z_mem(0).as_ptr().add(N * 4) as *mut u32, + self.rsa.z_mem(0).as_ptr().add(N) as *mut u32, N, ); } diff --git a/esp-hal-common/src/rsa/esp32sX.rs b/esp-hal-common/src/rsa/esp32sX.rs index a9e932cbb7d..d1797983b1b 100644 --- a/esp-hal-common/src/rsa/esp32sX.rs +++ b/esp-hal-common/src/rsa/esp32sX.rs @@ -114,7 +114,7 @@ impl<'d> Rsa<'d> { unsafe fn write_multi_operand_b(&mut self, operand_b: &[u32; N]) { copy_nonoverlapping( operand_b.as_ptr(), - self.rsa.z_mem(0).as_ptr().add(N * 4) as *mut u32, + self.rsa.z_mem(0).as_ptr().add(N) as *mut u32, N, ); }