-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrabbit.h
59 lines (48 loc) · 1.23 KB
/
rabbit.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef __rabbit_h__
#define __rabbit_h__
/* Data structures */
#if !defined(ECRYPT_ctx_defined)
#define ECRYPT_ctx_defined
/*
* ECRYPT_ctx is the structure containing the representation of the
* internal state of your cipher.
*/
typedef struct
{
u32 x[8];
u32 c[8];
u32 carry;
} RABBIT_ctx;
typedef struct
{
/*
* Put here all state variable needed during the encryption process.
*/
RABBIT_ctx master_ctx;
RABBIT_ctx work_ctx;
} ECRYPT_ctx;
/*
* Key setup. It is the user's responsibility to select the values of
* keysize and ivsize from the set of supported values specified
* above.
*/
void ECRYPT_keysetup(
ECRYPT_ctx* ctx,
const u8* key,
u32 keysize, /* Key size in bits. */
u32 ivsize); /* IV size in bits. */
/*
* IV setup. After having called ECRYPT_keysetup(), the user is
* allowed to call ECRYPT_ivsetup() different times in order to
* encrypt/decrypt different messages with the same key but different
* IV's.
*/
void ECRYPT_ivsetup(
ECRYPT_ctx* ctx,
const u8* iv);
void ECRYPT_keystream_bytes(
ECRYPT_ctx* ctx,
u8* keystream,
u32 length); /* Length of keystream in bytes. */
#endif // ECRYPT_ctx_defined
#endif // __rabbit_h__