Skip to content

Commit 32feef9

Browse files
committed
Prefix all wrapper routines with "__aws_" to avoid name clashes.
Fix UA04-001.
1 parent 0da4e06 commit 32feef9

File tree

2 files changed

+52
-24
lines changed

2 files changed

+52
-24
lines changed

config/ssl/openssl/wrappers.c

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/***************************************************************************
22
* Ada Web Server *
33
* *
4-
* Copyright (C) 2012-2018, AdaCore *
4+
* Copyright (C) 2012-2021, AdaCore *
55
* *
66
* This library is free software; you can redistribute it and/or modify *
77
* it under the terms of the GNU General Public License as published by *
@@ -97,50 +97,77 @@ void __aws_SSL_set_tmp_rsa_callback(SSL *ssl,
9797
SSL_set_tmp_rsa_callback(ssl, tmp_rsa_callback);
9898
}
9999

100+
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
100101
int __aws_SSL_library_init(void)
101102
{
102-
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
103103
return OPENSSL_init_ssl(OPENSSL_INIT_SSL_DEFAULT, NULL);
104104
}
105105

106+
unsigned long __aws_OpenSSL_version_num(void)
107+
{
108+
return OpenSSL_version_num();
109+
}
110+
111+
const char * __aws_OpenSSL_version(int t)
112+
{
113+
return OpenSSL_version(t);
114+
}
115+
116+
const SSL_METHOD * __aws_TLS_method(void)
117+
{
118+
return TLS_method();
119+
}
120+
121+
const SSL_METHOD * __aws_TLS_server_method(void)
122+
{
123+
return TLS_server_method();
124+
}
125+
126+
const SSL_METHOD * __aws_TLS_client_method(void)
127+
{
128+
return TLS_client_method();
129+
}
130+
106131
#else
132+
133+
int __aws_SSL_library_init(void)
134+
{
107135
SSL_load_error_strings();
108136
return SSL_library_init();
109137
}
110-
111-
unsigned long OpenSSL_version_num(void)
138+
unsigned long __aws_OpenSSL_version_num(void)
112139
{
113140
return SSLeay();
114141
}
115142

116-
const char * OpenSSL_version(int t)
143+
const char * __aws_OpenSSL_version(int t)
117144
{
118-
return SSLeay_version(t);
145+
return SSLeay_version(t);
119146
}
120147

121-
const SSL_METHOD * TLS_method(void)
148+
const SSL_METHOD * __aws_TLS_method(void)
122149
{
123-
return SSLv23_method();
150+
return SSLv23_method();
124151
}
125152

126-
const SSL_METHOD * TLS_server_method(void)
153+
const SSL_METHOD * __aws_TLS_server_method(void)
127154
{
128-
return SSLv23_server_method();
155+
return SSLv23_server_method();
129156
}
130157

131-
const SSL_METHOD * TLS_client_method(void)
158+
const SSL_METHOD * __aws_TLS_client_method(void)
132159
{
133-
return SSLv23_client_method();
160+
return SSLv23_client_method();
134161
}
135162

136-
EVP_MD_CTX * EVP_MD_CTX_new(void)
163+
#endif
164+
165+
EVP_MD_CTX * __aws_EVP_MD_CTX_new(void)
137166
{
138167
return EVP_MD_CTX_create();
139168
}
140169

141-
void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
170+
void __aws_EVP_MD_CTX_free(EVP_MD_CTX *ctx)
142171
{
143172
EVP_MD_CTX_destroy(ctx);
144173
}
145-
#endif
146-

config/ssl/ssl-thin__openssl.ads

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Secure Sockets Layer --
33
-- --
4-
-- Copyright (C) 2000-2016, AdaCore --
4+
-- Copyright (C) 2000-2021, AdaCore --
55
-- --
66
-- This library is free software; you can redistribute it and/or modify --
77
-- it under terms of the GNU General Public License as published by the --
@@ -758,27 +758,28 @@ package SSL.Thin is
758758
OPENSSL_DIR : constant := 5;
759759

760760
function OpenSSL_version_num return long
761-
with Import, Convention => C, External_Name => "OpenSSL_version_num";
761+
with Import, Convention => C,
762+
External_Name => "__aws_OpenSSL_version_num";
762763
-- Returns OpenSSL numeric release version identifier
763764

764765
function SSLeay return long renames OpenSSL_version_num;
765766

766767
function OpenSSL_version (T : int) return Cstr.chars_ptr
767-
with Import, Convention => C, External_Name => "OpenSSL_version";
768+
with Import, Convention => C, External_Name => "__aws_OpenSSL_version";
768769
-- Returns version information line
769770

770771
-------------------------------
771772
-- Context control routines --
772773
-------------------------------
773774

774775
function TLS_method return SSL_Method
775-
with Import, Convention => C, External_Name => "TLS_method";
776+
with Import, Convention => C, External_Name => "__aws_TLS_method";
776777

777778
function TLS_server_method return SSL_Method
778-
with Import, Convention => C, External_Name => "TLS_server_method";
779+
with Import, Convention => C, External_Name => "__aws_TLS_server_method";
779780

780781
function TLS_client_method return SSL_Method
781-
with Import, Convention => C, External_Name => "TLS_client_method";
782+
with Import, Convention => C, External_Name => "__aws_TLS_client_method";
782783

783784
function TLSv1_method return SSL_Method
784785
with Import, Convention => C, External_Name => "TLSv1_method";
@@ -1017,10 +1018,10 @@ package SSL.Thin is
10171018
type EVP_MD_CTX is new Pointer;
10181019

10191020
function EVP_MD_CTX_new return EVP_MD_CTX
1020-
with Import, Convention => C, External_Name => "EVP_MD_CTX_new";
1021+
with Import, Convention => C, External_Name => "__aws_EVP_MD_CTX_new";
10211022

10221023
procedure EVP_MD_CTX_free (Ctx : EVP_MD_CTX)
1023-
with Import, Convention => C, External_Name => "EVP_MD_CTX_free";
1024+
with Import, Convention => C, External_Name => "__aws_EVP_MD_CTX_free";
10241025

10251026
function EVP_DigestInit (ctx : EVP_MD_CTX; kind : EVP_MD) return int
10261027
with Import, Convention => C, External_Name => "EVP_DigestInit";

0 commit comments

Comments
 (0)