mirror of
https://github.com/rn10950/RetroZilla.git
synced 2024-11-14 19:50:12 +01:00
30d33aa8e8
9934c8faef29, 3c3b381c4865, 5a67f6beee9a, 1b1eb6d77728, a8b668fd72f7, bug962760, bug743700, bug857304, bug972653, bug972450, bug971358, bug903885, bug977073, bug976111, bug949939, bug947653, bug947572, bug903885, bug979106, bug966596, bug979004, bug979752, bug980848, bug938369, bug981170, bug668130, bug974693, bug975056, bug979132, bug370717, bug979070, bug985070, bug900067, bug977673, bug519255, bug989558, bug557299, bug987263, bug369802, a751a5146718, bug992343, bug952572, bug979703, bug994883, bug994869, bug993489, bug984608, bug977869, bug667371, bug672828, bug793347, bug977869
147 lines
5.8 KiB
C
147 lines
5.8 KiB
C
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
/* Prototypes of the functions defined in the assembler file. */
|
|
void intel_aes_encrypt_init_128(const unsigned char *key, PRUint32 *expanded);
|
|
void intel_aes_encrypt_init_192(const unsigned char *key, PRUint32 *expanded);
|
|
void intel_aes_encrypt_init_256(const unsigned char *key, PRUint32 *expanded);
|
|
void intel_aes_decrypt_init_128(const unsigned char *key, PRUint32 *expanded);
|
|
void intel_aes_decrypt_init_192(const unsigned char *key, PRUint32 *expanded);
|
|
void intel_aes_decrypt_init_256(const unsigned char *key, PRUint32 *expanded);
|
|
SECStatus intel_aes_encrypt_ecb_128(AESContext *cx, unsigned char *output,
|
|
unsigned int *outputLen,
|
|
unsigned int maxOutputLen,
|
|
const unsigned char *input,
|
|
unsigned int inputLen,
|
|
unsigned int blocksize);
|
|
SECStatus intel_aes_decrypt_ecb_128(AESContext *cx, unsigned char *output,
|
|
unsigned int *outputLen,
|
|
unsigned int maxOutputLen,
|
|
const unsigned char *input,
|
|
unsigned int inputLen,
|
|
unsigned int blocksize);
|
|
SECStatus intel_aes_encrypt_cbc_128(AESContext *cx, unsigned char *output,
|
|
unsigned int *outputLen,
|
|
unsigned int maxOutputLen,
|
|
const unsigned char *input,
|
|
unsigned int inputLen,
|
|
unsigned int blocksize);
|
|
SECStatus intel_aes_decrypt_cbc_128(AESContext *cx, unsigned char *output,
|
|
unsigned int *outputLen,
|
|
unsigned int maxOutputLen,
|
|
const unsigned char *input,
|
|
unsigned int inputLen,
|
|
unsigned int blocksize);
|
|
SECStatus intel_aes_encrypt_ctr_128(CTRContext *cx, unsigned char *output,
|
|
unsigned int *outputLen,
|
|
unsigned int maxOutputLen,
|
|
const unsigned char *input,
|
|
unsigned int inputLen,
|
|
unsigned int blocksize);
|
|
SECStatus intel_aes_encrypt_ecb_192(AESContext *cx, unsigned char *output,
|
|
unsigned int *outputLen,
|
|
unsigned int maxOutputLen,
|
|
const unsigned char *input,
|
|
unsigned int inputLen,
|
|
unsigned int blocksize);
|
|
SECStatus intel_aes_decrypt_ecb_192(AESContext *cx, unsigned char *output,
|
|
unsigned int *outputLen,
|
|
unsigned int maxOutputLen,
|
|
const unsigned char *input,
|
|
unsigned int inputLen,
|
|
unsigned int blocksize);
|
|
SECStatus intel_aes_encrypt_cbc_192(AESContext *cx, unsigned char *output,
|
|
unsigned int *outputLen,
|
|
unsigned int maxOutputLen,
|
|
const unsigned char *input,
|
|
unsigned int inputLen,
|
|
unsigned int blocksize);
|
|
SECStatus intel_aes_decrypt_cbc_192(AESContext *cx, unsigned char *output,
|
|
unsigned int *outputLen,
|
|
unsigned int maxOutputLen,
|
|
const unsigned char *input,
|
|
unsigned int inputLen,
|
|
unsigned int blocksize);
|
|
SECStatus intel_aes_encrypt_ctr_192(CTRContext *cx, unsigned char *output,
|
|
unsigned int *outputLen,
|
|
unsigned int maxOutputLen,
|
|
const unsigned char *input,
|
|
unsigned int inputLen,
|
|
unsigned int blocksize);
|
|
SECStatus intel_aes_encrypt_ecb_256(AESContext *cx, unsigned char *output,
|
|
unsigned int *outputLen,
|
|
unsigned int maxOutputLen,
|
|
const unsigned char *input,
|
|
unsigned int inputLen,
|
|
unsigned int blocksize);
|
|
SECStatus intel_aes_decrypt_ecb_256(AESContext *cx, unsigned char *output,
|
|
unsigned int *outputLen,
|
|
unsigned int maxOutputLen,
|
|
const unsigned char *input,
|
|
unsigned int inputLen,
|
|
unsigned int blocksize);
|
|
SECStatus intel_aes_encrypt_cbc_256(AESContext *cx, unsigned char *output,
|
|
unsigned int *outputLen,
|
|
unsigned int maxOutputLen,
|
|
const unsigned char *input,
|
|
unsigned int inputLen,
|
|
unsigned int blocksize);
|
|
SECStatus intel_aes_decrypt_cbc_256(AESContext *cx, unsigned char *output,
|
|
unsigned int *outputLen,
|
|
unsigned int maxOutputLen,
|
|
const unsigned char *input,
|
|
unsigned int inputLen,
|
|
unsigned int blocksize);
|
|
SECStatus intel_aes_encrypt_ctr_256(CTRContext *cx, unsigned char *output,
|
|
unsigned int *outputLen,
|
|
unsigned int maxOutputLen,
|
|
const unsigned char *input,
|
|
unsigned int inputLen,
|
|
unsigned int blocksize);
|
|
|
|
|
|
#define intel_aes_ecb_worker(encrypt, keysize) \
|
|
((encrypt) \
|
|
? ((keysize) == 16 ? intel_aes_encrypt_ecb_128 : \
|
|
(keysize) == 24 ? intel_aes_encrypt_ecb_192 : \
|
|
intel_aes_encrypt_ecb_256) \
|
|
: ((keysize) == 16 ? intel_aes_decrypt_ecb_128 : \
|
|
(keysize) == 24 ? intel_aes_decrypt_ecb_192 : \
|
|
intel_aes_decrypt_ecb_256))
|
|
|
|
|
|
#define intel_aes_cbc_worker(encrypt, keysize) \
|
|
((encrypt) \
|
|
? ((keysize) == 16 ? intel_aes_encrypt_cbc_128 : \
|
|
(keysize) == 24 ? intel_aes_encrypt_cbc_192 : \
|
|
intel_aes_encrypt_cbc_256) \
|
|
: ((keysize) == 16 ? intel_aes_decrypt_cbc_128 : \
|
|
(keysize) == 24 ? intel_aes_decrypt_cbc_192 : \
|
|
intel_aes_decrypt_cbc_256))
|
|
|
|
#define intel_aes_ctr_worker(nr) \
|
|
((nr) == 10 ? intel_aes_encrypt_ctr_128 : \
|
|
(nr) == 12 ? intel_aes_encrypt_ctr_192 : \
|
|
intel_aes_encrypt_ctr_256)
|
|
|
|
|
|
#define intel_aes_init(encrypt, keysize) \
|
|
do { \
|
|
if (encrypt) { \
|
|
if (keysize == 16) \
|
|
intel_aes_encrypt_init_128(key, cx->expandedKey); \
|
|
else if (keysize == 24) \
|
|
intel_aes_encrypt_init_192(key, cx->expandedKey); \
|
|
else \
|
|
intel_aes_encrypt_init_256(key, cx->expandedKey); \
|
|
} else { \
|
|
if (keysize == 16) \
|
|
intel_aes_decrypt_init_128(key, cx->expandedKey); \
|
|
else if (keysize == 24) \
|
|
intel_aes_decrypt_init_192(key, cx->expandedKey); \
|
|
else \
|
|
intel_aes_decrypt_init_256(key, cx->expandedKey); \
|
|
} \
|
|
} while (0)
|