Fix minor stylistic issues with ssl.h.

Mostly stuff that doc.go was grumpy about. The main change is to move the
version-specific headers to the bottom. Injecting them in the middle makes it
seem as if the definitions above the #include and those below are somehow
different, but it compiles fine with them at the bottom. (They have to be at
the bottom because those headers depend on ssl.h.)

Change-Id: Iaa4139d2f157c7a3fd0ea609b78ff11d2edfc7b0
Reviewed-on: https://boringssl-review.googlesource.com/4289
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
David Benjamin 2015-04-08 23:46:10 -04:00 committed by Adam Langley
parent 5c366d62e8
commit 087e4fa478

View File

@ -140,8 +140,8 @@
* OTHERWISE. * OTHERWISE.
*/ */
#ifndef HEADER_SSL_H #ifndef OPENSSL_HEADER_SSL_H
#define HEADER_SSL_H #define OPENSSL_HEADER_SSL_H
#include <openssl/base.h> #include <openssl/base.h>
@ -159,7 +159,7 @@
/* Some code expected to get the threading functions by including ssl.h. */ /* Some code expected to get the threading functions by including ssl.h. */
#include <openssl/thread.h> #include <openssl/thread.h>
#ifdef __cplusplus #if defined(__cplusplus)
extern "C" { extern "C" {
#endif #endif
@ -1341,21 +1341,6 @@ struct ssl_st {
EVP_MD_CTX *read_hash; EVP_MD_CTX *read_hash;
}; };
#ifdef __cplusplus
}
#endif
#include <openssl/ssl2.h>
#include <openssl/ssl3.h>
#include <openssl/tls1.h> /* This is mostly sslv3 with a few tweaks */
#include <openssl/dtls1.h> /* Datagram TLS */
#include <openssl/ssl23.h>
#include <openssl/srtp.h> /* Support for the use_srtp extension */
#ifdef __cplusplus
extern "C" {
#endif
/* compatibility */ /* compatibility */
#define SSL_set_app_data(s, arg) (SSL_set_ex_data(s, 0, (char *)arg)) #define SSL_set_app_data(s, arg) (SSL_set_ex_data(s, 0, (char *)arg))
#define SSL_get_app_data(s) (SSL_get_ex_data(s, 0)) #define SSL_get_app_data(s) (SSL_get_ex_data(s, 0))
@ -2268,10 +2253,26 @@ OPENSSL_EXPORT int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method);
OPENSSL_EXPORT const char *SSLeay_version(int unused); OPENSSL_EXPORT const char *SSLeay_version(int unused);
#ifdef __cplusplus #if defined(__cplusplus)
} } /* extern C */
#endif #endif
/* Library consumers assume these headers are included by ssl.h, but they depend
* on ssl.h, so include them after all declarations.
*
* TODO(davidben): The separation between ssl.h and these version-specific
* headers introduces circular dependencies and is inconsistent. The function
* declarations should move to ssl.h. Many of the constants can probably be
* pruned or unexported. */
#include <openssl/ssl2.h>
#include <openssl/ssl3.h>
#include <openssl/tls1.h> /* This is mostly sslv3 with a few tweaks */
#include <openssl/dtls1.h> /* Datagram TLS */
#include <openssl/ssl23.h>
#include <openssl/srtp.h> /* Support for the use_srtp extension */
/* BEGIN ERROR CODES */ /* BEGIN ERROR CODES */
/* The following lines are auto generated by the script make_errors.go. Any /* The following lines are auto generated by the script make_errors.go. Any
* changes made after this point may be overwritten when the script is next run. * changes made after this point may be overwritten when the script is next run.
@ -2649,4 +2650,4 @@ OPENSSL_EXPORT const char *SSLeay_version(int unused);
#define SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE 1113 #define SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE 1113
#define SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE 1114 #define SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE 1114
#endif #endif /* OPENSSL_HEADER_SSL_H */