Re: [openssl-users] how to implement functions for STACK OF custom type?

2017-03-27 Thread lists

On 03/24/2017 06:46 PM, Dr. Stephen Henson wrote:

On Tue, Mar 21, 2017, lists wrote:


Sorry, I first posted this on the -dev list, likely inappropriate... now with 
an update:

I am exploring my options with OpenSSL and specifically I am trying to manage 
the stacks for some custom objects.
Currently, I have this code (sort of) in the headers:

typedef struct myThingA_st
{
  ASN1_OBJECT aID;
  ASN1_OCTET_STRING aOCST;
}
  myThingA;

DECLARE_ASN1_ITEM(myThingA)
DECLARE_ASN1_FUNCTIONS(myThingA)
DECLARE_STACK_OF(myThingA)
[...]

If you're using OpenSSL 1.1.0 you need to include:

DEFINE_STACK_OF(FOO)

in a header file and that should be it. That implements a set of inline
functions that do the right thing.

For OpenSSL versions before 1.1.0 it's a bit messier. The type specific
STACK_OF functions are actually macros which are generated by the mkstack.pl
script and appear in the safestack.h header file. If you want to create your
own one way is to extract a type specific section from safestack.h, copy it
to your own header file and do a search/replace for the new type.

So for example extract the sk_OPENSSL_BLOCK macros and replace OPENSSL_BLOCK
with FOO.

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org


Thank you very much, Steve. Seems I'm progressing now.


--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


Re: [openssl-users] OpenSSL sending close_notify right after responding to a heartbeat request

2017-03-27 Thread R Kaja Mohideen
I have used backtrace function (execinfo.h) as documented here
(http://www.gnu.org/software/libc/manual/html_node/Backtraces.html) in
couple of OpenSSL source files - ssl_lib.c (ssl_shutdown) and s3_pkt.c
(ssl3_send_alert). I have actually used the exact same example from
that page for getting the stack trace printed from those two
functions.

When I reproduce the issue - following is the stacktrace I got

Obtained 3 stack frames.
/OpenSSL/libssl.so.1.0.0(printStackTrace+0x2d) [0x7f13927f482d]
/OpenSSL/libssl.so.1.0.0(SSL_shutdown+0x9) [0x7f13927f74a9]
[0x7f14a901f9e4]
Obtained 4 stack frames.
/OpenSSL/libssl.so.1.0.0(printStackTrace1+0x2d) [0x7f13927da4dd]
/OpenSSL/libssl.so.1.0.0(ssl3_send_alert+0x11) [0x7f13927dbe11]
/OpenSSL/libssl.so.1.0.0(ssl3_shutdown+0xa2) [0x7f13927d8662]
[0x7f14a901f9e4]

I'm surprised to see that I'm not able to get the caller details using
backtrace. Is it due to architecture of OpenSSL or something which
makes OpenSSL to use a new thread for invoking ssl_shutdown?

Any OpenSSL developers?

// Kaja

On Fri, Mar 24, 2017 at 7:10 PM, R Kaja Mohideen  wrote:
> Hi,
>
> We have a TLS Server (Written in C) and Client (Written in Java using
> Netty + OpenSSL).
>
> I see that when Server sends a TLS extension Heartbeat request to
> client - OpenSSL responds to it and sends a close_notify alert right
> after it - causing the server to close the session with client.
>
> I don't have any callback registered in client (HB request recipient
> side - Java/Netty doesn't really have that support) and so I'm sure
> that it is OpenSSL by itself is responding to that heartbeat request.
> But, who or what is making OpenSSL to send an alert & close the
> session upon responding to heartbeat remains a mystery.
>
> Any help / suggestions to investigate this issue is highly appreciated.
>
> Thanks & regards,
> R Kaja Mohideen
-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


Re: [openssl-users] Reg, TLS over SCTP (SOCK_SEQPACKET)

2017-03-27 Thread Sanjaya Joshi
Hi,
Thanks for the pointers. We will consider that option.

Regards,
Sanjaya

On Wed, Mar 1, 2017 at 6:59 PM, Michael Tuexen <
michael.tue...@lurchi.franken.de> wrote:

> > On 1 Mar 2017, at 06:34, Sanjaya Joshi  wrote:
> >
> > Hi,
> > Thank you Salz Rich for the confirmation.
> > So, whether application can perform manual TLS handshakes when
> SOCK_SEQPACKET is used ?
> I this the SOCK_SEQPACKET model doesn't fit well to the way the openssl
> code is layed out.
> They basically want a one-to-one relation between a bio (for example a
> socket bio) and
> a TLS connection. So there is no muxing/demuxing ongoing.
>
> I'm wondering why you are sticking to the 1-to-many style sockets and why
> you are not
> considering DTLS over SCTP instead of TLS over SCTP. DTLS over SCTP using
> one-to-one
> style sockets (SOCK_STREAM) is supported by OpenSSL on Linux and FreeBSD.
>
> Best regards
> Michael
> >
> > Regards,
> > Sanjaya
> >
> > On Tue, Feb 28, 2017 at 7:03 PM, Salz, Rich  wrote:
> > > But these calls don't work when SOCK_SEQPACKET (one-to-many
> connections) is used. Does openssl provide any alternatives for these calls
> ? Or an application need to perform the TLS handshakes manually ?
> >
> > This is not supported, and there are no demo's available.
> > --
> > openssl-users mailing list
> > To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
> >
> > --
> > openssl-users mailing list
> > To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
>
> --
> openssl-users mailing list
> To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
>
-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


