I'm playing with python library cryptography using openssl and x25519.
By looking for the code of EVP_PKEY_derive
I can see:
ret = ctx->op.kex.exchange->derive(ctx->op.kex.exchprovctx, key, pkeylen,
SIZE_MAX);
What I'm looking for is the implementation of the derive method for x25519.
But impossible to find it in the openSSL code.
Does someone know where can I find it?
You are looking at the OpenSSL 3.0 (master branch) code. That code is in state of flux at the moment because all the internal plumbing is being rewritten. You are probably better looking at the 1.1.1 branch.
The X25519 derive code is here:
https://github.com/openssl/openssl/blob/bf4006a6f9be691ba6eef0e8629e63369a033ccf/crypto/ec/ecx_meth.c#L684-L695
With most of the interesting code in this file:
https://github.com/openssl/openssl/blob/OpenSSL_1_1_1-stable/crypto/ec/curve25519.c