<div dir="ltr">I was hoping to tolerate some error "for now" and flag it and continue the whole process (complete the handshake and treat the ssl connection as "pass").<div>So for my case long res = SSL_get_verify_result( sslCtx ) from caller should return X509_V_OK.</div><div>I guess I need to explicitly se<span style="background-color:rgb(255,255,255)">t <font color="#000000" style=""><span class="gmail-n" style="box-sizing:border-box;white-space:break-spaces;font-family:Menlo,"DejaVu Sans Mono","Liberation Mono",Consolas,"Ubuntu Mono","Courier New","andale mono","lucida console",monospace;font-size:12.6px">X509_STORE_CTX_set_error</span><span class="gmail-p" style="box-sizing:border-box;white-space:break-spaces;font-family:Menlo,"DejaVu Sans Mono","Liberation Mono",Consolas,"Ubuntu Mono","Courier New","andale mono","lucida console",monospace;font-size:12.6px">(</span><span class="gmail-n" style="box-sizing:border-box;white-space:break-spaces;font-family:Menlo,"DejaVu Sans Mono","Liberation Mono",Consolas,"Ubuntu Mono","Courier New","andale mono","lucida console",monospace;font-size:12.6px">ctx</span><span class="gmail-p" style="box-sizing:border-box;white-space:break-spaces;font-family:Menlo,"DejaVu Sans Mono","Liberation Mono",Consolas,"Ubuntu Mono","Courier New","andale mono","lucida console",monospace;font-size:12.6px">,</span><span style="font-family:Menlo,"DejaVu Sans Mono","Liberation Mono",Consolas,"Ubuntu Mono","Courier New","andale mono","lucida console",monospace;font-size:12.6px;white-space:break-spaces"> </span><span class="gmail-n" style="box-sizing:border-box;white-space:break-spaces;font-family:Menlo,"DejaVu Sans Mono","Liberation Mono",Consolas,"Ubuntu Mono","Courier New","andale mono","lucida console",monospace;font-size:12.6px">X509_V_OK</span><span class="gmail-p" style="box-sizing:border-box;white-space:break-spaces;font-family:Menlo,"DejaVu Sans Mono","Liberation Mono",Consolas,"Ubuntu Mono","Courier New","andale mono","lucida console",monospace;font-size:12.6px">) before return 1 in the example if I need caller </span></font></span> SSL_get_verify_result to return </div><div>X509_V_OK?<br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 14, 2022 at 12:38 PM <<a href="mailto:openssl-users-request@openssl.org">openssl-users-request@openssl.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">[ External sender. Exercise caution. ]<br>
<br>
Send openssl-users mailing list submissions to<br>
        <a href="mailto:openssl-users@openssl.org" target="_blank">openssl-users@openssl.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="https://mta.openssl.org/mailman/listinfo/openssl-users" rel="noreferrer" target="_blank">https://mta.openssl.org/mailman/listinfo/openssl-users</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:openssl-users-request@openssl.org" target="_blank">openssl-users-request@openssl.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:openssl-users-owner@openssl.org" target="_blank">openssl-users-owner@openssl.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of openssl-users digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. Re: DSA signatures in OpenSSL 3.0 (Richard Dymond)<br>
   2. Re: DSA signatures in OpenSSL 3.0 (Tomas Mraz)<br>
   3. Re: DSA signatures in OpenSSL 3.0 (Richard Dymond)<br>
   4. Question about examples in openssl doc<br>
      X509_STORE_CTX_verify_cb (Edward Tsang)<br>
   5. Re: Question about examples in openssl doc<br>
      X509_STORE_CTX_verify_cb (Viktor Dukhovni)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Mon, 14 Mar 2022 09:02:18 -0300<br>
From: Richard Dymond <<a href="mailto:rjdymond@gmail.com" target="_blank">rjdymond@gmail.com</a>><br>
To: <a href="mailto:openssl-users@openssl.org" target="_blank">openssl-users@openssl.org</a><br>
Subject: Re: DSA signatures in OpenSSL 3.0<br>
Message-ID:<br>
        <CANVKdYAFQkS8wXADdpD334V=JHp_Bamvm8s=<a href="mailto:pX2tYRLNygppTg@mail.gmail.com" target="_blank">pX2tYRLNygppTg@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
