00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00026 #ifndef SOSSE_CRYPT_H
00027 #define SOSSE_CRYPT_H
00028
00029 #include <config.h>
00030
00031 #include <sw.h>
00032 #include <string.h>
00033 #include <types.h>
00034
00035 #define CRYPT_ALGO_TEA 0
00036 #define CRYPT_ALGO_SKIPJACK 1
00037 #define CRYPT_ALGO_NEWDESSK 2
00038
00039 #if CONF_CRYPT_ALGO==0
00040
00041 #include <tea.h>
00043 #define CRYPT_KEY_LEN TEA_KEY_LEN
00044
00045 #define CRYPT_BLOCK_LEN TEA_BLOCK_LEN
00046
00047 #define crypt_enc(v,k) tea_enc((iu32*)(v),(iu32*)(k))
00048
00049 #define crypt_dec(v,k) tea_dec((iu32*)(v),(iu32*)(k))
00050
00051 #elif CONF_CRYPT_ALGO==1
00052
00053 #include <skipjack.h>
00055 #define CRYPT_KEY_LEN SKIPJACK_KEY_LEN
00056
00057 #define CRYPT_BLOCK_LEN SKIPJACK_BLOCK_LEN
00058
00059 #define crypt_enc(v,k) skipjack_enc((iu8*)(v),(iu8*)(k))
00060
00061 #define crypt_dec(v,k) skipjack_dec((iu8*)(v),(iu8*)(k))
00062
00063 #elif CONF_CRYPT_ALGO==2
00064
00065 #include <newdes-sk.h>
00067 #define CRYPT_KEY_LEN NEWDESSK_KEY_LEN
00068
00069 #define CRYPT_BLOCK_LEN NEWDESSK_BLOCK_LEN
00070
00071 #define crypt_enc(v,k) newdessk_enc((iu8*)(v),(iu8*)(k))
00072
00073 #define crypt_dec(v,k) newdessk_dec((iu8*)(v),(iu8*)(k))
00074
00075 #else
00076 #error No valid crypto algorithm selected.
00077 #endif
00078
00079 #endif
00080