Teonet library  0.4.7
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
crypt.h
Go to the documentation of this file.
1 
8 #ifndef CRYPT_H
9 #define CRYPT_H
10 
11 #define BLOCK_SIZE 16
12 #define KEY_SIZE 32
13 
17 typedef struct ksnCryptClass {
18 
19  unsigned char iv[BLOCK_SIZE+1];
20  unsigned char *key;
21  int key_len;
22  int blocksize;
23  void *ke;
24 
26 
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
34 void *ksnEncryptPackage(ksnCryptClass *kcr, void *package,
35  size_t package_len, void *buffer, size_t *encrypt_len);
36 void *ksnDecryptPackage(ksnCryptClass *kcr, void* package,
37  size_t package_len, size_t *decrypt_len);
38 int ksnCheckEncrypted(void *package, size_t package_len);
39 
40 
41 #ifdef __cplusplus
42 }
43 #endif
44 
45 #endif /* CRYPT_H */
46 
void * ksnDecryptPackage(ksnCryptClass *kcr, void *package, size_t package_len, size_t *decrypt_len)
Decrypt received package.
Definition: crypt.c:278
struct ksnCryptClass ksnCryptClass
ksnetCrypt Class data
int key_len
Definition: crypt.h:21
ksnetCrypt Class data
Definition: crypt.h:17
int ksnCheckEncrypted(void *package, size_t package_len)
Simple check if the packet is encrypted.
Definition: crypt.c:323
unsigned char * key
Definition: crypt.h:20
#define ke
int blocksize
Definition: crypt.h:22
ksnCryptClass * ksnCryptInit(void *ke)
Module initialize.
Definition: crypt.c:30
#define BLOCK_SIZE
File: crypt.h Author: Kirill Scherba kirill@scherba.ru
Definition: crypt.h:11
void ksnCryptDestroy(ksnCryptClass *kcr)
Module destroy.
Definition: crypt.c:78
void * ksnEncryptPackage(ksnCryptClass *kcr, void *package, size_t package_len, void *buffer, size_t *encrypt_len)
Encrypt KSNet package.
Definition: crypt.c:232
void * ke
Definition: crypt.h:23
unsigned char iv[BLOCK_SIZE+1]
Definition: crypt.h:19