Main Page   Data Structures   File List   Data Fields   Globals   Related Pages  

crypt.h

Go to the documentation of this file.
00001 /*
00002     Simple Operating System for Smartcard Education
00003     Copyright (C) 2002  Matthias Bruestle <m@mbsks.franken.de>
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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 /* TEA */
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 /* SKIPJACK */
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 /* NEWDES-SK */
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 /* SOSSE_CRYPT_H */
00080 

Copyright 2002 by Matthias Bruestle. This is licensed under the GNU General Public License.