Replacement for BIO_get_port(), BIO_get_host_ip()
Matt Caswell
matt at openssl.org
Mon Sep 27 09:35:42 UTC 2021
On 24/09/2021 07:05, Shivakumar Poojari wrote:
> Hi
> BIO_get_port(), BIO_get_host_ip(), were deprecated in OpenSSL 1.1.0.
> Trying for replacement for OpenSSl 3.0
>
> Gone through the below man page, but not found alternative function.
>
> https://www.openssl.org/docs/manmaster/man3/BIO_connect.html
> <https://www.openssl.org/docs/manmaster/man3/BIO_connect.html>
>
> please suggest,
These functions are deprecated because they only support IPv4.
Instead you can use BIO_lookup() (or possibly BIO_lookup_ex()) to lookup
the given host/service (first and second parameters to BIO_lookup()
respectively). Equivalent 3rd/4th/5th parameters to BIO_lookup() might
be BIO_LOOKUP_CLIENT, AF_INET (for IPv4) and SOCK_STREAM (for TCP).
This will return you an initialised BIO_ADDRINFO() object (which you
will have to later free using BIO_ADDRINFO_free()).
From the BIO_ADDRINFO object you can get a pointer to an underlying
BIO_ADDR using BIO_ADDRINFO_address(addrinfo). Finally you can use
BIO_ADDR_rawaddress() to get address info, or BIO_ADDR_rawport() to get
port info:
See:
https://www.openssl.org/docs/man3.0/man3/BIO_lookup.html
https://www.openssl.org/docs/man3.0/man3/BIO_ADDR_rawaddress.html
Matt
More information about the openssl-users
mailing list