On Mon, 14 Mar 2022 at 04:52, Tomas Mraz <<a href="mailto:tomas@openssl.org" target="_blank">tomas@openssl.org</a>> wrote:<br>
<br>
> The DSA_SIG_* functions are not deprecated including the i2d and d2i<br>
> functions. So you can use d2i_DSA_SIG to decode the DER produced by the<br>
> EVP_DigestSign() and then obtain the r and s values from the DSA_SIG.<br>
><br>
<br>
Thank you, that works! For some reason it had escaped my notice that the<br>
DSA_SIG_* functions are not deprecated.<br>
<br>
By the way, the reason I need to get the 'r' and 's' values from the DSA<br>
signature is that I am encoding them one after the other as 160-bit<br>
unsigned integers, in network byte order, as required by SSH and described<br>
in section 6.6 of RFC 4253 (dss_signature_blob)[1]. To do this encoding I<br>
am calling BN_bn2bin() twice to write 'r' followed by 's' at the<br>
appropriate locations in a 40-byte buffer. By any chance, does OpenSSL 3.0<br>
provide any support for encoding a DSA signature like this from a DSA_SIG<br>
(i.e. without having to extract 'r' and 's' first and then use BN_bn2bin())?<br>
<br>
Richard<br>
<br>
[1] <a href="https://datatracker.ietf.org/doc/html/rfc4253#section-6.6" rel="noreferrer" target="_blank">https://datatracker.ietf.org/doc/html/rfc4253#section-6.6</a><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="https://mta.openssl.org/pipermail/openssl-users/attachments/20220314/a058a561/attachment-0001.htm" rel="noreferrer" target="_blank">https://mta.openssl.org/pipermail/openssl-users/attachments/20220314/a058a561/attachment-0001.htm</a>><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Mon, 14 Mar 2022 15:03:01 +0100<br>
From: Tomas Mraz <<a href="mailto:tomas@openssl.org" target="_blank">tomas@openssl.org</a>><br>
To: Richard Dymond <<a href="mailto:rjdymond@gmail.com" target="_blank">rjdymond@gmail.com</a>><br>
Cc: openssl-users <<a href="mailto:openssl-users@openssl.org" target="_blank">openssl-users@openssl.org</a>><br>
Subject: Re: DSA signatures in OpenSSL 3.0<br>
Message-ID:<br>
        <<a href="mailto:40bda5bc7e776522c25d94037a7b0808c140e774.camel@openssl.org" target="_blank">40bda5bc7e776522c25d94037a7b0808c140e774.camel@openssl.org</a>><br>
