diff options
author | Hugo Landau <hlandau@openssl.org> | 2023-08-30 13:45:40 +0100 |
---|---|---|
committer | Hugo Landau <hlandau@openssl.org> | 2023-09-01 14:02:50 +0100 |
commit | 2619d10ace8ee8e56425771bac48aa12769421f2 (patch) | |
tree | 7f2f0d302cf5cce6e9ca268668dd464851bddb4b | |
parent | d492e34351ae49e899a7c66f1882703a4fedced2 (diff) |
BIO: Allow third parties to use integers instead of pointers for poll descriptors
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21905)
-rw-r--r-- | doc/man3/BIO_get_rpoll_descriptor.pod | 12 | ||||
-rw-r--r-- | include/openssl/bio.h.in | 7 |
2 files changed, 10 insertions, 9 deletions
diff --git a/doc/man3/BIO_get_rpoll_descriptor.pod b/doc/man3/BIO_get_rpoll_descriptor.pod index 9de9f1fb01..ce33e23f26 100644 --- a/doc/man3/BIO_get_rpoll_descriptor.pod +++ b/doc/man3/BIO_get_rpoll_descriptor.pod @@ -10,10 +10,11 @@ can be used to determine when a BIO object can next be read or written #include <openssl/bio.h> typedef struct bio_poll_descriptor_st { - int type; + uint32_t type; union { - int fd; - void *custom; + int fd; + void *custom; + uintptr_t custom_ui; } value; } BIO_POLL_DESCRIPTOR; @@ -71,9 +72,8 @@ complete a BIO_write() operation. =item BIO_POLL_DESCRIPTOR_CUSTOM_START Type values beginning with this value (inclusive) are reserved for application -allocation for custom poll descriptor types. The field I<value.custom> in the -B<BIO_POLL_DESCRIPTOR> is an opaque pointer which can be used by the application -arbitrarily. +allocation for custom poll descriptor types. Any of the definitions in the union +field I<value> can be used by the application arbitrarily as opaque values. =back diff --git a/include/openssl/bio.h.in b/include/openssl/bio.h.in index aa05d7d9cf..735361b17b 100644 --- a/include/openssl/bio.h.in +++ b/include/openssl/bio.h.in @@ -387,10 +387,11 @@ typedef struct bio_mmsg_cb_args_st { #define BIO_POLL_DESCRIPTOR_CUSTOM_START 8192 typedef struct bio_poll_descriptor_st { - int type; + uint32_t type; union { - int fd; - void *custom; + int fd; + void *custom; + uintptr_t custom_ui; } value; } BIO_POLL_DESCRIPTOR; |