Classes | Functions
crypto_nss.c File Reference
#include "includes.h"
#include <nspr/prtypes.h>
#include <nspr/plarenas.h>
#include <nspr/plhash.h>
#include <nspr/prtime.h>
#include <nspr/prinrval.h>
#include <nspr/prclist.h>
#include <nspr/prlock.h>
#include <nss/sechash.h>
#include <nss/pk11pub.h>
#include "common.h"
#include "crypto.h"
Include dependency graph for crypto_nss.c:

Go to the source code of this file.

Classes

struct  crypto_cipher

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)
int crypto_mod_exp (const u8 *base, size_t base_len, const u8 *power, size_t power_len, const u8 *modulus, size_t modulus_len, u8 *result, size_t *result_len)
void des_encrypt (const u8 *clear, const u8 *key, u8 *cypher)
int md5_vector (size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
static int nss_hash (HASH_HashType type, unsigned int max_res_len, size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
int rc4_skip (const u8 *key, size_t keylen, size_t skip, u8 *data, size_t data_len)
int sha1_vector (size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
int sha256_vector (size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)

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 166 of file crypto_nss.c.

void aes_decrypt_deinit ( void *  ctx)

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

Definition at line 171 of file crypto_nss.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 160 of file crypto_nss.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 150 of file crypto_nss.c.

void aes_encrypt_deinit ( void *  ctx)

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

Definition at line 155 of file crypto_nss.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 144 of file crypto_nss.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 204 of file crypto_nss.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 211 of file crypto_nss.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 197 of file crypto_nss.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 189 of file crypto_nss.c.

int crypto_mod_exp ( const u8 *  base,
size_t  base_len,
const u8 *  power,
size_t  power_len,
const u8 *  modulus,
size_t  modulus_len,
u8 *  result,
size_t *  result_len 
)

crypto_mod_exp - Modular exponentiation of large integers : Base integer (big endian byte array) : Length of base integer in bytes : Power integer (big endian byte array) : Length of power integer in bytes : Modulus integer (big endian byte array) : Length of modulus integer in bytes

Returns:
: Buffer for the result : Result length (max buffer size on input, real len on output) Returns: 0 on success, -1 on failure

This function calculates result = base ^ power mod modulus. modules_len is used as the maximum size of modulus buffer. It is set to the used size on success.

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 176 of file crypto_nss.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 52 of file crypto_nss.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 125 of file crypto_nss.c.

static int nss_hash ( HASH_HashType  type,
unsigned int  max_res_len,
size_t  num_elem,
const u8 *  addr[],
const size_t *  len,
u8 *  mac 
) [static]

Definition at line 30 of file crypto_nss.c.

int rc4_skip ( const u8 *  key,
size_t  keylen,
size_t  skip,
u8 *  data,
size_t  data_len 
)

rc4_skip - XOR RC4 stream to given data with skip-stream-start : RC4 key : RC4 key length number of bytes to skip from the beginning of the RC4 stream : data to be XOR'ed with RC4 stream : buf length Returns: 0 on success, -1 on failure

Generate RC4 pseudo random stream for the given key, skip beginning of the stream, and XOR the end result with the data buffer to perform RC4 encryption/decryption.

Definition at line 118 of file crypto_nss.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 131 of file crypto_nss.c.

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

sha256_vector - SHA256 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 137 of file crypto_nss.c.



wpa_supplicant
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Apr 24 2014 15:34:37