Skip to content

Commit

Permalink
Avoid redefinition warning for OPENSSL_API_COMPAT (#5646)
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
  • Loading branch information
MiguelCompany authored Feb 12, 2025
1 parent 80347b5 commit e0c453b
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/cpp/rtps/transport/TCPAcceptorSecure.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
#ifndef _FASTDDS_TCP_ACCEPTOR_SECURE_
#define _FASTDDS_TCP_ACCEPTOR_SECURE_

#ifdef OPENSSL_API_COMPAT
#undef OPENSSL_API_COMPAT
#endif // ifdef OPENSSL_API_COMPAT
#define OPENSSL_API_COMPAT 10101

#include <asio/ssl.hpp>
Expand Down
3 changes: 3 additions & 0 deletions src/cpp/rtps/transport/TCPChannelResourceSecure.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
#ifndef _FASTDDS_TCP_CHANNEL_RESOURCE_SECURE_
#define _FASTDDS_TCP_CHANNEL_RESOURCE_SECURE_

#ifdef OPENSSL_API_COMPAT
#undef OPENSSL_API_COMPAT
#endif // ifdef OPENSSL_API_COMPAT
#define OPENSSL_API_COMPAT 10101

#include <asio.hpp>
Expand Down
8 changes: 7 additions & 1 deletion src/cpp/rtps/transport/TCPTransportInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
#ifndef _FASTDDS_TCP_TRANSPORT_INTERFACE_H_
#define _FASTDDS_TCP_TRANSPORT_INTERFACE_H_

#if TLS_FOUND
#ifdef OPENSSL_API_COMPAT
#undef OPENSSL_API_COMPAT
#endif // ifdef OPENSSL_API_COMPAT
#define OPENSSL_API_COMPAT 10101
#endif // if TLS_FOUND

#include <vector>
#include <map>
#include <memory>
Expand All @@ -35,7 +42,6 @@
#include <rtps/transport/TCPChannelResourceBasic.h>

#if TLS_FOUND
#define OPENSSL_API_COMPAT 10101
#include <rtps/transport/TCPAcceptorSecure.h>
#include <asio/ssl.hpp>
#endif // if TLS_FOUND
Expand Down
3 changes: 3 additions & 0 deletions src/cpp/security/artifact_providers/Pkcs11Provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

// TODO This isn't a proper fix for compatibility with OpenSSL 3.0, but
// suppresses the warnings until true OpenSSL 3.0 APIs can be used.
#ifdef OPENSSL_API_COMPAT
#undef OPENSSL_API_COMPAT
#endif // ifdef OPENSSL_API_COMPAT
#define OPENSSL_API_COMPAT 10101

#include <security/artifact_providers/Pkcs11Provider.hpp>
Expand Down
3 changes: 3 additions & 0 deletions src/cpp/security/authentication/PKIDH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

// TODO This isn't a proper fix for compatibility with OpenSSL 3.0, but
// suppresses the warnings until true OpenSSL 3.0 APIs can be used.
#ifdef OPENSSL_API_COMPAT
#undef OPENSSL_API_COMPAT
#endif // ifdef OPENSSL_API_COMPAT
#define OPENSSL_API_COMPAT 10101

#include <security/authentication/PKIDH.h>
Expand Down
3 changes: 3 additions & 0 deletions test/unittest/security/authentication/BuiltinPKIDHTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

// TODO This isn't a proper fix for compatibility with OpenSSL 3.0, but
// suppresses the warnings until true OpenSSL 3.0 APIs can be used.
#ifdef OPENSSL_API_COMPAT
#undef OPENSSL_API_COMPAT
#endif // ifdef OPENSSL_API_COMPAT
#define OPENSSL_API_COMPAT 10101

#include <iostream>
Expand Down

0 comments on commit e0c453b

Please sign in to comment.