Content-Type: text/plain; charset="UTF-8"<br>
<br>
On Mon, 2022-03-14 at 08:58 -0300, Richard Dymond wrote:<br>
> On Mon, 14 Mar 2022 at 04:52, Tomas Mraz <<a href="mailto:tomas@openssl.org" target="_blank">tomas@openssl.org</a>> wrote:<br>
> > The DSA_SIG_* functions are not deprecated including the i2d and<br>
> > d2i<br>
> > functions. So you can use d2i_DSA_SIG to decode the DER produced by<br>
> > the<br>
> > EVP_DigestSign() and then obtain the r and s values from the<br>
> > DSA_SIG.<br>
> > <br>
> <br>
> <br>
> Thank you, that works! For some reason it had escaped my notice that<br>
> that the DSA_SIG_* functions are not deprecated.<br>
> <br>
> By the way, the reason I need to get the 'r' and 's' values from the<br>
> DSA signature is that I am encoding them one after the other as 160-<br>
> bit unsigned integers, in network byte order, as required by SSH and<br>
> described in section 6.6 of RFC 4253 (dss_signature_blob)[1]. To do<br>
> this encoding I am calling BN_bn2bin() twice to write 'r' followed by<br>
> 's' at the appropriate locations in a 40-byte buffer. By any chance,<br>
> does OpenSSL 3.0 provide any support for encoding a DSA signature<br>
> like this from a DSA_SIG (i.e. without having to extract 'r' and 's'<br>
> first and then use BN_bn2bin())?<br>
<br>
No, there is no such function. However there is not much overhead in<br>
doing the two BN_bn2bin calls (should those be BN_bn2binpad actually?)<br>
once you already have a DSA_SIG object.<br>
<br>
> Richard<br>
> <br>
> [1] <a href="https://datatracker.ietf.org/doc/html/rfc4253#section-6.6" rel="noreferrer" target="_blank">https://datatracker.ietf.org/doc/html/rfc4253#section-6.6</a><br>
<br>
-- <br>
Tom?? Mr?z, OpenSSL<br>
<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Mon, 14 Mar 2022 13:09:01 -0300<br>
From: Richard Dymond <<a href="mailto:rjdymond@gmail.com" target="_blank">rjdymond@gmail.com</a>><br>
To: Tomas Mraz <<a href="mailto:tomas@openssl.org" target="_blank">tomas@openssl.org</a>><br>
Cc: openssl-users <<a href="mailto:openssl-users@openssl.org" target="_blank">openssl-users@openssl.org</a>><br>
Subject: Re: DSA signatures in OpenSSL 3.0<br>
Message-ID:<br>
        <<a href="mailto:CANVKdYAh2uH1n-UNwMNvb18hDwD8U2DhjjQj_PpvU7XJezRKzw@mail.gmail.com" target="_blank">CANVKdYAh2uH1n-UNwMNvb18hDwD8U2DhjjQj_PpvU7XJezRKzw@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
On Mon, 14 Mar 2022 at 11:03, Tomas Mraz <<a href="mailto:tomas@openssl.org" target="_blank">tomas@openssl.org</a>> wrote:<br>
<br>
> On Mon, 2022-03-14 at 08:58 -0300, Richard Dymond wrote:<br>
> > By the way, the reason I need to get the 'r' and 's' values from the<br>
> > DSA signature is that I am encoding them one after the other as 160-<br>
> > bit unsigned integers, in network byte order, as required by SSH and<br>
> > described in section 6.6 of RFC 4253 (dss_signature_blob)[1]. To do<br>
> > this encoding I am calling BN_bn2bin() twice to write 'r' followed by<br>
> > 's' at the appropriate locations in a 40-byte buffer. By any chance,<br>
> > does OpenSSL 3.0 provide any support for encoding a DSA signature<br>
> > like this from a DSA_SIG (i.e. without having to extract 'r' and 's'<br>
> > first and then use BN_bn2bin())?<br>
><br>
> No, there is no such function. However there is not much overhead in<br>
> doing the two BN_bn2bin calls (should those be BN_bn2binpad actually?)<br>
> once you already have a DSA_SIG object.<br>
><br>
<br>
OK, I suppose that was hoping for too much. But thanks for the tip<br>
regarding BN_bn2binpad v. BN_bn2bin - that does simplify the code a little<br>
more.<br>
<br>
Richard<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="https://mta.openssl.org/pipermail/openssl-users/attachments/20220314/fa41e42b/attachment-0001.htm" rel="noreferrer" target="_blank">https://mta.openssl.org/pipermail/openssl-users/attachments/20220314/fa41e42b/attachment-0001.htm</a>><br>
<br>
------------------------------<br>
<br>
Message: 4<br>
Date: Mon, 14 Mar 2022 11:25:51 -0700<br>
From: Edward Tsang <<a href="mailto:etsang@splunk.com" target="_blank">etsang@splunk.com</a>><br>
To: <a href="mailto:openssl-users@openssl.org" target="_blank">openssl-users@openssl.org</a><br>
Subject: Question about examples in openssl doc<br>
        X509_STORE_CTX_verify_cb<br>
Message-ID:<br>
        <CACrfNRHerj3=<a href="mailto:hgX4Ls7DLRcAhvSd2iHrEhx5O2CqcLfkkCD-yw@mail.gmail.com" target="_blank">hgX4Ls7DLRcAhvSd2iHrEhx5O2CqcLfkkCD-yw@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
