ecb.h¶
Electronic code book mode of operation for block ciphers.
-
int
cipher_encrypt_ecb
(cipher_t * cipher, uint8_t * input,msp430_types.h::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
cipher: Already initialized cipher struct input: pointer to input data to encrypt length: length of the input data output: pointer to allocated memory for encrypted data. It has to be of size data_len + BLOCK_SIZE - data_len % BLOCK_SIZE. Return values
- Length of encrypted data on a successful encryption
- A negative error code if something went wrong
-
int
cipher_decrypt_ecb
(cipher_t * cipher, uint8_t * input,msp430_types.h::size_t
length, uint8_t * output)¶ Decrypts data of arbitrary length in ecb mode.
Parameters
cipher: Already initialized cipher struct input: pointer to input data to decrypt length: length of the input data output: pointer to allocated memory for plaintext data. It has to be of size lengh
.Return values
- Length of decrypted data on a successful decryption
- A negative error code if something went wrong