Ensure consumers set up include paths properly.
In some cases, consumers may include a BoringSSL header without setting up include paths. This risks pulling in system OpenSSL headers instead. For almost every BoringSSL header, the first #include is base.h, which does not exist upstream, thus the mistake will be caught. The exception is base.h itself which naturally does not include itself. Have it include an empty is_boringssl.h header to catch this mistake. Change-Id: Ia96586ecc627ff46867d8af8b68138185866f074 Reviewed-on: https://boringssl-review.googlesource.com/14949 Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
parent
b7ded430e4
commit
d403be92a4
@ -65,6 +65,10 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Include a BoringSSL-only header so consumers including this header without
|
||||||
|
* setting up include paths do not accidentally pick up the system
|
||||||
|
* opensslconf.h. */
|
||||||
|
#include <openssl/is_boringssl.h>
|
||||||
#include <openssl/opensslconf.h>
|
#include <openssl/opensslconf.h>
|
||||||
|
|
||||||
#if defined(BORINGSSL_PREFIX)
|
#if defined(BORINGSSL_PREFIX)
|
||||||
|
16
include/openssl/is_boringssl.h
Normal file
16
include/openssl/is_boringssl.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/* Copyright (c) 2017, Google Inc.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||||
|
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||||
|
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
||||||
|
|
||||||
|
/* This header is provided in order to catch include path errors in consuming
|
||||||
|
* BoringSSL. */
|
Loading…
Reference in New Issue
Block a user