Teonet library
0.4.7
|
Go to the source code of this file.
Data Structures | |
struct | ksnCryptClass |
ksnetCrypt Class data More... | |
Macros | |
#define | BLOCK_SIZE 16 |
File: crypt.h Author: Kirill Scherba kiril l@sc herba .ruMore... | |
#define | KEY_SIZE 32 |
Typedefs | |
typedef struct ksnCryptClass | ksnCryptClass |
ksnetCrypt Class data More... | |
Functions | |
ksnCryptClass * | ksnCryptInit (void *ke) |
Module initialize. More... | |
void | ksnCryptDestroy (ksnCryptClass *kcr) |
Module destroy. More... | |
void * | ksnEncryptPackage (ksnCryptClass *kcr, void *package, size_t package_len, void *buffer, size_t *encrypt_len) |
Encrypt KSNet package. More... | |
void * | ksnDecryptPackage (ksnCryptClass *kcr, void *package, size_t package_len, size_t *decrypt_len) |
Decrypt received package. More... | |
int | ksnCheckEncrypted (void *package, size_t package_len) |
Simple check if the packet is encrypted. More... | |
#define BLOCK_SIZE 16 |
File: crypt.h Author: Kirill Scherba kiril l@sc herba .ru
Created on July 14, 2015, 4:04 PM
Referenced by ksnCheckEncrypted(), and ksnCryptInit().
#define KEY_SIZE 32 |
Referenced by ksnCryptInit().
typedef struct ksnCryptClass ksnCryptClass |
ksnetCrypt Class data
int ksnCheckEncrypted | ( | void * | package, |
size_t | package_len | ||
) |
Simple check if the packet is encrypted.
package | Pointer to package |
package_len | Package length |
References BLOCK_SIZE.
Referenced by ksnCoreProcessPacket(), and trudp_send_event_ack_to_app().
void ksnCryptDestroy | ( | ksnCryptClass * | kcr | ) |
Module destroy.
kcr |
References free(), ksnCryptClass::key, and num_crypt_module.
Referenced by ksnCoreDestroy(), test_1_1(), and test_1_2().
ksnCryptClass* ksnCryptInit | ( | void * | ke | ) |
Module initialize.
References BLOCK_SIZE, ksnCryptClass::blocksize, ksnCryptClass::iv, ksnCryptClass::ke, ke, kev, ksnCryptClass::key, ksnCryptClass::key_len, KEY_SIZE, malloc(), and num_crypt_module.
Referenced by ksnCoreInit(), test_1_1(), and test_1_2().
void* ksnDecryptPackage | ( | ksnCryptClass * | kcr, |
void * | package, | ||
size_t | package_len, | ||
size_t * | decrypt_len | ||
) |
Decrypt received package.
kcr | Pointer to ksnetCryptClass object | |
package | Pointer to received package data | |
package_len | Package data length | |
[out] | decrypt_len | Decrypted length of package data |
References _decrypt(), DEBUG_VV, free(), ksnCryptClass::iv, ksnCryptClass::ke, ksnCryptClass::key, ksn_printf, malloc(), and MODULE.
Referenced by ksnCoreProcessPacket(), and trudp_send_event_ack_to_app().
void* ksnEncryptPackage | ( | ksnCryptClass * | kcr, |
void * | package, | ||
size_t | package_len, | ||
void * | buffer, | ||
size_t * | encrypt_len | ||
) |
Encrypt KSNet package.
kcr | Pointer to ksnetCryptClass object | |
package | Package to send | |
package_len | Package length | |
buffer | Buffer to encrypt, enough to hold encrypted data (package_len + 16) | |
[out] | encrypt_len | Length of encrypted data |
References _encrypt(), ksnCryptClass::blocksize, DEBUG_VV, ksnCryptClass::iv, ksnCryptClass::ke, ksnCryptClass::key, ksn_printf, malloc(), and MODULE.
Referenced by test_1_2().