[asterisk-dev] [Code Review] added AES_ENCRYPT and AES_DECRYPT dialplan functions
Russell Bryant
russell at digium.com
Sat Jan 24 12:11:17 CST 2009
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.digium.com/r/128/#review311
-----------------------------------------------------------
/trunk/funcs/func_aes.c
<http://reviewboard.digium.com/r/128/#comment711>
just 2009
/trunk/funcs/func_aes.c
<http://reviewboard.digium.com/r/128/#comment715>
I really think that we should just make a single aes_read() function. There are only 3 lines of code that are different between the encrypt and decrypt versions.
At the beginning of the common function, you could do:
int encrypt = !strcmp(cmd, "AES_ENCRYPT");
Add then elsewhere, check the encrypt variable to decide whether to encrypt or decrypt.
/trunk/funcs/func_aes.c
<http://reviewboard.digium.com/r/128/#comment714>
Since 16 is used in a number of places, I wonder if it would be useful to add something like ...
#define AES_BLOCK_SIZE 16
... and use that instead of 16.
/trunk/funcs/func_aes.c
<http://reviewboard.digium.com/r/128/#comment710>
Stray space after 16
/trunk/funcs/func_aes.c
<http://reviewboard.digium.com/r/128/#comment712>
add spaces after commas
/trunk/funcs/func_aes.c
<http://reviewboard.digium.com/r/128/#comment713>
You could simplify this down to:
memcpy(curblock, src, (datalen < 16) ? data_len : 16);
- Russell
On 2009-01-22 17:09:37, dvossel wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.digium.com/r/128/
> -----------------------------------------------------------
>
> (Updated 2009-01-22 17:09:37)
>
>
> Review request for Asterisk Developers, Russell Bryant and Mark Michelson.
>
>
> Summary
> -------
>
> Allows data to be encrypted and decrypted using AES in the dialplan.
>
>
> This addresses bug 0014301.
> http://bugs.digium.com/view.php?id=0014301
>
>
> Diffs
> -----
>
> /trunk/funcs/func_aes.c PRE-CREATION
>
> Diff: http://reviewboard.digium.com/r/128/diff
>
>
> Testing
> -------
>
>
> Thanks,
>
> dvossel
>
>
More information about the asterisk-dev
mailing list