<div dir="ltr">Wow,<div><br></div><div>That was quite the oversight of mine. That fixed the issue. Thanks so much, I appreciate your patience in dealing with my confusion over the APIs!</div><div><br></div><div>Cheers,</div><div><br></div><div>Ethan</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Mar 11, 2017 at 12:28 PM, Matt Caswell <span dir="ltr"><<a href="mailto:matt@openssl.org" target="_blank">matt@openssl.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
On 11/03/17 18:38, Ethan Rahn wrote:<br>
>    size_t sharedSecretLen = 0;<br>
<br>
Set this to sizeof(sharedSecret).<br>
<span class=""><br>
><br>
>    // Now derive the Shared Secret<br>
>    EVP_PKEY_CTX *ctx;<br>
><br>
>    ctx = EVP_PKEY_CTX_new(pkey, NULL);<br>
>    if (!ctx){<br>
>       fprintf( stderr, "Failed to make EVP_PKEY ctx\n" );<br>
>       ERR_load_crypto_strings();<br>
<br>
</span>This should be called once at the start of your program - *before* any<br>
calls that might generate an error.<br>
<span class=""><br>
>    if (EVP_PKEY_derive(ctx, sharedSecret, &sharedSecretLen) <= 0){<br>
<br>
</span>From the EVP_PKEY_derive documentation:<br>
<br>
<a href="https://www.openssl.org/docs/man1.0.2/crypto/EVP_PKEY_derive.html" rel="noreferrer" target="_blank">https://www.openssl.org/docs/<wbr>man1.0.2/crypto/EVP_PKEY_<wbr>derive.html</a><br>
<br>
"If key is not NULL then before the call the keylen parameter should<br>
contain the length of the key buffer, if the call is successful the<br>
shared secret is written to key and the amount of data written to keylen."<br>
<div class="HOEnZb"><div class="h5"><br>
Matt<br>
<br>
--<br>
openssl-users mailing list<br>
To unsubscribe: <a href="https://mta.openssl.org/mailman/listinfo/openssl-users" rel="noreferrer" target="_blank">https://mta.openssl.org/<wbr>mailman/listinfo/openssl-users</a><br>
</div></div></blockquote></div><br></div>