#include "includes.h"
#include <openssl/opensslv.h>
#include <openssl/err.h>
#include <openssl/des.h>
#include <openssl/aes.h>
#include <openssl/bn.h>
#include <openssl/evp.h>
#include <openssl/dh.h>
#include "common.h"
#include "wpabuf.h"
#include "dh_group5.h"
#include "crypto.h"
Go to the source code of this file.
Classes | |
struct | crypto_cipher |
Defines | |
#define | DES_cblock des_cblock |
#define | DES_ecb_encrypt(input, output, ks, enc) des_ecb_encrypt((input), (output), *(ks), (enc)) |
#define | DES_key_schedule des_key_schedule |
#define | DES_set_key(key, schedule) des_set_key((key), *(schedule)) |
#define | NO_SHA256_WRAPPER |
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_cipher * | crypto_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) |
struct wpabuf * | dh5_derive_shared (void *ctx, const struct wpabuf *peer_public, const struct wpabuf *own_private) |
void | dh5_free (void *ctx) |
void * | dh5_init (struct wpabuf **priv, struct wpabuf **publ) |
static BIGNUM * | get_group5_prime (void) |
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 | openssl_digest_vector (const EVP_MD *type, int non_fips, 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) |
#define DES_cblock des_cblock |
Definition at line 31 of file crypto_openssl.c.
#define DES_ecb_encrypt | ( | input, | |||
output, | |||||
ks, | |||||
enc | ) | des_ecb_encrypt((input), (output), *(ks), (enc)) |
Definition at line 33 of file crypto_openssl.c.
#define DES_key_schedule des_key_schedule |
Definition at line 30 of file crypto_openssl.c.
#define DES_set_key | ( | key, | |||
schedule | ) | des_set_key((key), *(schedule)) |
Definition at line 32 of file crypto_openssl.c.
#define NO_SHA256_WRAPPER |
Definition at line 67 of file crypto_openssl.c.
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 250 of file crypto_openssl.c.
void aes_decrypt_deinit | ( | void * | ctx | ) |
aes_decrypt_deinit - Deinitialize AES decryption : Context pointer from aes_encrypt_init()
Definition at line 256 of file crypto_openssl.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 236 of file crypto_openssl.c.
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 224 of file crypto_openssl.c.
void aes_encrypt_deinit | ( | void * | ctx | ) |
aes_encrypt_deinit - Deinitialize AES encryption : Context pointer from aes_encrypt_init()
Definition at line 230 of file crypto_openssl.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 210 of file crypto_openssl.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 394 of file crypto_openssl.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_openssl.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 384 of file crypto_openssl.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 306 of file crypto_openssl.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
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 262 of file crypto_openssl.c.
des_encrypt - Encrypt one block with DES : 8 octets (in) : 7 octets (in) (no parity bits included) : 8 octets (out)
Definition at line 121 of file crypto_openssl.c.
struct wpabuf* dh5_derive_shared | ( | void * | ctx, | |
const struct wpabuf * | peer_public, | |||
const struct wpabuf * | own_private | |||
) | [read] |
Definition at line 461 of file crypto_openssl.c.
void dh5_free | ( | void * | ctx | ) |
Definition at line 498 of file crypto_openssl.c.
Definition at line 413 of file crypto_openssl.c.
static BIGNUM* get_group5_prime | ( | void | ) | [static] |
Definition at line 37 of file crypto_openssl.c.
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 115 of file crypto_openssl.c.
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 179 of file crypto_openssl.c.
static int openssl_digest_vector | ( | const EVP_MD * | type, | |
int | non_fips, | |||
size_t | num_elem, | |||
const u8 * | addr[], | |||
const size_t * | len, | |||
u8 * | mac | |||
) | [static] |
Definition at line 77 of file crypto_openssl.c.
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 142 of file crypto_openssl.c.
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 194 of file crypto_openssl.c.