Skip to main content
12 events
when toggle format what by license comment
Oct 30, 2020 at 7:55 comment added joonas.fi The derive CLI command doesn't seem to be the raw Diffie-Hellman shared secret. I tested with X25519 keys and the bytes I get from OpenSSL derive don't match up with what I get from my Golang software ECDH, and Golang's stdlib's ECDH bytes line up with the test vectors in RFC (tools.ietf.org/html/rfc7748#section-6.1)
Nov 11, 2019 at 22:41 comment added Phil pkey_ec_kdf_derive was another rabbit hole. It calls pkey_ec_derive that calls ECDH_compute_key that calls eckey->meth->compute_key. pc_ec_derive sets eckey out of 1 of 2 contexts. So I had to wind my way all the way back up to the top to find out how these contexts and ultimately "compute_key" gets set. Long story short, I had to wade through all the store_loader crap and get to the point where I was comfortable with the belief that the derive function is probably determined when the private key is read in from a file. It's probably ecdh_simple_compute_key inside ecdh_ossl.c.
Nov 7, 2019 at 1:34 comment added Squeamish Ossifrage @Phil Correct—that way you get a notification, which wouldn't happen if I didn't, because you're not the author of the answer that this is a comment on.
Nov 7, 2019 at 1:20 comment added Phil ...but I always see "@Phil" on your posts.
Nov 6, 2019 at 23:25 comment added Squeamish Ossifrage @Phil (Commenting on a post always pings the author of the post, so there is no need to tag them to get that effect.)
Nov 6, 2019 at 23:25 comment added Phil SMH!! A number of juicy four letter acronyms come to mind, but I will muzzle myself this time. Thanks! BTW I tried to put "@Squeamish" into my reply but it wouldn't take.
Nov 6, 2019 at 23:17 comment added Squeamish Ossifrage @Phil It is defined here: github.com/openssl/openssl/blob/…. The macro OSSL_CORE_MAKE_FUNC concatenates OSSL_get_ with OP_keyexch_derive. The effect is to set exchange->derive to (OSSL_OP_keyexch_derive_fn *)fns->function. That said, I think you might actually be looking for pkey_ec_kdf_derive in crypto/ec/ec_pmeth.c.
Nov 6, 2019 at 23:11 comment added Phil No kidding. I got to this point after some hours and hit a brick wall: inside openssl/crypto/evp/exchange.c, line #72: exchange->derive = OSSL_get_OP_keyexch_derive(fns); This is supposedly the function that does the heavy lifting? Except, guess what: It's not defined ANYWHERE that google can find. I didn't just search the git repo, I searched the internet and couldn't find this function. So WTH?? Pith poor documentation just seriously chaps my hide.
Nov 5, 2019 at 23:45 comment added Squeamish Ossifrage @Phil It's the output of whatever EVP_PKEY_derive computes. Good luck chasing the chain of abstracted indirections down the rabbit hole of OpenSSL guts to find out what this really is!
Nov 5, 2019 at 23:38 comment added Phil So the output format of the key does not appear to be DER, or PEM, or ASN1? It looks to be raw hex. And as usual, the man page is silent on this point. Can I also assume then that the shared secret key is the X coordinate of the calculated curve point?
Nov 5, 2019 at 23:10 comment added Phil "pkeyutl -derive"!!! That's what I was looking for. How come nobody ever posted this anywhere, least of all in the wiki pages? Because no one had a use case until now? Trust me, my use case does not involve implementing a secure DH system.
Nov 5, 2019 at 23:03 history answered Squeamish Ossifrage CC BY-SA 4.0