![]() |
UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
|
#include "crypto/openssl_encrypt.h"#include <assert.h>#include <stdint.h>#include <stdlib.h>#include <string.h>#include <openssl/aes.h>#include <openssl/err.h>#include <openssl/evp.h>#include <openssl/rand.h>#include "compat/strings.h"#include "crypto/crc.h"#include "crypto/md5.h"#include "debug.h"#include "lib_common.h"#include "utils/color_out.h"#include "utils/macros.h"
Go to the source code of this file.
Classes | |
| struct | openssl_encrypt |
Macros | |
| #define | CHECK(action, errmsg) |
| #define | DEFAULT_CIPHER_MODE MODE_AES128_GCM |
| #define | GCM_TAG_LEN 16 |
| #define | MOD_NAME "[encrypt] " |
Functions | |
| const void * | get_cipher (enum openssl_mode mode) |
| static enum openssl_mode | get_cipher_from_str (char *str) |
| static int | openssl_encrypt (struct openssl_encrypt *encryption, char *plaintext, int data_len, char *aad, int aad_len, char *ciphertext) |
| static void | openssl_encrypt_destroy (struct openssl_encrypt *s) |
| static int | openssl_encrypt_init (struct openssl_encrypt **state, const char *passphrase) |
| static enum openssl_mode | openssl_get_cipher (struct openssl_encrypt *encryption) |
| static int | openssl_get_overhead (struct openssl_encrypt *s) |
| REGISTER_MODULE (openssl_encrypt, &functions, LIBRARY_CLASS_UNDEFINED, OPENSSL_ENCRYPT_ABI_VERSION) | |
| static void | usage (void) |
Variables | ||
| struct { | ||
| const EVP_CIPHER *(* get_cipher )(void) | ||
| enum openssl_mode mode | ||
| const char * name | ||
| } | ciphers [] | |
| static const struct openssl_encrypt_info | functions | |
Encryption is done on per-packet basis, for every packet, new IV is generated, which is send on the beginning, then length of data (uint32_t), and actual encrypted data with:
Encryption algorithm is set in transmit.cpp, detected on receiver. Required algorightms are currently GCM (default) and CBC.
Definition in file openssl_encrypt.c.
| #define CHECK | ( | action, | |
| errmsg ) |
Definition at line 198 of file openssl_encrypt.c.
Referenced by openssl_encrypt().
| #define DEFAULT_CIPHER_MODE MODE_AES128_GCM |
Definition at line 84 of file openssl_encrypt.c.
Referenced by openssl_encrypt_init().
| #define GCM_TAG_LEN 16 |
Definition at line 85 of file openssl_encrypt.c.
Referenced by openssl_encrypt(), and openssl_get_overhead().
| #define MOD_NAME "[encrypt] " |
Definition at line 86 of file openssl_encrypt.c.
Referenced by openssl_encrypt(), and openssl_encrypt_init().
| const void * get_cipher | ( | enum openssl_mode | mode | ) |
Definition at line 114 of file openssl_encrypt.c.
|
static |
Definition at line 135 of file openssl_encrypt.c.
References ciphers, MODE_AES128_NONE, MSG, and name.
Referenced by openssl_encrypt_init().
|
static |
Definition at line 200 of file openssl_encrypt.c.
References CHECK, openssl_encrypt::cipher, crc32buf(), crc32buf_with_oldcrc(), openssl_encrypt::ctx, GCM_TAG_LEN, openssl_encrypt::key_hash, LOG_LEVEL_ERROR, log_msg(), MOD_NAME, openssl_encrypt::mode, and MODE_AES128_GCM.

|
static |
Definition at line 192 of file openssl_encrypt.c.
References openssl_encrypt::ctx.
|
static |
Definition at line 151 of file openssl_encrypt.c.
References openssl_encrypt::cipher, openssl_encrypt::ctx, DEFAULT_CIPHER_MODE, get_cipher, get_cipher_from_str(), openssl_encrypt::key_hash, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, log_msg(), MD5Final(), MD5Init(), MD5Update(), MOD_NAME, mode, openssl_encrypt::mode, snprintf_ch, state, STR_LEN, and usage().

|
static |
Definition at line 249 of file openssl_encrypt.c.
References openssl_encrypt::mode.
|
static |
Definition at line 241 of file openssl_encrypt.c.
References GCM_TAG_LEN, openssl_encrypt::mode, MODE_AES128_ECB, and MODE_AES128_GCM.
| REGISTER_MODULE | ( | openssl_encrypt | , |
| & | functions, | ||
| LIBRARY_CLASS_UNDEFINED | , | ||
| OPENSSL_ENCRYPT_ABI_VERSION | ) |
|
static |
Definition at line 124 of file openssl_encrypt.c.
References ciphers, color_printf(), name, and TBOLD.
Referenced by openssl_encrypt_init().

| const struct { ... } ciphers[] |
Referenced by get_cipher(), get_cipher_from_str(), and usage().
|
static |
Definition at line 254 of file openssl_encrypt.c.
| const EVP_CIPHER *(* get_cipher) (void) | ( | void | ) |
Definition at line 98 of file openssl_encrypt.c.
Referenced by openssl_decrypt(), and openssl_encrypt_init().
| enum openssl_mode mode |
Definition at line 96 of file openssl_encrypt.c.
Referenced by replica::replica(), cipherInit(), detect_format(), display_drm_reconfigure(), display_dvs_init(), display_gl_init_opengl(), display_gl_process_key(), get_cipher(), get_input_modes(), get_refresh_rate(), getVideoModes(), glfw_print_video_mode(), glfw_resize_window(), openssl_decrypt(), openssl_encrypt_init(), qfDES(), AvailableSettings::queryDevice(), resolve_addrinfo(), set_output_buffering(), setup_crtc(), show_help(), UpdateVideoMode(), usage(), vidcap_dvs_init(), and VideoDelegate::VideoInputFormatChanged().
| const char* name |
Definition at line 97 of file openssl_encrypt.c.
Referenced by get_cipher_from_str(), and usage().