Commit 9b6e7bbb authored by npzacs's avatar npzacs
Browse files

Use crypto_aes128d()

parent a4e5a32a
......@@ -459,14 +459,11 @@ static int _calc_vuk(AACS *aacs, uint8_t *mk, uint8_t *vuk,
return error_code;
}
int a;
gcry_cipher_hd_t gcry_h;
/* calculate VUK */
gcry_cipher_open(&gcry_h, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_ECB, 0);
gcry_cipher_setkey(gcry_h, mk, 16);
gcry_cipher_decrypt(gcry_h, vuk, 16, aacs->vid, 16);
gcry_cipher_close(gcry_h);
crypto_aes128d(mk, aacs->vid, vuk);
int a;
for (a = 0; a < 16; a++) {
vuk[a] ^= aacs->vid[a];
}
......@@ -691,12 +688,7 @@ static int _calc_uks(AACS *aacs, config_file *cf)
break;
}
gcry_cipher_hd_t gcry_h;
gcry_cipher_open(&gcry_h, GCRY_CIPHER_AES,
GCRY_CIPHER_MODE_ECB, 0);
gcry_cipher_setkey(gcry_h, vuk, 16);
gcry_cipher_decrypt(gcry_h, aacs->uks + 16*i, 16, buf, 16);
gcry_cipher_close(gcry_h);
crypto_aes128d(vuk, buf, aacs->uks + 16*i);
char str[40];
DEBUG(DBG_AACS, "Unit key %d: %s\n", i,
......
......@@ -103,15 +103,11 @@ static void _curve_free(elliptic_curve_t *c)
static void _aesg3(const uint8_t *src_key, uint8_t *dst_key, uint8_t inc)
{
int a;
gcry_cipher_hd_t gcry_h;
uint8_t seed[16] = { 0x7B, 0x10, 0x3C, 0x5D, 0xCB, 0x08, 0xC4, 0xE5,
0x1A, 0x27, 0xB0, 0x17, 0x99, 0x05, 0x3B, 0xD9 };
seed[15] += inc;
gcry_cipher_open(&gcry_h, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_ECB, 0);
gcry_cipher_setkey(gcry_h, src_key, 16);
gcry_cipher_decrypt (gcry_h, dst_key, 16, seed, 16);
gcry_cipher_close(gcry_h);
crypto_aes128d(src_key, seed, dst_key);
for (a = 0; a < 16; a++) {
dst_key[a] ^= seed[a];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment