[FFmpeg-devel] libavutil: Added cbc mode to cast5.c

Giorgio Vazzana mywing81 at gmail.com
Wed Dec 17 18:24:09 CET 2014


Hello,

2014-12-17 10:27 GMT+01:00 Carl Eugen Hoyos <cehoyos at ag.or.at>:
> supraja reddy <supraja0493 <at> gmail.com> writes:
>
>> -- CAST128 symmetric block cipher, ECB mode
>> +- CAST128 symmetric block cipher
>
> This line is part of the "2.5" paragraph, please
> do not change this paragraph as 2.5 was already
> released.
>
>> -void av_cast5_crypt(struct AVCAST5 *ctx, uint8_t *dst,
>> const uint8_t *src, int count, int decrypt);
>> +void av_cast5_crypt(struct AVCAST5 *ctx, uint8_t *dst,
>> const uint8_t *src, int count, uint8_t *iv, int decrypt);
>
> You cannot do this because cast5.h is an installed
> header. One possibility is to introduce a new
> function av_cast5_crypt2().
>
>> -    for (j = 0; j < 3; j++){
>> +    for (j = 0; j < 3; j++) {
>
>> -    for (i = 0; i < 1000000; i++){
>> +    for (i = 0; i < 1000000; i++) {
>
> Please avoid cosmetic changes in patches that
> introduce new features: Either send another
> cosmetics-only patch or leave it as it is.
>
>> +        } else {
>> +        if (iv) {
>> +            for (i = 0; i < 8; i++)
>> +                dst[i] = src[i] ^ iv[i];
>> +            encipher(cs, dst, dst);
>
> Indentation in the new code is wrong.

thank you Carl for the review, I agree all your points are valid.
There seems to be a bigger problem with this patch though, the IV
vector is not "propagated" correctly and thus the CBC mode would not
work.
Also, it would be nice if we could add some code in the selftest to
cover this mode too.

Giorgio Vazzana


More information about the ffmpeg-devel mailing list