crypto_libtomcrypt.c File Reference

#include "includes.h"
#include <tomcrypt.h>
#include "common.h"
#include "crypto.h"
Include dependency graph for crypto_libtomcrypt.c:

Go to the source code of this file.

Classes

struct  crypto_cipher
struct  crypto_hash
struct  crypto_private_key
struct  crypto_public_key

Defines

#define mp_clear_multi   ltc_deinit_multi
#define mp_exptmod(a, b, c, d)   ltc_mp.exptmod(a,b,c,d)
#define mp_read_unsigned_bin(a, b, c)   ltc_mp.unsigned_read(a, b, c)
#define mp_to_unsigned_bin(a, b)   ltc_mp.unsigned_write(a, b)
#define mp_unsigned_bin_size(a)   ltc_mp.unsigned_size(a)

Functions

void aes_decrypt (void *ctx, const u8 *crypt, u8 *plain)
void aes_decrypt_deinit (void *ctx)
void * aes_decrypt_init (const u8 *key, size_t len)
void aes_encrypt (void *ctx, const u8 *plain, u8 *crypt)
void aes_encrypt_deinit (void *ctx)
void * aes_encrypt_init (const u8 *key, size_t len)
int crypto_cipher_decrypt (struct crypto_cipher *ctx, const u8 *crypt, u8 *plain, size_t len)
void crypto_cipher_deinit (struct crypto_cipher *ctx)
int crypto_cipher_encrypt (struct crypto_cipher *ctx, const u8 *plain, u8 *crypt, size_t len)
struct crypto_ciphercrypto_cipher_init (enum crypto_cipher_alg alg, const u8 *iv, const u8 *key, size_t key_len)
void crypto_global_deinit (void)
int crypto_global_init (void)
int crypto_hash_finish (struct crypto_hash *ctx, u8 *mac, size_t *len)
struct crypto_hashcrypto_hash_init (enum crypto_hash_alg alg, const u8 *key, size_t key_len)
void crypto_hash_update (struct crypto_hash *ctx, const u8 *data, size_t len)
void crypto_private_key_free (struct crypto_private_key *key)
struct crypto_private_keycrypto_private_key_import (const u8 *key, size_t len, const char *passwd)
int crypto_private_key_sign_pkcs1 (struct crypto_private_key *key, const u8 *in, size_t inlen, u8 *out, size_t *outlen)
int crypto_public_key_decrypt_pkcs1 (struct crypto_public_key *key, const u8 *crypt, size_t crypt_len, u8 *plain, size_t *plain_len)
int crypto_public_key_encrypt_pkcs1_v15 (struct crypto_public_key *key, const u8 *in, size_t inlen, u8 *out, size_t *outlen)
void crypto_public_key_free (struct crypto_public_key *key)
struct crypto_public_keycrypto_public_key_from_cert (const u8 *buf, size_t len)
struct crypto_public_keycrypto_public_key_import (const u8 *key, size_t len)
static int crypto_rsa_encrypt_pkcs1 (int block_type, rsa_key *key, int key_type, const u8 *in, size_t inlen, u8 *out, size_t *outlen)
void des_encrypt (const u8 *clear, const u8 *key, u8 *cypher)
int md4_vector (size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
int md5_vector (size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
static int pkcs1_generate_encryption_block (u8 block_type, size_t modlen, const u8 *in, size_t inlen, u8 *out, size_t *outlen)
int sha1_vector (size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)

Define Documentation

#define mp_clear_multi   ltc_deinit_multi

Definition at line 23 of file crypto_libtomcrypt.c.

#define mp_exptmod ( a,
b,
c,
 )     ltc_mp.exptmod(a,b,c,d)

Definition at line 27 of file crypto_libtomcrypt.c.

#define mp_read_unsigned_bin ( a,
b,
 )     ltc_mp.unsigned_read(a, b, c)

Definition at line 26 of file crypto_libtomcrypt.c.

