- for(i=0; i<10000; i++){
- for(j=0; j<16; j++){
- pt[j]= random();
- }
-{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]);
+ }