2017-09-23 10:18:46 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
2017-10-31 11:40:07 -07:00
|
|
|
#include "pkg2zip_utils.h"
|
2017-09-23 10:18:46 -07:00
|
|
|
|
2017-11-05 23:02:59 -08:00
|
|
|
typedef struct aes128_key {
|
2017-10-31 15:18:41 -07:00
|
|
|
uint32_t PKG_ALIGN(16) key[44];
|
2017-09-23 10:18:46 -07:00
|
|
|
} aes128_key;
|
|
|
|
|
|
2017-11-05 23:02:59 -08:00
|
|
|
void aes128_init(aes128_key* ctx, const uint8_t* key);
|
|
|
|
|
void aes128_init_dec(aes128_key* ctx, const uint8_t* key);
|
|
|
|
|
|
|
|
|
|
void aes128_ecb_encrypt(const aes128_key* ctx, const uint8_t* input, uint8_t* output);
|
|
|
|
|
void aes128_ecb_decrypt(const aes128_key* ctx, const uint8_t* input, uint8_t* output);
|
|
|
|
|
|
|
|
|
|
void aes128_ctr_xor(const aes128_key* ctx, const uint8_t* iv, uint64_t block, uint8_t* buffer, size_t size);
|
|
|
|
|
|
|
|
|
|
void aes128_cmac(const uint8_t* key, const uint8_t* buffer, uint32_t size, uint8_t* mac);
|
|
|
|
|
|
|
|
|
|
void aes128_psp_decrypt(const aes128_key* ctx, const uint8_t* iv, uint32_t index, uint8_t* buffer, uint32_t size);
|