Skip to content

Commit 46994f7

Browse files
committed
Add better support for using deprecated symbols internally
OPENSSL_SUPPRESS_DEPRECATED only does half the job, in telling the deprecation macros not to add the warning attribute. However, with 'no-deprecated', the symbols are still removed entirely, while we might still want to use them internally. The solution is to permit <openssl/opensslconf.h> macros to be modified internally, such as undefining OPENSSL_NO_DEPRECATED in this case. However, with the way <openssl/opensslconf.h> includes <openssl/macros.h>, that's easier said than done. That's solved by generating <openssl/configuration.h> instead, and add a new <openssl/opensslconf.h> that includes <openssl/configuration.h> as well as <openssl/macros.h>, thus allowing to replace an inclusion of <openssl/opensslconf.h> with this: #include <openssl/configuration.h> #undef OPENSSL_NO_DEPRECATED #define OPENSSL_SUPPRESS_DEPRECATED #include <openssl/macros.h> Or simply add the following prior to any other openssl inclusion: #include <openssl/configuration.h> #undef OPENSSL_NO_DEPRECATED #define OPENSSL_SUPPRESS_DEPRECATED Note that undefining OPENSSL_NO_DEPRECATED must never be done by applications, since the symbols must still be exported by the library. Internal test programs are excempt of this rule, though. Reviewed-by: Tim Hudson <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> Reviewed-by: Paul Dale <[email protected]> (Merged from openssl#10608)
1 parent 97ba395 commit 46994f7

File tree

6 files changed

+44
-10
lines changed

6 files changed

+44
-10
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# Auto generated headers
2323
/crypto/buildinf.h
2424
/include/crypto/*_conf.h
25-
/include/openssl/opensslconf.h
25+
/include/openssl/configuration.h
2626
/include/openssl/opensslv.h
2727

2828
# Auto generated doc files

CHANGES

+20
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,26 @@
99

1010
Changes between 1.1.1 and 3.0.0 [xx XXX xxxx]
1111

12+
*) Removed include/openssl/opensslconf.h.in and replaced it with
13+
include/openssl/configuration.h.in, which differs in not including
14+
<openssl/macros.h>. A short header include/openssl/opensslconf.h
15+
was added to include both.
16+
17+
This allows internal hacks where one might need to modify the set
18+
of configured macros, for example this if deprecated symbols are
19+
still supposed to be available internally:
20+
21+
#include <openssl/configuration.h>
22+
23+
#undef OPENSSL_NO_DEPRECATED
24+
#define OPENSSL_SUPPRESS_DEPRECATED
25+
26+
#include <openssl/macros.h>
27+
28+
This should not be used by applications that use the exported
29+
symbols, as that will lead to linking errors.
30+
[Richard Levitte]
31+
1232
*) Fixed an an overflow bug in the x64_64 Montgomery squaring procedure
1333
used in exponentiation with 512-bit moduli. No EC algorithms are
1434
affected. Analysis suggests that attacks against 2-prime RSA1024,

INSTALL

+2-2
Original file line numberDiff line numberDiff line change
@@ -836,8 +836,8 @@
836836

837837
Configure creates a build file ("Makefile" on Unix, "makefile" on Windows
838838
and "descrip.mms" on OpenVMS) from a suitable template in Configurations,
839-
and defines various macros in include/openssl/opensslconf.h (generated from
840-
include/openssl/opensslconf.h.in).
839+
and defines various macros in include/openssl/configuration.h (generated
840+
from include/openssl/configuration.h.in).
841841

842842
1c. Configure OpenSSL for building outside of the source tree.
843843

build.info

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ DEPEND[libssl]=libcrypto
99

1010
# Empty DEPEND "indices" means the dependencies are expected to be built
1111
# unconditionally before anything else.
12-
DEPEND[]=include/openssl/opensslconf.h include/openssl/opensslv.h \
12+
DEPEND[]=include/openssl/configuration.h include/openssl/opensslv.h \
1313
include/crypto/bn_conf.h include/crypto/dso_conf.h \
1414
doc/man7/openssl_user_macros.pod
1515

16-
GENERATE[include/openssl/opensslconf.h]=include/openssl/opensslconf.h.in
16+
GENERATE[include/openssl/configuration.h]=include/openssl/configuration.h.in
1717
GENERATE[include/openssl/opensslv.h]=include/openssl/opensslv.h.in
1818
GENERATE[include/crypto/bn_conf.h]=include/crypto/bn_conf.h.in
1919
GENERATE[include/crypto/dso_conf.h]=include/crypto/dso_conf.h.in

include/openssl/opensslconf.h.in include/openssl/configuration.h.in

+3-5
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
* https://www.openssl.org/source/license.html
1010
*/
1111

12-
#ifndef OPENSSL_OPENSSLCONF_H
13-
# define OPENSSL_OPENSSLCONF_H
12+
#ifndef OPENSSL_CONFIGURATION_H
13+
# define OPENSSL_CONFIGURATION_H
1414

1515
# ifdef __cplusplus
1616
extern "C" {
@@ -65,6 +65,4 @@ extern "C" {
6565
}
6666
# endif
6767

68-
# include <openssl/macros.h>
69-
70-
#endif /* OPENSSL_OPENSSLCONF_H */
68+
#endif /* OPENSSL_CONFIGURATION_H */

include/openssl/opensslconf.h

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License 2.0 (the "License"). You may not use
5+
* this file except in compliance with the License. You can obtain a copy
6+
* in the file LICENSE in the source distribution or at
7+
* https://www.openssl.org/source/license.html
8+
*/
9+
10+
#ifndef OPENSSL_OPENSSLCONF_H
11+
# define OPENSSL_OPENSSLCONF_H
12+
13+
#include <openssl/configuration.h>
14+
#include <openssl/macros.h>
15+
16+
#endif /* OPENSSL_OPENSSLCONF_H */

0 commit comments

Comments
 (0)