mirror of
https://github.com/laanwj/k210-sdk-stuff.git
synced 2024-11-24 10:26:19 +04:00
rust: Add assertion that input length is at least 0 for AES
It doesn't look like the AES engine can handle 0-sized input. This makes sense, in a way, as it is an edge case and in most cases a no-op. Only in GCM mode, where there one might want to compute a tag over a 0-byte input, would this come up.
This commit is contained in:
parent
217b00227e
commit
fbe528d8b6
@ -53,6 +53,7 @@ pub fn run(
|
|||||||
tag: &mut [u8],
|
tag: &mut [u8],
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
assert!(ind.len() != 0);
|
||||||
match cipher_mode {
|
match cipher_mode {
|
||||||
cipher_mode::ECB => assert!(iv.len() == 0 && aad.len() == 0),
|
cipher_mode::ECB => assert!(iv.len() == 0 && aad.len() == 0),
|
||||||
cipher_mode::CBC => assert!(iv.len() == 16 && aad.len() == 0),
|
cipher_mode::CBC => assert!(iv.len() == 16 && aad.len() == 0),
|
||||||
|
Loading…
Reference in New Issue
Block a user