ekg2
|
00001 /* $Id$ */ 00002 00003 /* 00004 * (C) Copyright 2003 Wojtek Kaniewski <wojtekka@irc.pl> 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU Lesser General Public License Version 00008 * 2.1 as published by the Free Software Foundation. 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 Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #ifndef __SIMLITE_H 00021 #define __SIMLITE_H 00022 00023 #ifndef __AC_STDINT_H 00024 #include <stdint.h> 00025 #endif 00026 00027 extern char *sim_key_path; 00028 extern int sim_errno; 00029 00030 typedef enum { 00031 SIM_ERROR_SUCCESS, /* udało się */ 00032 SIM_ERROR_PUBLIC, /* błąd klucza publicznego */ 00033 SIM_ERROR_PRIVATE, /* błąd klucza prywatnego */ 00034 SIM_ERROR_RSA, /* nie udało się odszyfrować RSA */ 00035 SIM_ERROR_BF, /* nie udało się odszyfrować BF */ 00036 SIM_ERROR_RAND, /* entropia poszła na piwo */ 00037 SIM_ERROR_MEMORY, /* brak pamięci */ 00038 SIM_ERROR_INVALID, /* niewłaściwa wiadomość (za krótka) */ 00039 SIM_ERROR_MAGIC /* niewłaściwy magic */ 00040 } sim_errno_t; 00041 00042 #define SIM_MAGIC_V1 0x2391 00043 #define SIM_MAGIC_V1_BE 0x9123 00044 00045 typedef struct { 00046 unsigned char init[8]; 00047 uint16_t magic; 00048 uint8_t flags; 00049 } 00050 #ifdef __GNUC__ 00051 __attribute__ ((packed)) 00052 #endif 00053 sim_message_header; 00054 00055 char *sim_message_decrypt(const unsigned char *message, const char *uid); 00056 char *sim_message_encrypt(const unsigned char *message, const char *uid); 00057 int sim_key_generate(const char *uid); 00058 char *sim_key_fingerprint(const char *uid); 00059 00060 const char *sim_strerror(int error); 00061 00062 #endif /* __SIMLITE_H */ 00063 00064 /* 00065 * Local Variables: 00066 * mode: c 00067 * c-file-style: "k&r" 00068 * c-basic-offset: 8 00069 * indent-tabs-mode: t 00070 * End: 00071 */