<div dir="ltr"><div>I'm currently working on implementing EVP_PKEY_cmp for ruby's openssl wrapper.<br><br></div><div>Initially, I was going by the documentation provided for EVP_PKEY_cmp, but the maintainer discovered conflicting documentation.</div><div><br></div><div><a href="https://www.openssl.org/docs/man1.1.1/man3/EVP_PKEY_ASN1_METHOD.html">https://www.openssl.org/docs/man1.1.1/man3/EVP_PKEY_ASN1_METHOD.html</a></div><div><br></div><div>States the following:</div><div>The param_cmp() method compares the parameters of keys <b>a</b> and <b>b</b>. It MUST return 1 when the keys are equal, 0 when not equal, or a negative number on error. It's called by <a href="https://www.openssl.org/docs/man1.1.1/man3/EVP_PKEY_cmp_parameters.html">EVP_PKEY_cmp_parameters(3)</a>.</div><div><br></div><div>However</div><div><a href="https://www.openssl.org/docs/man1.0.2/man3/EVP_PKEY_cmp.html">https://www.openssl.org/docs/man1.0.2/man3/EVP_PKEY_cmp.html</a></div><div><br></div><div>States something slightly different:</div><div>The function EVP_PKEY_cmp_parameters() and EVP_PKEY_cmp() return 1 if 
the keys match, 0 if they don't match, -1 if the key types are different
 and -2 if the operation is not supported.<br><br></div><div>At this point I'm explicitly checking the type on each and not able to check -2 against a 'not supported' or in ruby 'not implemented' exception given EVP_PKEY_ASN1_METHOD(3) states ANY negative number can be an error.<br><br></div><div>The current work in progress can be found here if interested.</div><div><a href="https://github.com/ruby/openssl/pull/383/files">https://github.com/ruby/openssl/pull/383/files</a><br><br></div><div>Thanks,</div><div><br></div><div>Colton</div><div><br></div></div>