link:<br>
<a href="https://www.openssl.org/docs/man1.1.1/man3/X509_STORE_CTX_verify_cb.html" rel="noreferrer" target="_blank">https://www.openssl.org/docs/man1.1.1/man3/X509_STORE_CTX_verify_cb.html</a><br>
<br>
I am trying to figure out how this example works but it does not seem to<br>
bypass the (use the second example of  X509_V_ERR_CERT_HAS_EXPIRED)<br>
<br>
However the caller code ll<br>
long res = SSL_get_verify_result( sslCtx ); still reports res NOT as<br>
X509_V_OK, which it should be oper the example since it is returning as 1.<br>
<br>
I don't think I need to use X509_STORE_CTX_set_error(ctx, X509_V_OK);<br>
before return 1 in the X509_STORE_CTX_verify_cb example.<br>
Or am I missing something?<br>
Thanjs<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="https://mta.openssl.org/pipermail/openssl-users/attachments/20220314/6da2e2e4/attachment-0001.htm" rel="noreferrer" target="_blank">https://mta.openssl.org/pipermail/openssl-users/attachments/20220314/6da2e2e4/attachment-0001.htm</a>><br>
<br>
------------------------------<br>
<br>
Message: 5<br>
Date: Mon, 14 Mar 2022 15:27:59 -0400<br>
From: Viktor Dukhovni <<a href="mailto:openssl-users@dukhovni.org" target="_blank">openssl-users@dukhovni.org</a>><br>
To: <a href="mailto:openssl-users@openssl.org" target="_blank">openssl-users@openssl.org</a><br>
Subject: Re: Question about examples in openssl doc<br>
        X509_STORE_CTX_verify_cb<br>
Message-ID: <<a href="mailto:Yi%2BXP0ey1xVWM5kU@straasha.imrryr.org" target="_blank">Yi+XP0ey1xVWM5kU@straasha.imrryr.org</a>><br>
Content-Type: text/plain; charset=us-ascii<br>
<br>
On Mon, Mar 14, 2022 at 11:25:51AM -0700, Edward Tsang via openssl-users wrote:<br>
<br>
> <a href="https://www.openssl.org/docs/man1.1.1/man3/X509_STORE_CTX_verify_cb.html" rel="noreferrer" target="_blank">https://www.openssl.org/docs/man1.1.1/man3/X509_STORE_CTX_verify_cb.html</a><br>
> <br>
> I am trying to figure out how this example works but it does not seem to<br>
> bypass the (use the second example of  X509_V_ERR_CERT_HAS_EXPIRED)<br>
> <br>
> However the caller code <br>
> long res = SSL_get_verify_result( sslCtx ); still reports res NOT as<br>
> X509_V_OK, which it should be oper the example since it is returning as 1.<br>
<br>
This is correct and expected.  Returning "ok = 1" from the verify<br>
callback allows the handshake to continue, rather than be aborted,<br>
but it does not and should not mark the certificate as verified.<br>
<br>
> I don't think I need to use X509_STORE_CTX_set_error(ctx, X509_V_OK);<br>
> before return 1 in the X509_STORE_CTX_verify_cb example.<br>
> Or am I missing something?<br>
<br>
You're missing something.  It is best to not suppress the error code,<br>
since this will also mean that resumed sessions are unaware of the<br>
error, ... Rather if you want to tolerate expired certificates record<br>
and admit that error both in the callback and after the handshake.<br>
<br>
-- <br>
    Viktor.<br>
<br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
_______________________________________________<br>
openssl-users mailing list<br>
<a href="mailto:openssl-users@openssl.org" target="_blank">openssl-users@openssl.org</a><br>
<a href="https://mta.openssl.org/mailman/listinfo/openssl-users" rel="noreferrer" target="_blank">https://mta.openssl.org/mailman/listinfo/openssl-users</a><br>
<br>
<br>
------------------------------<br>
<br>
End of openssl-users Digest, Vol 88, Issue 18<br>
*********************************************<br>
<br>
</blockquote></div>