I'm learning TLS 1.3 scheme and trying to implement basic handshake steps in C++ without using ready wrappers from OpenSSL such as SSL_accept
or SSL_do_handshake
. The project already uses OpenSSL for common crypto operations, so I would like not to link it with any other crypto libraries where the x25519 calculation is more obvious than in OpenSSL. So...
there are two buffers:
unsigned char private_key[32];
RAND_bytes(private_key, 32);
unsigned char public_key[32];
memset(public_key, 0, 32);
Which method(s) of OpenSSL should I use to fill public_key
buffer with bytes computed from private_key
using x25519 algo (copying and allocating as less as possible)?