MySQL 8.4.0
Source Code Documentation
tls_cipher.cc File Reference
#include "mysql/harness/tls_cipher.h"
#include <array>
#include <memory>
#include <system_error>
#include <openssl/evp.h>
#include "mysql/harness/stdx/expected.h"

Classes

class  Deleter< EVP_CIPHER_CTX >
 

Typedefs

using TlsCipherCtx = std::unique_ptr< EVP_CIPHER_CTX, Deleter< EVP_CIPHER_CTX > >
 

Functions

static void create_key (const uint8_t *key_begin, const uint8_t *key_end, uint8_t *rkey_begin, uint8_t *rkey_end)
 Transforms an arbitrary long key into a fixed length AES key. More...
 

Typedef Documentation

◆ TlsCipherCtx

using TlsCipherCtx = std::unique_ptr<EVP_CIPHER_CTX, Deleter<EVP_CIPHER_CTX> >

Function Documentation

◆ create_key()

static void create_key ( const uint8_t *  key_begin,
const uint8_t *  key_end,
uint8_t *  rkey_begin,
uint8_t *  rkey_end 
)
static

Transforms an arbitrary long key into a fixed length AES key.

AES keys are of fixed length. This routine takes an arbitrary long key iterates over it in AES key length increment and XORs the bytes with the AES key buffer being prepared. The bytes from the last incomplete iteration are XORed to the start of the key until their depletion. Needed since crypto function routines expect a fixed length key.

Parameters
[in]key_beginpointer to start of they key
[in]key_endpointer to one past the end of the key
[out]rkey_beginpointer to start of the real key
[out]rkey_endpointer to one past the end of the real key