[openssl-users] In ssl3_write_bytes, some checks related to hanlding write failure are missing

2017-03-27 Thread Raja ashok
Hi,

I feel there is a check missing in ssl3_write_bytes, in case of handling write 
failure.

Consider SSL_write is called with 2 bytes buffer, then internally in 
ssl3_write_bytes we try to send it as two record (16384 and 3616). If TCP send 
failed for the second record then we store the states internally (wnum, 
wpend_tot and wpend_buf) and return back the result.

Later application has to call SSL_write with same buffer, if it calls with 
different buffer of length 100 byte then we fail that in ssl3_write_bytes using 
the check (len < tot).

But consider application calls with buffer of size 18000 bytes and 
SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER is enabled. Then (len < tot) will not 
succeed as tot is 16384. Then it will call ssl3_write_pending to send the 
remaining 3616 record. If it succeeds we are incrementing tot, (tot += i). Now 
tot will have 2.

Later there is a check (tot == len), this will not succeed. Then directly we 
are doing n = (len - tot), this will overflow and store a value close to 2^32 
in n. Then it will cause out of bound access to the application buffer "buf".

I hope we should have one more check (len < (tot + s->s3->wpend_tot)) before 
calling ssl3_write_pending.

if ((len < tot) || (len < (tot + s->s3->wpend_tot))){
SSLerr(SSL_F_SSL3_WRITE_BYTES, SSL_R_BAD_LENGTH);
return (-1);
}

Note : I am referring 1.0.2k version of OpenSSL.

Regards,
Ashok


[Company_logo]

Raja Ashok V K
Huawei Technologies
Bangalore, India
http://www.huawei.com

本邮件及其附件含有华为公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁
止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中
的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件!
This e-mail and its attachments contain confidential information from HUAWEI, 
which
is intended only for the person or entity whose address is listed above. Any 
use of the
information contained herein in any way (including, but not limited to, total 
or partial
disclosure, reproduction, or dissemination) by persons other than the intended
recipient(s) is prohibited. If you receive this e-mail in error, please notify 
the sender by
phone or email immediately and delete it!

-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


[openssl-users] SSL cipher list to disable TLS 1.0 & TLS 1.1

2017-03-27 Thread Hema Murthy
Hi,

My system is

FreeBSD 10.2

OpenSSL 1.0.2h

lighttpd :lighttpd-1.4.23

Am trying to disable TLS1.0 and TLS1.1 through lighttpd.conf

but am not sure of what is the equivalent cipher list to be used.

I followed the below link and it didnt work for me.

In case of Appweb Server,I was able to successfully disable TLS1.0 & Above
and TLS1.1 & Above using

SSLProtocol = "ALL -SSLV2 -SSLV3 -TLSV1"

SSLProtocol = "ALL -SSLV2 -SSLV3 -TLSV1.1"



But the same cipher is not working for lighttpd.

Am very new to this and do not know how to proceed further.

Would be great and appreciate if anyone can give me pointers on this.

Please help.



Thanks & Regards,

Hema
-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users