Rizin
unix-like reverse engineering framework and cli tools
crypto_serpent_algo.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2017 NicsTr <nicolas.bordes@grenoble-inp.org>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #ifndef CRYPTO_SERPENT_ALGO_H
5 #define CRYPTO_SERPENT_ALGO_H
6 
7 #include <rz_crypto.h>
8 #include <rz_util.h>
9 #define DW_BY_BLOCK 4
10 #define DW_BY_USERKEY 8
11 #define NB_ROUNDS 32
12 #define NB_SUBKEYS 33
13 #define NIBBLES_BY_SUBKEY 32
14 
15 typedef struct serpent_state {
16  ut32 key[8];
17  int key_size;
19 
20 /*
21  * st: A pointer to a serpent_state structure containing the key and the key size.
22  * in: A block of data to be encrypted.
23  * out: When the function returns, the block of data encrypted by serpent
24  * with the key contained in st.
25  */
27 
28 /*
29  * st: A pointer to a serpent_state structure containing the key and the key size.
30  * in: A block of data to be decrypted.
31  * out: When the function returns, the block of data decrypted by serpent
32  * with the key contained in st.
33  */
35 
36 /*
37  * st: A serpent_state structure containing the key and the key size.
38  * subkeys: When the function returns, an array of double words containings
39  * all the subkeys needed for the encryptio/dcryption with serpent.
40  */
42 
43 #endif
const lzma_allocator const uint8_t * in
Definition: block.h:527
const lzma_allocator const uint8_t size_t uint8_t * out
Definition: block.h:528
#define NB_SUBKEYS
void serpent_keyschedule(const serpent_state_t *st, ut32 subkeys[NB_SUBKEYS *DW_BY_BLOCK])
void serpent_decrypt(serpent_state_t *st, ut32 in[DW_BY_BLOCK], ut32 out[DW_BY_BLOCK])
#define DW_BY_BLOCK
struct serpent_state serpent_state_t
void serpent_encrypt(serpent_state_t *st, ut32 in[DW_BY_BLOCK], ut32 out[DW_BY_BLOCK])
uint32_t ut32