aboutsummaryrefslogtreecommitdiffstats
path: root/src/pluto/alg/ike_alg_twofish.c
blob: 38ba4adb233e60d1953b9f20afa299bc7244b922 (plain)
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
#include <stdio.h>
#include <string.h>
#include <stddef.h>
#include <sys/types.h>
#include <freeswan.h>

#include "constants.h"
#include "defs.h"
#include "log.h"
#include "libtwofish/twofish_cbc.h"
#include "alg_info.h"
#include "ike_alg.h"

#define  TWOFISH_KEY_MIN_LEN	128
#define  TWOFISH_KEY_DEF_LEN	128
#define  TWOFISH_KEY_MAX_LEN	256

struct encrypt_desc encrypt_desc_twofish = 
{
	algo_type: 	IKE_ALG_ENCRYPT,
	algo_id:   	OAKLEY_TWOFISH_CBC,
	algo_next: 	NULL,

	enc_blocksize:	TWOFISH_BLOCK_SIZE,
	keydeflen:		TWOFISH_KEY_MIN_LEN,
	keyminlen:		TWOFISH_KEY_DEF_LEN,
	keymaxlen:		TWOFISH_KEY_MAX_LEN,
	enc_testvectors: NULL
};

struct encrypt_desc encrypt_desc_twofish_ssh =
{
	algo_type: 	IKE_ALG_ENCRYPT,
	algo_id:   	OAKLEY_TWOFISH_CBC_SSH,
	algo_next: 	NULL,

	enc_blocksize:	TWOFISH_BLOCK_SIZE,
	keydeflen:		TWOFISH_KEY_MIN_LEN,
	keyminlen:		TWOFISH_KEY_DEF_LEN,
	keymaxlen:		TWOFISH_KEY_MAX_LEN,
	enc_testvectors: NULL
};

int ike_alg_twofish_init(void);

int
ike_alg_twofish_init(void)
{
    int ret = ike_alg_register_enc(&encrypt_desc_twofish);

    if (ike_alg_register_enc(&encrypt_desc_twofish_ssh) < 0)
	plog("ike_alg_twofish_init(): Experimental OAKLEY_TWOFISH_CBC_SSH activation failed");

    return ret;
}
/*
IKE_ALG_INIT_NAME: ike_alg_twofish_init
*/