Main Page   Data Structures   File List   Data Fields   Globals   Related Pages  

config.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_CONFIG_H
00027 #define SOSSE_CONFIG_H
00028 
00029 /* Configuration defines */
00030 
00033 #define CONF_IODATA_SIZE        256
00034 
00040 #define CONF_WITH_FILESYSTEM    1
00041 
00044 #define CONF_WITH_RECORD_FILES  0
00045 
00048 #define CONF_WITH_TRANSACTIONS  1
00049 
00054 #define CONF_WITH_TESTCMDS      1
00055 
00058 #define CONF_WITH_DELETECMD     1
00059 
00062 #define CONF_WITH_CREATECMD     1
00063 
00069 #define CONF_WITH_PINAUTH       1
00070 
00075 #define CONF_WITH_PINCMDS       1
00076 
00082 #define CONF_WITH_KEYAUTH       1
00083 
00089 #define CONF_WITH_KEYCMDS       1
00090 
00093 #define CONF_WITH_I2CEEPROM     1
00094 
00100 #define CONF_WITH_DECRYPT       1
00101 
00106 #define CONF_WITH_LOGGING       1
00107 
00113 #define CONF_WITH_RETCODEMGR    0
00114 
00119 #define CONF_WITH_FUNNY         0
00120 
00126 #define CONF_WITH_TRNG          0
00127 
00134 #define CONF_WITH_CRYPT_ALGO    0   /* TEA */
00135 //#define CONF_WITH_CRYPT_ALGO  1   /* Skipjack */
00136 //#define CONF_WITH_CRYPT_ALGO  2   /* NEWDES-SK */
00137 
00138 /* Verify dependencies */
00139 
00140 /* CONF_WITH_PINAUTH is required for CONF_WITH_PINCMDS */
00141 #if (CONF_WITH_PINCMDS==1) && (CONF_WITH_PINAUTH!=1)
00142 #undef CONF_WITH_PINAUTH
00143 #define CONF_WITH_PINAUTH       1
00144 #endif
00145 
00146 /* CONF_WITH_PINAUTH is required for CONF_WITH_PINCMDS */
00147 #if (CONF_WITH_PINCMDS==1) && (CONF_WITH_PINAUTH!=1)
00148 #undef CONF_WITH_PINAUTH
00149 #define CONF_WITH_PINAUTH       1
00150 #endif
00151 
00152 /* If we do not have a file system, we dom't need CREATE and DELETE */
00153 #if (CONF_WITH_FILESYSTEM!=1) && (CONF_WITH_DELETECMD==1)
00154 #undef CONF_WITH_DELETECMD
00155 #define CONF_WITH_DELETECMD     0
00156 #endif
00157 #if (CONF_WITH_FILESYSTEM!=1) && (CONF_WITH_CREATECMD==1)
00158 #undef CONF_WITH_CREATECMD
00159 #define CONF_WITH_CREATECMD     0
00160 #endif
00161 
00162 /* CONF_WITH_KEYAUTH is required for CONF_WITH_KEYCMDS */
00163 #if (CONF_WITH_KEYCMDS==1) && (CONF_WITH_KEYAUTH!=1)
00164 #undef CONF_WITH_KEYAUTH
00165 #define CONF_WITH_KEYAUTH       1
00166 #endif
00167 
00168 /* EEPROM addresses */
00169 
00177 #define CARD_STATE_ADDR     0x0000
00178 
00180 #define ATR_LEN_ADDR        (CARD_STATE_ADDR+1)
00181 
00182 #define ATR_MAXLEN          28
00183 
00184 #define ATR_ADDR            (ATR_LEN_ADDR+1)
00185 
00187 #define SERNUM_ADDR         (ATR_ADDR+ATR_MAXLEN)
00188 
00189 #define SERNUM_LEN          8
00190 
00192 #define RAND_STATE_ADDR     (SERNUM_ADDR+SERNUM_LEN)
00193 
00194 #define RAND_STATE_LEN      8+8+16
00195 
00197 #define TRANSAC_STATE_ADDR  (RAND_STATE_ADDR+RAND_STATE_LEN)
00198 
00199 #define TRANSAC_DATA_ADDR   (TRANSAC_STATE_ADDR+1)
00200 
00201 #define TRANSAC_DATA_LEN    19  /* Currently 2B addr, 1B len, 16B data */
00202 
00204 #define ADM_KEY_LEN         16
00205 
00206 #define INT_KEY_LEN         16
00207 
00208 #define PIN_LEN             8
00209 
00210 #define PUK_LEN             8
00211 
00212 #if CONF_WITH_FILESYSTEM==1
00213 
00214 #define DATA_END_1          (TRANSAC_DATA_ADDR+TRANSAC_DATA_LEN)
00215 #else /* CONF_WITH_FILESYSTEM!=1 */
00216 
00217 #define ADM_KEY_ADDR        (TRANSAC_DATA_ADDR+TRANSAC_DATA_LEN)
00218 
00219 #define ADM_RETCNTR_ADDR    (ADM_KEY_ADDR+ADM_KEY_LEN)
00220 
00222 #define INT_KEY_ADDR        (ADM_RETCNTR_ADDR+1)
00223 
00224 #define INT_RETCNTR_ADDR    (INT_KEY_ADDR+INT_KEY_LEN)
00225 
00227 #define PIN_ADDR            (INT_RETCNTR_ADDR+1)
00228 
00229 #define PIN_RETCNTR_ADDR    (PIN_ADDR+PIN_LEN)
00230 
00231 #define PUK_ADDR            (PIN_RETCNTR_ADDR+1)
00232 
00233 #define PUK_RETCNTR_ADDR    (PUK_ADDR+PUK_LEN)
00234 
00236 #define DATA_END_1          (PUK_RETCNTR_ADDR+1)
00237 #endif /* CONF_WITH_FILESYSTEM!=1 */
00238 
00240 #define FS_START_PTR_ADDR   DATA_END_1
00241 
00242 #if defined(__AVR_AT90S8515__)
00243 
00244 #define ENDIAN_LITTLE
00245 
00246 #define EEPROM_SIZE         0x200
00247 
00248 #define RAM_SIZE            0x200
00249 
00250 #define CHIP                0x01
00251 
00252 #define ESIZ                0x03
00253 
00254 #define ARCH                avr2
00255 #elif defined(__AVR_AT90S8535__)
00256 
00257 #define ENDIAN_LITTLE
00258 
00259 #define EEPROM_SIZE         0x200
00260 
00261 #define RAM_SIZE            0x200
00262 
00263 #define CHIP                0x01
00264 
00265 #define ESIZ                0x03
00266 
00267 #define ARCH                avr2
00268 #elif defined(__AVR_AT90S2323__)
00269 
00270 #define ENDIAN_LITTLE
00271 
00272 #define EEPROM_SIZE         0x80
00273 
00274 #define RAM_SIZE            0x80
00275 
00276 #define CHIP                0x00
00277 
00278 #define ESIZ                0x03
00279 
00280 #define ARCH                avr2
00281 #elif defined(__AVR_ATmega161__)
00282 
00283 #define ENDIAN_LITTLE
00284 
00285 #define EEPROM_SIZE         0x200
00286 
00287 #define RAM_SIZE            0x400
00288 
00289 #define CHIP                0x02
00290 
00291 #define ESIZ                0x03
00292 
00293 #define ARCH                avr5
00294 #elif defined(__AVR_ATmega163__)
00295 
00296 #define ENDIAN_LITTLE
00297 
00298 #define EEPROM_SIZE         0x200
00299 
00300 #define RAM_SIZE            0x400
00301 
00302 #define CHIP                0x02
00303 
00304 #define ESIZ                0x03
00305 
00306 #define ARCH                avr5
00307 #elif defined(__i386__)
00308 
00309 #define ENDIAN_LITTLE
00310 
00311 #define EEPROM_SIZE         0x200
00312 
00313 #define RAM_SIZE            0x200
00314 
00315 #define CHIP                0xFF
00316 
00317 #define ESIZ                0xFF
00318 #else
00319 #error Unknown destination platform.
00320 #endif
00321 
00322 #endif /* SOSSE_CONFIG_H */
00323 

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