#define mp_to_unsigned_bin ( a,
 )     ltc_mp.unsigned_write(a, b)

Definition at line 25 of file crypto_libtomcrypt.c.

#define mp_unsigned_bin_size (  )     ltc_mp.unsigned_size(a)

Definition at line 24 of file crypto_libtomcrypt.c.


Function Documentation

void aes_decrypt ( void *  ctx,
const u8 crypt,
u8 plain 
)

aes_decrypt - Decrypt one AES block : Context pointer from aes_encrypt_init() : Encrypted data (16 bytes) : Buffer for the decrypted data (16 bytes)

Definition at line 134 of file crypto_libtomcrypt.c.

void aes_decrypt_deinit ( void *  ctx  ) 

aes_decrypt_deinit - Deinitialize AES decryption : Context pointer from aes_encrypt_init()

Definition at line 141 of file crypto_libtomcrypt.c.

void* aes_decrypt_init ( const u8 key,
size_t  len 
)

aes_decrypt_init - Initialize AES for decryption : Decryption key : Key length in bytes (usually 16, i.e., 128 bits) Returns: Pointer to context data or NULL on failure

Definition at line 120 of file crypto_libtomcrypt.c.

void aes_encrypt ( void *  ctx,
const u8 plain,
u8 crypt 
)

aes_encrypt - Encrypt one AES block : Context pointer from aes_encrypt_init() : Plaintext data to be encrypted (16 bytes) : Buffer for the encrypted data (16 bytes)

Definition at line 105 of file crypto_libtomcrypt.c.

void aes_encrypt_deinit ( void *  ctx  ) 

aes_encrypt_deinit - Deinitialize AES encryption : Context pointer from aes_encrypt_init()

Definition at line 112 of file crypto_libtomcrypt.c.

void* aes_encrypt_init ( const u8 key,
size_t  len 
)

aes_encrypt_init - Initialize AES for encryption : Encryption key : Key length in bytes (usually 16, i.e., 128 bits) Returns: Pointer to context data or NULL on failure

Definition at line 91 of file crypto_libtomcrypt.c.

int crypto_cipher_decrypt ( struct crypto_cipher ctx,
const u8 crypt,
u8 plain,
size_t  len 
)

crypto_cipher_decrypt - Cipher decrypt : Context pointer from crypto_cipher_init() : Ciphertext to decrypt : Resulting plaintext : Length of the cipher text Returns: 0 on success, -1 on failure

