radare2/libr/crypto/p/crypto_serpent_algo.h
pancake da3db59a22
Remove some exit() calls in libr ##api (#18565)
Co-authored-by: Anton Kochkov <xvilka@gmail.com>
2021-04-11 02:34:23 +02:00

39 lines
1.1 KiB
C

#ifndef CRYPTO_SERPENT_ALGO_H
#define CRYPTO_SERPENT_ALGO_H
#include <r_crypto.h>
#define DW_BY_BLOCK 4
#define DW_BY_USERKEY 8
#define NB_ROUNDS 32
#define NB_SUBKEYS 33
#define NIBBLES_BY_SUBKEY 32
struct serpent_state {
ut32 key[8];
int key_size;
};
/*
* st: A pointer to a serpent_state structure containing the key and the key size.
* in: A block of data to be encrypted.
* out: When the function returns, the block of data encrypted by serpent
* with the key contained in st.
*/
void serpent_encrypt(struct serpent_state *st, ut32 in[DW_BY_BLOCK], ut32 out[DW_BY_BLOCK]);
/*
* st: A pointer to a serpent_state structure containing the key and the key size.
* in: A block of data to be decrypted.
* out: When the function returns, the block of data decrypted by serpent
* with the key contained in st.
*/
void serpent_decrypt(struct serpent_state *st, ut32 in[DW_BY_BLOCK], ut32 out[DW_BY_BLOCK]);
/*
* st: A serpent_state structure containing the key and the key size.
* subkeys: When the function returns, an array of double words containings
* all the subkeys needed for the encryptio/dcryption with serpent.
*/
#endif