wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Data Structures | Functions
crypto_internal-cipher.c File Reference

Crypto wrapper for internal crypto implementation - Cipher wrappers. More...

#include "includes.h"
#include "common.h"
#include "crypto.h"
#include "aes.h"
#include "des_i.h"

Data Structures

struct  crypto_cipher
 

Functions

struct crypto_ciphercrypto_cipher_init (enum crypto_cipher_alg alg, const u8 *iv, const u8 *key, size_t key_len)
 Initialize block/stream cipher function. More...
 
int crypto_cipher_encrypt (struct crypto_cipher *ctx, const u8 *plain, u8 *crypt, size_t len)
 Cipher encrypt. More...
 
int crypto_cipher_decrypt (struct crypto_cipher *ctx, const u8 *crypt, u8 *plain, size_t len)
 Cipher decrypt. More...
 
void crypto_cipher_deinit (struct crypto_cipher *ctx)
 Free cipher context. More...
 

Detailed Description

Crypto wrapper for internal crypto implementation - Cipher wrappers.

Function Documentation

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

Cipher decrypt.

Parameters
ctxContext pointer from crypto_cipher_init()
cryptCiphertext to decrypt
plainResulting plaintext
lenLength 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.

void crypto_cipher_deinit ( struct crypto_cipher ctx)

Free cipher context.

Parameters
ctxContext 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.

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

Cipher encrypt.

Parameters
ctxContext pointer from crypto_cipher_init()
plainPlaintext to cipher
cryptResulting ciphertext
lenLength 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.

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

Initialize block/stream cipher function.

Parameters
algCipher algorithm
ivInitialization vector for block ciphers or NULL for stream ciphers
keyCipher key
key_lenLength 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.