ecb.h File Reference

Electronic code book mode of operation for block ciphers. More...

Detailed Description

Electronic code book mode of operation for block ciphers.

Author
Freie Universitaet Berlin, Computer Systems & Telematics
Nico von Geyso nico..nosp@m.geys.nosp@m.o@fu-.nosp@m.berl.nosp@m.in.de

Definition in file ecb.h.

#include "crypto/ciphers.h"
+ Include dependency graph for ecb.h:

Go to the source code of this file.

int cipher_encrypt_ecb (const cipher_t *cipher, const uint8_t *input, size_t length, uint8_t *output)
 Encrypt data of arbitrary length in ecb mode. More...
 
int cipher_decrypt_ecb (const cipher_t *cipher, const uint8_t *input, size_t length, uint8_t *output)
 Decrypts data of arbitrary length in ecb mode. More...
 

Function Documentation

◆ cipher_decrypt_ecb()

int cipher_decrypt_ecb ( const cipher_t cipher,
const uint8_t *  input,
size_t  length,
uint8_t *  output 
)

Decrypts data of arbitrary length in ecb mode.

Parameters
cipherAlready initialized cipher struct
inputpointer to input data to decrypt
lengthlength of the input data
outputpointer to allocated memory for plaintext data. It has to be of size lengh.
Returns
Length of decrypted data on a successful decryption
A negative error code if something went wrong

◆ cipher_encrypt_ecb()

int cipher_encrypt_ecb ( const cipher_t cipher,
const uint8_t *  input,
size_t  length,
uint8_t *  output 
)

Encrypt data of arbitrary length in ecb mode.

Caution each identical block results in an identical encrypted block. Normally you do not want to use ECB.

Parameters
cipherAlready initialized cipher struct
inputpointer to input data to encrypt
lengthlength of the input data
outputpointer to allocated memory for encrypted data. It has to be of size data_len + BLOCK_SIZE - data_len % BLOCK_SIZE.
Returns
Length of encrypted data on a successful encryption
A negative error code if something went wrong