On Wed, Jun 29, 2011 at 11:30:17PM +0100, Mans Rullgard wrote:
> Signed-off-by: Mans Rullgard <[email protected]>
> ---
>  libavutil/aes.c |   54 +++++++++++++++++++++++++++++++++---------------------
>  tests/fate2.mak |    5 +++++
>  2 files changed, 38 insertions(+), 21 deletions(-)

Patch OK , *BUT* ...

> --- a/libavutil/aes.c
> +++ b/libavutil/aes.c
> @@ -219,37 +221,47 @@ int main(void){
>  
>      for(i=0; i<2; i++){
>          av_aes_init(&b, rkey[i], 128, 1);
>          av_aes_crypt(&b, temp, rct[i], 1, NULL, 1);
>          for(j=0; j<16; j++)
> -            if(rpt[i][j] != temp[j])
> +            if(rpt[i][j] != temp[j]) {
>                  av_log(NULL, AV_LOG_ERROR, "%d %02X %02X\n", j, rpt[i][j], 
> temp[j]);
> +                err = 1;
> +            }
>      }
>  
> -    for(i=0; i<10000; i++){
> -        for(j=0; j<16; j++){
> -            pt[j] = av_lfg_get(&prng);
> -        }
> -{START_TIMER
> -        av_aes_crypt(&ae, temp, pt, 1, NULL, 0);
> -        if(!(i&(i-1)))
> -            av_log(NULL, AV_LOG_ERROR, "%02X %02X %02X %02X\n", temp[0], 
> temp[5], temp[10], temp[15]);
> -        av_aes_crypt(&ad, temp, temp, 1, NULL, 1);
> -STOP_TIMER("aes")}
> -        for(j=0; j<16; j++){
> -            if(pt[j] != temp[j]){
> -                av_log(NULL, AV_LOG_ERROR, "%d %d %02X %02X\n", i,j, pt[j], 
> temp[j]);
> +    if (argc > 1 && !strcmp(argv[1], "-t")) {
> +        AVAES ae, ad;
> +        AVLFG prng;
> +
> +        av_aes_init(&ae, "PI=3.141592654..", 128, 0);
> +        av_aes_init(&ad, "PI=3.141592654..", 128, 1);
> +        av_lfg_init(&prng, 1);
> +
> +        for(i=0; i<10000; i++){
> +            for(j=0; j<16; j++){
> +                pt[j] = av_lfg_get(&prng);
> +            }
> +            {
> +                START_TIMER;
> +                av_aes_crypt(&ae, temp, pt, 1, NULL, 0);
> +                if(!(i&(i-1)))
> +                    av_log(NULL, AV_LOG_ERROR, "%02X %02X %02X %02X\n", 
> temp[0], temp[5], temp[10], temp[15]);
> +                av_aes_crypt(&ad, temp, temp, 1, NULL, 1);
> +                STOP_TIMER("aes");
> +            }
> +            for(j=0; j<16; j++){
> +                if(pt[j] != temp[j]){
> +                    av_log(NULL, AV_LOG_ERROR, "%d %d %02X %02X\n", i,j, 
> pt[j], temp[j]);
> +                }

... keeping this ugly formatting will strip you of the opportunity of
having a cold beverage deliverd personally to you in Paris.  Make your
choice! ;)

Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to