mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-10 06:01:52 +00:00
se: Remove memset in se_perform_aes_block_operation (#53)
We can just initialize the array to be zeroed out. This is safer and less error-prone, since the initializer is now associated with the variable directly, making it impossible to put code relying on the zeroed out state before it (unlike with memset).
This commit is contained in:
parent
4d3f1f6ae8
commit
991d4f1355
1 changed files with 3 additions and 4 deletions
|
@ -381,14 +381,13 @@ void trigger_se_blocking_op(unsigned int op, void *dst, size_t dst_size, const v
|
||||||
|
|
||||||
/* Secure AES Functionality. */
|
/* Secure AES Functionality. */
|
||||||
void se_perform_aes_block_operation(void *dst, size_t dst_size, const void *src, size_t src_size) {
|
void se_perform_aes_block_operation(void *dst, size_t dst_size, const void *src, size_t src_size) {
|
||||||
uint8_t block[0x10];
|
uint8_t block[0x10] = {0};
|
||||||
|
|
||||||
if (src_size > sizeof(block) || dst_size > sizeof(block)) {
|
if (src_size > sizeof(block) || dst_size > sizeof(block)) {
|
||||||
generic_panic();
|
generic_panic();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load src data into block. */
|
/* Load src data into block. */
|
||||||
memset(block, 0, sizeof(block));
|
|
||||||
memcpy(block, src, src_size);
|
memcpy(block, src, src_size);
|
||||||
flush_dcache_range(block, block + sizeof(block));
|
flush_dcache_range(block, block + sizeof(block));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue