ekg2
 All Struktury Danych Pliki Funkcje Zmienne Definicje typów Wyliczenia Wartości wyliczeń Definicje Grupay Strony
simlite.h
Idź do dokumentacji tego pliku.
1 /* $Id$ */
2 
3 /*
4  * (C) Copyright 2003 Wojtek Kaniewski <wojtekka@irc.pl>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License Version
8  * 2.1 as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 
20 #ifndef __SIMLITE_H
21 #define __SIMLITE_H
22 
23 #ifndef __AC_STDINT_H
24 #include <stdint.h>
25 #endif
26 
27 extern char *sim_key_path;
28 extern int sim_errno;
29 
30 typedef enum {
31  SIM_ERROR_SUCCESS, /* udało się */
32  SIM_ERROR_PUBLIC, /* błąd klucza publicznego */
33  SIM_ERROR_PRIVATE, /* błąd klucza prywatnego */
34  SIM_ERROR_RSA, /* nie udało się odszyfrować RSA */
35  SIM_ERROR_BF, /* nie udało się odszyfrować BF */
36  SIM_ERROR_RAND, /* entropia poszła na piwo */
37  SIM_ERROR_MEMORY, /* brak pamięci */
38  SIM_ERROR_INVALID, /* niewłaściwa wiadomość (za krótka) */
39  SIM_ERROR_MAGIC /* niewłaściwy magic */
40 } sim_errno_t;
41 
42 #define SIM_MAGIC_V1 0x2391
43 #define SIM_MAGIC_V1_BE 0x9123
44 
45 typedef struct {
46  unsigned char init[8];
47  uint16_t magic;
48  uint8_t flags;
49 }
50 #ifdef __GNUC__
51 __attribute__ ((packed))
52 #endif
54 
55 char *sim_message_decrypt(const unsigned char *message, const char *uid);
56 char *sim_message_encrypt(const unsigned char *message, const char *uid);
57 int sim_key_generate(const char *uid);
58 char *sim_key_fingerprint(const char *uid);
59 
60 const char *sim_strerror(int error);
61 
62 #endif /* __SIMLITE_H */
63 
64 /*
65  * Local Variables:
66  * mode: c
67  * c-file-style: "k&r"
68  * c-basic-offset: 8
69  * indent-tabs-mode: t
70  * End:
71  */