Revision 3fb10843 libavutil/des.c

View differences:

libavutil/des.c
284 284
    return in;
285 285
}
286 286

  
287
#if LIBAVUTIL_VERSION_MAJOR < 50
288
uint64_t ff_des_encdec(uint64_t in, uint64_t key, int decrypt) {
289
    uint64_t K[16];
290
    gen_roundkeys(K, key);
291
    return des_encdec(in, K, decrypt);
292
}
293
#endif
294

  
295 287
int av_des_init(AVDES *d, const uint8_t *key, int key_bits, int decrypt) {
296 288
    if (key_bits != 64 && key_bits != 192)
297 289
        return -1;
......
390 382
    uint64_t key[3];
391 383
    uint64_t data;
392 384
    uint64_t ct;
385
    uint64_t roundkeys[16];
393 386
    gettimeofday(&tv, NULL);
394 387
    srand(tv.tv_sec * 1000 * 1000 + tv.tv_usec);
395
#if LIBAVUTIL_VERSION_MAJOR < 50
396 388
    key[0] = AV_RB64(test_key);
397 389
    data = AV_RB64(plain);
398
    if (ff_des_encdec(data, key[0], 0) != AV_RB64(crypt)) {
390
    gen_roundkeys(roundkeys, key[0]);
391
    if (des_encdec(data, roundkeys, 0) != AV_RB64(crypt)) {
399 392
        printf("Test 1 failed\n");
400 393
        return 1;
401 394
    }
402
#endif
403 395
    av_des_init(&d, test_key, 64, 0);
404 396
    av_des_crypt(&d, tmp, plain, 1, NULL, 0);
405 397
    if (memcmp(tmp, crypt, sizeof(crypt))) {

Also available in: Unified diff