RE: [PATCH] OpenSSL: Mark underlying BIO with the appropriate type flags

From: Itamar Gafni <itamar(dot)gafni(at)imperva(dot)com>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: RE: [PATCH] OpenSSL: Mark underlying BIO with the appropriate type flags
Date: 2021-08-12 10:00:24
Message-ID: SN6PR06MB3966BC4AA8DA8B0704FB2C8F8AF99@SN6PR06MB3966.namprd06.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Not sure what is the expected use with previous versions. It used to be that the BIO_s_socket() would return a non-const pointer, so the original socket methods object could be edited.
Copying it means there are two BIO_METHOD objects with the same type (ortig socket and its copy) but it's unclear if that's an issue.

Itamar Gafni
Imperva

-----Original Message-----
From: Daniel Gustafsson <daniel(at)yesql(dot)se>
Sent: Monday, 9 August 2021 18:36
To: Itamar Gafni <itamar(dot)gafni(at)imperva(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] OpenSSL: Mark underlying BIO with the appropriate type flags

CAUTION: This message was sent from outside the company. Do not click links or open attachments unless you recognize the sender and know the content is safe.

> On 6 Aug 2021, at 12:16, Itamar Gafni <itamar(dot)gafni(at)imperva(dot)com> wrote:

> Previous to OpenSSL version 1.1.0, the BIO methods object would be copied directly from the existing socket type and then its read\write functions would be replaced.
> With 1.1.0 and up, the object is created from scratch and then all its methods are initialized to be the ones of the socket type, except read/write which are custom.
> In this newer way, a new type is given to it by calling “BIO_get_new_index”, but the related type flags aren’t added.

According to the documentation (I haven't tested it yet but will) I think you are right that the type should be set with the appropriate BIO_TYPE_ flags.

For OpenSSL 1.0.1 and 1.0.2, wouldn't we need to set the .type with a randomly chosen index anded with BIO_TYPE_DESCRIPTOR and BIO_TYPE_SOURCE_SINK as well?

--
Daniel Gustafsson https://vmware.com/

-------------------------------------------
NOTICE:
This email and all attachments are confidential, may be proprietary, and may be privileged or otherwise protected from disclosure. They are intended solely for the individual or entity to whom the email is addressed. However, mistakes sometimes happen in addressing emails. If you believe that you are not an intended recipient, please stop reading immediately. Do not copy, forward, or rely on the contents in any way. Notify the sender and/or Imperva, Inc. by telephone at +1 (650) 832-6006 and then delete or destroy any copy of this email and its attachments. The sender reserves and asserts all rights to confidentiality, as well as any privileges that may apply. Any disclosure, copying, distribution or action taken or omitted to be taken by an unintended recipient in reliance on this message is prohibited and may be unlawful.
Please consider the environment before printing this email.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-08-12 11:00:12 Re: [bug] Logical Decoding of relation rewrite with toast does not reset toast_hash
Previous Message Amit Kapila 2021-08-12 09:38:19 Re: [bug] Logical Decoding of relation rewrite with toast does not reset toast_hash