<div dir="ltr">Hi Steve,<div><br></div><div>Thanks for the response. </div><div><br></div><div>We are using openssl-1.0.1j. </div><div><br></div><div>Following is how have configured NID_sha1 and NID_ecdsa_with_sha1. </div><div><br></div><div>We use our own signature and digest methods. But, i see modification of digest has issue. If i dont set any digest method, then our signature functions are getting used and for digest openssl's sha1, sha256 etc functions are getting used. </div><div><br></div><div>I see that configuraiton of NID_ecdsa_with_sha1 has some issue on my setup. Please take a look at these configurations and provide  your inputs. </div><div><br></div><div><br></div><div>ECDSA digest structure : </div><div><br></div><div><div>static const EVP_MD ios_ecdsa_sha1 =</div><div>{</div><div>    NID_ecdsa_with_SHA1,</div><div>    NID_ecdsa_with_SHA1,</div><div>    SHA_DIGEST_LENGTH,</div><div>    <span style="font-size:12.8000001907349px">EVP_MD_FLAG_PKEY_METHOD_</span><span style="font-size:12.8000001907349px">SIGNATURE</span>,</div><div>    sha1init,</div><div>    sha1update,</div><div>    sha1final,</div><div>    NULL,</div><div>    NULL,</div><div>    EVP_PKEY_ECDSA_method,</div><div>    SHA_CBLOCK,</div><div>    sizeof(EVP_MD *)+sizeof(SHA1_CTX)</div><div>};</div></div><div><br></div><div>RSA digest structure : </div><div><div>static const EVP_MD ios_sha1_md =</div><div>{</div><div>    NID_sha1,                  </div><div>    NID_sha1WithRSAEncryption, </div><div>    SHA_DIGEST_LENGTH,         </div><div>    0,                         </div><div>    sha1init,</div><div>    sha1update,</div><div>    sha1final,</div><div>    NULL,                      </div><div>    NULL,                    </div><div>    EVP_PKEY_RSA_method,</div><div>    SHA_CBLOCK,</div><div>    sizeof(EVP_MD *) + sizeof(SHA1_CTX)</div><div>};</div></div><div class="gmail_extra"><br></div><div class="gmail_extra">With this update, only RSA ciphers are working fine. But not ECDSA ciphers. </div><div class="gmail_extra"><br></div><div class="gmail_extra">Thanks,<br></div><div class="gmail_extra">Rajeswari.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 24, 2015 at 11:06 PM, Dr. Stephen Henson <span dir="ltr"><<a href="mailto:steve@openssl.org" target="_blank">steve@openssl.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div>On Fri, Apr 24, 2015, Rajeswari K wrote:<br>
<br>
> Hello openssl-users,<br>
><br>
> I have an issue with update of ECDSA digests in our environment.<br>
><br>
> We have our own digest functions for init, update and final where we<br>
> registered with these functions for NID_sha1, NID_sha256, NID_sha384 and<br>
> NID_sha512. These digests were updated at openssl, via ENGINE_set_digests()<br>
> function.<br>
><br>
> After update, i see that all RSA cerificate based ciphers are working fine<br>
> with both TLS1.0 and TLS1.2.<br>
><br>
> And, i added the ECDSA algorithm with openssl function<br>
> EVP_add_digest(EVP_ecdsa());<br>
><br>
> But, for me ECDSA cert based cipher suites are not working. These are<br>
> landing to following errors.<br>
><br>
> digital envelope routines:EVP_SignFinal:wrong public key type :<br>
> crypto/evp/p_sign     .c:139:<br>
><br>
> SSL routines:SSL3_SEND_SERVER_KEY_EXCHANGE:EVP lib: ssl/s3_srvr.c:2012<br>
><br>
><br>
> Then i tried following<br>
> Tried to set only NID_ecdsa_with_SHA1 with our init, update and final<br>
> function and tried to update to openssl via ENGINE_set_digests().<br>
><br>
> But, now seems to be since i updated NID_ecdsa_with_SHA1 with our sha1<br>
> functions, whole TLS1.0 handshakes stopped working with "decrypt error or<br>
> bac mac record" errors.<br>
><br>
> Based on this, seems to be there is a basic thing am missing while<br>
> configuring ECDSA based digests.<br>
><br>
> Can you please help me on this configuration? How can we differentiate<br>
> between ECDSA digests to RSA digests?<br>
><br>
> Because both usually lands on to same SHA1, SHA256 etc functions.<br>
><br>
> I tried one more thing that, along with NID_sha1, NID_sha256, NID_sha384,<br>
> NID_sha512 i tried to define NID_ecdsa_with_SHA1, NID_ecdsa_with_SHA256,<br>
> NID_ecdsa_with_SHA384 and NID_ecdsa_with_SHA512 with respective settings.<br>
> But, with this setting also landing to same above error of "wrong public<br>
> key type".<br>
><br>
> I need your inputs on this issue.<br>
><br>
<br>
</div></div>So does your code just perform the digest operation and not signing?<br>
<br>
Which version was it working with before?<br>
<br>
There isn't really any difference between an ECDSA and RSA digest. Older<br>
versions of OpenSSL linked digests and signing algorithms. That link no longer<br>
exists and some algorithms are marked as being suitable for multiple public<br>
key algorithms.<br>
<br>
Are you setting the flag EVP_MD_FLAG_PKEY_METHOD_SIGNATURE in the EVP_MD<br>
structure?<br>
<br>
An ENGINE providing alternative implementations of built in digests shoudn't<br>
need to call EVP_add_digest. If everything is set up properly OpenSSL should<br>
just switch to the ENGINE implementation.<br>
<br>
Steve.<br>
--<br>
Dr Stephen N. Henson. OpenSSL project core developer.<br>
Commercial tech support now available see: <a href="http://www.openssl.org" target="_blank">http://www.openssl.org</a><br>
_______________________________________________<br>
openssl-users mailing list<br>
To unsubscribe: <a href="https://mta.openssl.org/mailman/listinfo/openssl-users" target="_blank">https://mta.openssl.org/mailman/listinfo/openssl-users</a><br>
</blockquote></div><br></div></div>