corosync
2.4.2
|
#include "config.h"
#include <nss.h>
#include <pk11pub.h>
#include <pkcs11.h>
#include <prerror.h>
#include <blapit.h>
#include <hasht.h>
#include <corosync/logsys.h>
#include <corosync/totem/totem.h>
#include "totemcrypto.h"
Go to the source code of this file.
Data Structures | |
struct | crypto_config_header |
struct | crypto_instance |
Macros | |
#define | LOGSYS_UTILS_ONLY 1 |
#define | SALT_SIZE 16 |
#define | AES_256_KEY_LENGTH 32 |
#define | AES_192_KEY_LENGTH 24 |
#define | AES_128_KEY_LENGTH 16 |
#define | log_printf(level, format, args...) |
Enumerations | |
enum | crypto_crypt_t { CRYPTO_CIPHER_TYPE_NONE = 0, CRYPTO_CIPHER_TYPE_AES256 = 1, CRYPTO_CIPHER_TYPE_AES192 = 2, CRYPTO_CIPHER_TYPE_AES128 = 3, CRYPTO_CIPHER_TYPE_3DES = 4, CRYPTO_CIPHER_TYPE_2_3 = UINT8_MAX - 1, CRYPTO_CIPHER_TYPE_2_2 = UINT8_MAX } |
enum | crypto_hash_t { CRYPTO_HASH_TYPE_NONE = 0, CRYPTO_HASH_TYPE_MD5 = 1, CRYPTO_HASH_TYPE_SHA1 = 2, CRYPTO_HASH_TYPE_SHA256 = 3, CRYPTO_HASH_TYPE_SHA384 = 4, CRYPTO_HASH_TYPE_SHA512 = 5, CRYPTO_HASH_TYPE_2_3 = UINT8_MAX - 1, CRYPTO_HASH_TYPE_2_2 = UINT8_MAX } |
Functions | |
struct crypto_config_header | __attribute__ ((packed)) |
size_t | crypto_sec_header_size (const char *crypto_cipher_type, const char *crypto_hash_type) |
size_t | crypto_get_current_sec_header_size (const struct crypto_instance *instance) |
int | crypto_encrypt_and_sign (struct crypto_instance *instance, const unsigned char *buf_in, const size_t buf_in_len, unsigned char *buf_out, size_t *buf_out_len) |
int | crypto_authenticate_and_decrypt (struct crypto_instance *instance, unsigned char *buf, int *buf_len) |
struct crypto_instance * | crypto_init (const unsigned char *private_key, unsigned int private_key_len, const char *crypto_cipher_type, const char *crypto_hash_type, void(*log_printf_func)(int level, int subsys, const char *function, const char *file, int line, const char *format,...) __attribute__((format(printf, 6, 7))), int log_level_security, int log_level_notice, int log_level_error, int log_subsys_id) |
Variables | |
uint8_t | crypto_cipher_type |
uint8_t | crypto_hash_type |
uint8_t | __pad0 |
uint8_t | __pad1 |
enum crypto_crypt_t | __attribute__ |
CK_MECHANISM_TYPE | cipher_to_nss [] |
size_t | cipher_key_len [] |
size_t | cypher_block_len [] |
CK_MECHANISM_TYPE | hash_to_nss [] |
size_t | hash_len [] |
size_t | hash_block_len [] |
#define AES_128_KEY_LENGTH 16 |
Definition at line 81 of file totemcrypto.c.
#define AES_192_KEY_LENGTH 24 |
Definition at line 77 of file totemcrypto.c.
#define AES_256_KEY_LENGTH 32 |
Definition at line 73 of file totemcrypto.c.
#define log_printf | ( | level, | |
format, | |||
args... | |||
) |
Definition at line 201 of file totemcrypto.c.
Referenced by crypto_authenticate_and_decrypt().
#define LOGSYS_UTILS_ONLY 1 |
Definition at line 47 of file totemcrypto.c.
#define SALT_SIZE 16 |
Definition at line 67 of file totemcrypto.c.
Referenced by crypto_sec_header_size().
enum crypto_crypt_t |
Enumerator | |
---|---|
CRYPTO_CIPHER_TYPE_NONE | |
CRYPTO_CIPHER_TYPE_AES256 | |
CRYPTO_CIPHER_TYPE_AES192 | |
CRYPTO_CIPHER_TYPE_AES128 | |
CRYPTO_CIPHER_TYPE_3DES | |
CRYPTO_CIPHER_TYPE_2_3 | |
CRYPTO_CIPHER_TYPE_2_2 |
Definition at line 90 of file totemcrypto.c.
enum crypto_hash_t |
Enumerator | |
---|---|
CRYPTO_HASH_TYPE_NONE | |
CRYPTO_HASH_TYPE_MD5 | |
CRYPTO_HASH_TYPE_SHA1 | |
CRYPTO_HASH_TYPE_SHA256 | |
CRYPTO_HASH_TYPE_SHA384 | |
CRYPTO_HASH_TYPE_SHA512 | |
CRYPTO_HASH_TYPE_2_3 | |
CRYPTO_HASH_TYPE_2_2 |
Definition at line 134 of file totemcrypto.c.
struct crypto_config_header __attribute__ | ( | (packed) | ) |
int crypto_authenticate_and_decrypt | ( | struct crypto_instance * | instance, |
unsigned char * | buf, | ||
int * | buf_len | ||
) |
Definition at line 745 of file totemcrypto.c.
References crypto_config_header::__pad0, crypto_config_header::__pad1, crypto_config_header::crypto_cipher_type, CRYPTO_CIPHER_TYPE_2_3, crypto_config_header::crypto_hash_type, CRYPTO_HASH_TYPE_2_3, crypto_instance::log_level_security, and log_printf.
int crypto_encrypt_and_sign | ( | struct crypto_instance * | instance, |
const unsigned char * | buf_in, | ||
const size_t | buf_in_len, | ||
unsigned char * | buf_out, | ||
size_t * | buf_out_len | ||
) |
Definition at line 723 of file totemcrypto.c.
References crypto_config_header::__pad0, crypto_config_header::__pad1, crypto_config_header::crypto_cipher_type, CRYPTO_CIPHER_TYPE_2_3, crypto_config_header::crypto_hash_type, and CRYPTO_HASH_TYPE_2_3.
size_t crypto_get_current_sec_header_size | ( | const struct crypto_instance * | instance | ) |
Definition at line 702 of file totemcrypto.c.
References crypto_instance::crypto_header_size.
struct crypto_instance* crypto_init | ( | const unsigned char * | private_key, |
unsigned int | private_key_len, | ||
const char * | crypto_cipher_type, | ||
const char * | crypto_hash_type, | ||
void(*)(int level,int subsys,const char *function,const char *file,int line,const char *format,...) __attribute__ log_printf_func((format(printf, 6, 7))) | , | ||
int | log_level_security, | ||
int | log_level_notice, | ||
int | log_level_error, | ||
int | log_subsys_id | ||
) |
Definition at line 803 of file totemcrypto.c.
References crypto_instance::crypto_cipher_type, crypto_instance::crypto_hash_type, crypto_instance::crypto_header_size, crypto_sec_header_size(), crypto_instance::log_level_error, crypto_instance::log_level_notice, crypto_instance::log_level_security, crypto_instance::log_printf_func, crypto_instance::log_subsys_id, crypto_instance::private_key, and crypto_instance::private_key_len.
Referenced by totemudp_initialize(), and totemudpu_initialize().
size_t crypto_sec_header_size | ( | const char * | crypto_cipher_type, |
const char * | crypto_hash_type | ||
) |
Definition at line 667 of file totemcrypto.c.
References SALT_SIZE.
Referenced by crypto_init(), totemudp_net_mtu_adjust(), and totemudpu_net_mtu_adjust().
enum crypto_crypt_t __attribute__ |
uint8_t __pad0 |
Definition at line 66 of file totemcrypto.c.
uint8_t __pad1 |
Definition at line 67 of file totemcrypto.c.
size_t cipher_key_len[] |
Definition at line 108 of file totemcrypto.c.
CK_MECHANISM_TYPE cipher_to_nss[] |
Definition at line 100 of file totemcrypto.c.
uint8_t crypto_cipher_type |
Definition at line 64 of file totemcrypto.c.
uint8_t crypto_hash_type |
Definition at line 65 of file totemcrypto.c.
size_t cypher_block_len[] |
Definition at line 116 of file totemcrypto.c.
size_t hash_block_len[] |
Definition at line 163 of file totemcrypto.c.
size_t hash_len[] |
Definition at line 154 of file totemcrypto.c.
CK_MECHANISM_TYPE hash_to_nss[] |
Definition at line 145 of file totemcrypto.c.