kodi
|
#include "config.h"
#include "bigint_impl.h"
#include "bigint.h"
Go to the source code of this file.
Classes | |
struct | aes_key_st |
struct | RC4_CTX |
struct | SHA1_CTX |
struct | MD2_CTX |
struct | MD5_CTX |
struct | RSA_CTX |
Macros | |
#define | AES_MAXROUNDS 14 |
#define | AES_BLOCKSIZE 16 |
#define | AES_IV_SIZE 16 |
#define | SHA256_SIZE 32 |
#define | SHA1_SIZE 20 |
#define | MD2_SIZE 16 |
#define | MD5_SIZE 16 |
Typedefs | |
typedef struct aes_key_st | AES_CTX |
Enumerations | |
enum | AES_MODE { AES_MODE_128, AES_MODE_256 } |
Functions | |
void | AES_set_key (AES_CTX *ctx, const uint8_t *key, const uint8_t *iv, AES_MODE mode) |
Set up AES with the key/iv and cipher size. | |
void | AES_cbc_encrypt (AES_CTX *ctx, const uint8_t *msg, uint8_t *out, int length) |
Encrypt a byte sequence (with a block size 16) using the AES cipher. | |
void | AES_cbc_decrypt (AES_CTX *ks, const uint8_t *in, uint8_t *out, int length) |
Decrypt a byte sequence (with a block size 16) using the AES cipher. | |
void | AES_convert_key (AES_CTX *ctx) |
Change a key for decryption. | |
void | RC4_setup (RC4_CTX *s, const uint8_t *key, int length) |
An implementation of the RC4/ARC4 algorithm. More... | |
void | RC4_crypt (RC4_CTX *s, const uint8_t *msg, uint8_t *data, int length) |
Perform the encrypt/decrypt operation (can use it for either since this is a stream cipher). More... | |
void | SHA1_Init (SHA1_CTX *) |
Initialize the SHA1 context. | |
void | SHA1_Update (SHA1_CTX *, const uint8_t *msg, int len) |
Accepts an array of octets as the next portion of the message. | |
void | SHA1_Final (uint8_t *digest, SHA1_CTX *) |
Return the 160-bit message digest into the user's array. | |
EXP_FUNC void STDCALL | MD2_Init (MD2_CTX *ctx) |
EXP_FUNC void STDCALL | MD2_Update (MD2_CTX *ctx, const uint8_t *input, int ilen) |
EXP_FUNC void STDCALL | MD2_Final (uint8_t *digest, MD2_CTX *ctx) |
EXP_FUNC void STDCALL | MD5_Init (MD5_CTX *) |
MD5 initialization - begins an MD5 operation, writing a new ctx. | |
EXP_FUNC void STDCALL | MD5_Update (MD5_CTX *, const uint8_t *msg, int len) |
Accepts an array of octets as the next portion of the message. | |
EXP_FUNC void STDCALL | MD5_Final (uint8_t *digest, MD5_CTX *) |
Return the 128-bit message digest into the user's array. | |
void | hmac_md5 (const uint8_t *msg, int length, const uint8_t *key, int key_len, uint8_t *digest) |
HMAC implementation - This code was originally taken from RFC2104 See http://www.ietf.org/rfc/rfc2104.txt and http://www.faqs.org/rfcs/rfc2202.html. More... | |
void | hmac_sha1 (const uint8_t *msg, int length, const uint8_t *key, int key_len, uint8_t *digest) |
Perform HMAC-SHA1 NOTE: does not handle keys larger than the block size. | |
void | RSA_priv_key_new (RSA_CTX **rsa_ctx, const uint8_t *modulus, int mod_len, const uint8_t *pub_exp, int pub_len, const uint8_t *priv_exp, int priv_len) |
Implements the RSA public encryption algorithm. More... | |
void | RSA_pub_key_new (RSA_CTX **rsa_ctx, const uint8_t *modulus, int mod_len, const uint8_t *pub_exp, int pub_len) |
void | RSA_free (RSA_CTX *ctx) |
Free up any RSA context resources. | |
int | RSA_decrypt (const RSA_CTX *ctx, const uint8_t *in_data, uint8_t *out_data, int is_decryption) |
Use PKCS1.5 for decryption/verification. More... | |
bigint * | RSA_private (const RSA_CTX *c, bigint *bi_msg) |
Performs m = c^d mod n. | |
EXP_FUNC void STDCALL | RNG_initialize (void) |
Initialise the Random Number Generator engine. More... | |
EXP_FUNC void STDCALL | RNG_custom_init (const uint8_t *seed_buf, int size) |
If no /dev/urandom, then initialise the RNG with something interesting. | |
EXP_FUNC void STDCALL | RNG_terminate (void) |
Terminate the RNG engine. | |
EXP_FUNC void STDCALL | get_random (int num_rand_bytes, uint8_t *rand_data) |
Set a series of bytes with a random number. More... | |
void | get_random_NZ (int num_rand_bytes, uint8_t *rand_data) |
Set a series of bytes with a random number. More... | |
EXP_FUNC void STDCALL get_random | ( | int | num_rand_bytes, |
uint8_t * | rand_data | ||
) |
Set a series of bytes with a random number.
Individual bytes can be 0
void get_random_NZ | ( | int | num_rand_bytes, |
uint8_t * | rand_data | ||
) |
Set a series of bytes with a random number.
Individual bytes are not zero.
void hmac_md5 | ( | const uint8_t * | msg, |
int | length, | ||
const uint8_t * | key, | ||
int | key_len, | ||
uint8_t * | digest | ||
) |
HMAC implementation - This code was originally taken from RFC2104 See http://www.ietf.org/rfc/rfc2104.txt and http://www.faqs.org/rfcs/rfc2202.html.
Perform HMAC-MD5 NOTE: does not handle keys larger than the block size.
void RC4_crypt | ( | RC4_CTX * | ctx, |
const uint8_t * | msg, | ||
uint8_t * | out, | ||
int | length | ||
) |
Perform the encrypt/decrypt operation (can use it for either since this is a stream cipher).
NOTE: *msg and *out must be the same pointer (performance tweak)
void RC4_setup | ( | RC4_CTX * | ctx, |
const uint8_t * | key, | ||
int | length | ||
) |
An implementation of the RC4/ARC4 algorithm.
Originally written by Christophe Devine. Get ready for an encrypt/decrypt operation
EXP_FUNC void STDCALL RNG_initialize | ( | void | ) |
Initialise the Random Number Generator engine.
int RSA_decrypt | ( | const RSA_CTX * | ctx, |
const uint8_t * | in_data, | ||
uint8_t * | out_data, | ||
int | is_decryption | ||
) |
Use PKCS1.5 for decryption/verification.
ctx | [in] The context |
in_data | [in] The data to encrypt (must be < modulus size-11) |
out_data | [out] The encrypted data. |
is_decryption | [in] Decryption or verify operation. |
void RSA_priv_key_new | ( | RSA_CTX ** | ctx, |
const uint8_t * | modulus, | ||
int | mod_len, | ||
const uint8_t * | pub_exp, | ||
int | pub_len, | ||
const uint8_t * | priv_exp, | ||
int | priv_len | ||
) |
Implements the RSA public encryption algorithm.
Uses the bigint library to perform its calculations.