This function is only used with internal TLSv1 implementation (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need to implement this.

Definition at line 380 of file crypto_libtomcrypt.c.

void crypto_cipher_deinit ( struct crypto_cipher ctx  ) 

crypto_cipher_decrypt - Free cipher context : Context pointer from crypto_cipher_init()

This function is only used with internal TLSv1 implementation (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need to implement this.

Definition at line 405 of file crypto_libtomcrypt.c.

int crypto_cipher_encrypt ( struct crypto_cipher ctx,
const u8 plain,
u8 crypt,
size_t  len 
)

crypto_cipher_encrypt - Cipher encrypt : Context pointer from crypto_cipher_init() : Plaintext to cipher : Resulting ciphertext : Length of the plaintext Returns: 0 on success, -1 on failure

This function is only used with internal TLSv1 implementation (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need to implement this.

Definition at line 356 of file crypto_libtomcrypt.c.

struct crypto_cipher* crypto_cipher_init ( enum crypto_cipher_alg  alg,
const u8 iv,
const u8 key,
size_t  key_len 
) [read]

crypto_cipher_init - Initialize block/stream cipher function : Cipher algorithm : Initialization vector for block ciphers or NULL for stream ciphers : Cipher key : Length of key in bytes Returns: Pointer to cipher context to use with other cipher functions or NULL on failure

This function is only used with internal TLSv1 implementation (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need to implement this.

Definition at line 303 of file crypto_libtomcrypt.c.

void crypto_global_deinit ( void   ) 

crypto_global_deinit - Deinitialize crypto wrapper

This function is only used with internal TLSv1 implementation (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need to implement this.

Definition at line 695 of file crypto_libtomcrypt.c.

int crypto_global_init ( void   ) 

crypto_global_init - Initialize crypto wrapper

This function is only used with internal TLSv1 implementation (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need to implement this.

Definition at line 676 of file crypto_libtomcrypt.c.

int crypto_hash_finish ( struct crypto_hash ctx,
u8 hash,
size_t *  len 
)

crypto_hash_finish - Complete hash calculation : Context pointer from crypto_hash_init() : Buffer for hash value or NULL if caller is just freeing the hash context : Pointer to length of the buffer or NULL if caller is just freeing the hash context; on return, this is set to the actual length of the hash value Returns: 0 on success, -1 if buffer is too small (len set to needed length), or -2 on other failures (including failed crypto_hash_update() operations)

This function calculates the hash value and frees the context buffer that was used for hash calculation.

This function is only used with internal TLSv1 implementation (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need to implement this.

Definition at line 220 of file crypto_libtomcrypt.c.

struct crypto_hash* crypto_hash_init ( enum crypto_hash_alg  alg,
const u8 key,
size_t  key_len 
) [read]

crypto_hash_init - Initialize hash/HMAC function : Hash algorithm : Key for keyed hash (e.g., HMAC) or NULL if not needed : Length of the key in bytes Returns: Pointer to hash context to use with other hash functions or NULL on failure

This function is only used with internal TLSv1 implementation (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need to implement this.

Definition at line 159 of file crypto_libtomcrypt.c.

void crypto_hash_update ( struct crypto_hash ctx,
const u8 data,
size_t  len 
)

crypto_hash_update - Add data to hash calculation : Context pointer from crypto_hash_init() : Data buffer to add : Length of the buffer

This function is only used with internal TLSv1 implementation (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need to implement this.

Definition at line 200 of file crypto_libtomcrypt.c.

void crypto_private_key_free ( struct crypto_private_key key  ) 

crypto_private_key_free - Free private key : Private key from crypto_private_key_import()

This function is only used with internal TLSv1 implementation (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need to implement this.

Definition at line 608 of file crypto_libtomcrypt.c.

struct crypto_private_key* crypto_private_key_import ( const u8 key,
size_t  len,
const char *  passwd 
) [read]

crypto_private_key_import - Import an RSA private key : Key buffer (DER encoded RSA private key) : Key buffer length in bytes : Key encryption password or NULL if key is not encrypted Returns: Pointer to the private key or NULL on failure

This function is only used with internal TLSv1 implementation (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need to implement this.

Definition at line 452 of file crypto_libtomcrypt.c.

int crypto_private_key_sign_pkcs1 ( struct crypto_private_key key,
const u8 in,
size_t  inlen,
u8 out,
size_t *  outlen 
)

crypto_private_key_sign_pkcs1 - Sign with private key (PKCS #1) : Private key from crypto_private_key_import() : Plaintext buffer : Length of plaintext buffer in bytes : Output buffer for encrypted (signed) data : Length of output buffer in bytes; set to used length on success Returns: 0 on success, -1 on failure

This function is only used with internal TLSv1 implementation (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need to implement this.

Definition at line 590 of file crypto_libtomcrypt.c.

int crypto_public_key_decrypt_pkcs1 ( struct crypto_public_key key,
const u8 crypt,
size_t  crypt_len,
u8 plain,
size_t *  plain_len 
)

crypto_public_key_decrypt_pkcs1 - Decrypt PKCS #1 signature : Public key : Encrypted signature data (using the private key) : Encrypted signature data length : Buffer for plaintext (at least crypt_len bytes) : Plaintext length (max buffer size on input, real len on output); Returns: 0 on success, -1 on failure

Definition at line 617 of file crypto_libtomcrypt.c.

int crypto_public_key_encrypt_pkcs1_v15 ( struct crypto_public_key key,
const u8 in,
size_t  inlen,
u8 out,
size_t *  outlen 
)

crypto_public_key_encrypt_pkcs1_v15 - Public key encryption (PKCS #1 v1.5) : Public key : Plaintext buffer : Length of plaintext buffer in bytes : Output buffer for encrypted data : Length of output buffer in bytes; set to used length on success Returns: 0 on success, -1 on failure

This function is only used with internal TLSv1 implementation (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need to implement this.

Definition at line 581 of file crypto_libtomcrypt.c.

void crypto_public_key_free ( struct crypto_public_key key  ) 

crypto_public_key_free - Free public key : Public key

This function is only used with internal TLSv1 implementation (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need to implement this.

Definition at line 599 of file crypto_libtomcrypt.c.

struct crypto_public_key* crypto_public_key_from_cert ( const u8 buf,
size_t  len 
) [read]

crypto_public_key_from_cert - Import an RSA public key from a certificate : DER encoded X.509 certificate : Certificate buffer length in bytes Returns: Pointer to public key or NULL on failure

This function can just return NULL if the crypto library does not support X.509 parsing. In that case, internal code will be used to parse the certificate and public key is imported using crypto_public_key_import().

This function is only used with internal TLSv1 implementation (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need to implement this.

Definition at line 484 of file crypto_libtomcrypt.c.

struct crypto_public_key* crypto_public_key_import ( const u8 key,
size_t  len 
) [read]

crypto_public_key_import - Import an RSA public key : Key buffer (DER encoded RSA public key) : Key buffer length in bytes Returns: Pointer to the public key or NULL on failure

This function can just return NULL if the crypto library supports X.509 parsing. In that case, crypto_public_key_from_cert() is used to import the public key from a certificate.

This function is only used with internal TLSv1 implementation (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need to implement this.

Definition at line 422 of file crypto_libtomcrypt.c.

static int crypto_rsa_encrypt_pkcs1 ( int  block_type,
rsa_key *  key,
int  key_type,
const u8 in,
size_t  inlen,
u8 out,
size_t *  outlen 
) [static]

Definition at line 555 of file crypto_libtomcrypt.c.

void des_encrypt ( const u8 clear,
const u8 key,
u8 cypher 
)

des_encrypt - Encrypt one block with DES : 8 octets (in) : 7 octets (in) (no parity bits included) : 8 octets (out)

Definition at line 44 of file crypto_libtomcrypt.c.

int md4_vector ( size_t  num_elem,
const u8 addr[],
const size_t *  len,
u8 mac 
)

md4_vector - MD4 hash for data vector : Number of elements in the data vector : Pointers to the data areas : Lengths of the data blocks : Buffer for the hash Returns: 0 on success, -1 on failure

Definition at line 31 of file crypto_libtomcrypt.c.

int md5_vector ( size_t  num_elem,
const u8 addr[],
const size_t *  len,
u8 mac 
)

md5_vector - MD5 hash for data vector : Number of elements in the data vector : Pointers to the data areas : Lengths of the data blocks : Buffer for the hash Returns: 0 on success, -1 on failure

Definition at line 65 of file crypto_libtomcrypt.c.

static int pkcs1_generate_encryption_block ( u8  block_type,
size_t  modlen,
const u8 in,
size_t  inlen,
u8 out,
size_t *  outlen 
) [static]

Definition at line 492 of file crypto_libtomcrypt.c.

int sha1_vector ( size_t  num_elem,
const u8 addr[],
const size_t *  len,
u8 mac 
)

sha1_vector - SHA-1 hash for data vector : Number of elements in the data vector : Pointers to the data areas : Lengths of the data blocks : Buffer for the hash Returns: 0 on success, -1 on failure

Definition at line 78 of file crypto_libtomcrypt.c.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines


wpa_supplicant
Author(s): Package maintained by Blaise Gassend
autogenerated on Fri Jan 11 10:04:15 2013