Commit c6876d5f authored by cRTrn13's avatar cRTrn13
Browse files

More preliminary work. No, this wont compile yet.

parent a030dea9
......@@ -2,12 +2,27 @@
#include <stdio.h>
#include "aacs.h"
#include "crypto.h"
#include "../util/macro.h"
int _calc_pk(uint8_t *key);
int _calc_mk(uint8_t *key);
int _calc_vuk(uint8_t *key, const char *path);
int _calc_uks(AACS *aacs, uint8_t *vuk);
int _validate_pk(uint8_t *pk, uint8_t *cvalue, uint8_t *uv, uint8_t *vd);
int _verify_ts(uint8_t *buf);
AACS *aacs_open(const char *path)
{
uint8_t key[16];
AACS aacs = malloc(sizeof(AACS));
// perform aacs waterfall
_calc_pk(key);
_calc_mk(key);
_calc_vuk(key, path);
_calc_uks(aacs, key);
}
void aacs_close(AACS *aacs)
......@@ -15,3 +30,17 @@ void aacs_close(AACS *aacs)
X_FREE(aacs);
}
int aacs_decrypt_unit(AACS *aacs, uint8_t *buf)
{
uint8_t seed[16], iv[] = { 0x0b, 0xa0, 0xf8, 0xdd, 0xfe, 0xa6, 0x1f, 0xb3, 0xd8, 0xdf, 0x9f, 0x56, 0x6a, 0x05, 0x0f, 0x78 };
//AES_set_encrypt_key(bluray->uk, 128, &bluray->aes);
//AES_encrypt(buf, seed, &bluray->aes);
int a;
for (a = 0; a < 16; a++)
seed[a] ^= buf[a];
//AES_set_decrypt_key( seed, 128, &bluray->aes );
//AES_cbc_encrypt( buf + 16, buf + 16, len - 16, &bluray->aes, bluray->iv, 0 );
}
/*
* libaacs by Doom9 ppl 2009
* The aim of libaacs is to achieve a complete open-source implementation of the AACS spec
* The spec isfreely available at http://www.aacsla.com/specifications/
* The spec is freely available at http://www.aacsla.com/specifications/
*/
#ifndef AACS_H_
......@@ -14,12 +14,12 @@
typedef struct aacs AACS;
struct aacs {
*uks, // unit key array (size = 16 * num_uks, each key is at 16-byte offset)
iv[16]; // current decryption iv
uint8_t *uks; // unit key array (size = 16 * num_uks, each key is at 16-byte offset)
uint16_t num_uks; // number of unit keys
};
AACS *aacs_open(const char *path);
void aacs_close(AACS *aacs);
int aacs_decrypt_unit(AACS *aacs, uint8_t *buf);
#endif /* AACS_H_ */
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