From 134fed3a8543ad59d090c74affe47652dae180b1 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 28 Mar 2017 14:27:18 -0700 Subject: Move src/core/lib/tsi --> src/core/tsi --- src/core/tsi/ssl_types.h | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/core/tsi/ssl_types.h (limited to 'src/core/tsi/ssl_types.h') diff --git a/src/core/tsi/ssl_types.h b/src/core/tsi/ssl_types.h new file mode 100644 index 0000000000..0a988effd0 --- /dev/null +++ b/src/core/tsi/ssl_types.h @@ -0,0 +1,55 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPC_CORE_LIB_TSI_SSL_TYPES_H +#define GRPC_CORE_LIB_TSI_SSL_TYPES_H + +/* A collection of macros to cast between various integer types that are + * used differently between BoringSSL and OpenSSL: + * TSI_INT_AS_SIZE(x): convert 'int x' to a length parameter for an OpenSSL + * function + * TSI_SIZE_AS_SIZE(x): convert 'size_t x' to a length parameter for an OpenSSL + * function + */ + +#include + +#ifdef OPENSSL_IS_BORINGSSL +#define TSI_INT_AS_SIZE(x) ((size_t)(x)) +#define TSI_SIZE_AS_SIZE(x) (x) +#else +#define TSI_INT_AS_SIZE(x) (x) +#define TSI_SIZE_AS_SIZE(x) ((int)(x)) +#endif + +#endif /* GRPC_CORE_LIB_TSI_SSL_TYPES_H */ -- cgit v1.2.3 From 730ddc275816c56b0e304ed3aba10505f6901178 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 29 Mar 2017 08:38:47 -0700 Subject: Sanity fixes --- src/core/lib/transport/bdp_estimator.h | 2 +- src/core/tsi/fake_transport_security.h | 6 +++--- src/core/tsi/ssl_transport_security.h | 6 +++--- src/core/tsi/ssl_types.h | 6 +++--- src/core/tsi/transport_security.h | 6 +++--- src/core/tsi/transport_security_interface.h | 6 +++--- test/core/bad_ssl/servers/cert.c | 8 ++++---- 7 files changed, 20 insertions(+), 20 deletions(-) (limited to 'src/core/tsi/ssl_types.h') diff --git a/src/core/lib/transport/bdp_estimator.h b/src/core/lib/transport/bdp_estimator.h index bcaf899910..df8d1f6fc0 100644 --- a/src/core/lib/transport/bdp_estimator.h +++ b/src/core/lib/transport/bdp_estimator.h @@ -73,4 +73,4 @@ void grpc_bdp_estimator_start_ping(grpc_bdp_estimator *estimator); // Completes a previously started ping void grpc_bdp_estimator_complete_ping(grpc_bdp_estimator *estimator); -#endif +#endif /* GRPC_CORE_LIB_TRANSPORT_BDP_ESTIMATOR_H */ diff --git a/src/core/tsi/fake_transport_security.h b/src/core/tsi/fake_transport_security.h index 7c1c8ed195..0697c7279f 100644 --- a/src/core/tsi/fake_transport_security.h +++ b/src/core/tsi/fake_transport_security.h @@ -31,8 +31,8 @@ * */ -#ifndef GRPC_CORE_LIB_TSI_FAKE_TRANSPORT_SECURITY_H -#define GRPC_CORE_LIB_TSI_FAKE_TRANSPORT_SECURITY_H +#ifndef GRPC_CORE_TSI_FAKE_TRANSPORT_SECURITY_H +#define GRPC_CORE_TSI_FAKE_TRANSPORT_SECURITY_H #include "src/core/tsi/transport_security_interface.h" @@ -58,4 +58,4 @@ tsi_frame_protector *tsi_create_fake_protector( } #endif -#endif /* GRPC_CORE_LIB_TSI_FAKE_TRANSPORT_SECURITY_H */ +#endif /* GRPC_CORE_TSI_FAKE_TRANSPORT_SECURITY_H */ diff --git a/src/core/tsi/ssl_transport_security.h b/src/core/tsi/ssl_transport_security.h index afc25da98d..0a527e9021 100644 --- a/src/core/tsi/ssl_transport_security.h +++ b/src/core/tsi/ssl_transport_security.h @@ -31,8 +31,8 @@ * */ -#ifndef GRPC_CORE_LIB_TSI_SSL_TRANSPORT_SECURITY_H -#define GRPC_CORE_LIB_TSI_SSL_TRANSPORT_SECURITY_H +#ifndef GRPC_CORE_TSI_SSL_TRANSPORT_SECURITY_H +#define GRPC_CORE_TSI_SSL_TRANSPORT_SECURITY_H #include "src/core/tsi/transport_security_interface.h" @@ -188,4 +188,4 @@ int tsi_ssl_peer_matches_name(const tsi_peer *peer, const char *name); } #endif -#endif /* GRPC_CORE_LIB_TSI_SSL_TRANSPORT_SECURITY_H */ +#endif /* GRPC_CORE_TSI_SSL_TRANSPORT_SECURITY_H */ diff --git a/src/core/tsi/ssl_types.h b/src/core/tsi/ssl_types.h index 0a988effd0..065cb86800 100644 --- a/src/core/tsi/ssl_types.h +++ b/src/core/tsi/ssl_types.h @@ -31,8 +31,8 @@ * */ -#ifndef GRPC_CORE_LIB_TSI_SSL_TYPES_H -#define GRPC_CORE_LIB_TSI_SSL_TYPES_H +#ifndef GRPC_CORE_TSI_SSL_TYPES_H +#define GRPC_CORE_TSI_SSL_TYPES_H /* A collection of macros to cast between various integer types that are * used differently between BoringSSL and OpenSSL: @@ -52,4 +52,4 @@ #define TSI_SIZE_AS_SIZE(x) ((int)(x)) #endif -#endif /* GRPC_CORE_LIB_TSI_SSL_TYPES_H */ +#endif /* GRPC_CORE_TSI_SSL_TYPES_H */ diff --git a/src/core/tsi/transport_security.h b/src/core/tsi/transport_security.h index 9272714e30..491fa1a8bd 100644 --- a/src/core/tsi/transport_security.h +++ b/src/core/tsi/transport_security.h @@ -31,8 +31,8 @@ * */ -#ifndef GRPC_CORE_LIB_TSI_TRANSPORT_SECURITY_H -#define GRPC_CORE_LIB_TSI_TRANSPORT_SECURITY_H +#ifndef GRPC_CORE_TSI_TRANSPORT_SECURITY_H +#define GRPC_CORE_TSI_TRANSPORT_SECURITY_H #include "src/core/tsi/transport_security_interface.h" @@ -108,4 +108,4 @@ char *tsi_strdup(const char *src); /* Sadly, no strdup in C89. */ } #endif -#endif /* GRPC_CORE_LIB_TSI_TRANSPORT_SECURITY_H */ +#endif /* GRPC_CORE_TSI_TRANSPORT_SECURITY_H */ diff --git a/src/core/tsi/transport_security_interface.h b/src/core/tsi/transport_security_interface.h index 3e8c9d7ffe..caed43eac4 100644 --- a/src/core/tsi/transport_security_interface.h +++ b/src/core/tsi/transport_security_interface.h @@ -31,8 +31,8 @@ * */ -#ifndef GRPC_CORE_LIB_TSI_TRANSPORT_SECURITY_INTERFACE_H -#define GRPC_CORE_LIB_TSI_TRANSPORT_SECURITY_INTERFACE_H +#ifndef GRPC_CORE_TSI_TRANSPORT_SECURITY_INTERFACE_H +#define GRPC_CORE_TSI_TRANSPORT_SECURITY_INTERFACE_H #include #include @@ -350,4 +350,4 @@ void tsi_handshaker_destroy(tsi_handshaker *self); } #endif -#endif /* GRPC_CORE_LIB_TSI_TRANSPORT_SECURITY_INTERFACE_H */ +#endif /* GRPC_CORE_TSI_TRANSPORT_SECURITY_INTERFACE_H */ diff --git a/test/core/bad_ssl/servers/cert.c b/test/core/bad_ssl/servers/cert.c index 71a636c599..2b014b2343 100644 --- a/test/core/bad_ssl/servers/cert.c +++ b/test/core/bad_ssl/servers/cert.c @@ -56,11 +56,11 @@ int main(int argc, char **argv) { grpc_init(); GPR_ASSERT(GRPC_LOG_IF_ERROR( - "load_file", grpc_load_file("src/core/tsi/test_creds/badserver.pem", - 1, &cert_slice))); + "load_file", + grpc_load_file("src/core/tsi/test_creds/badserver.pem", 1, &cert_slice))); GPR_ASSERT(GRPC_LOG_IF_ERROR( - "load_file", grpc_load_file("src/core/tsi/test_creds/badserver.key", - 1, &key_slice))); + "load_file", + grpc_load_file("src/core/tsi/test_creds/badserver.key", 1, &key_slice))); pem_key_cert_pair.private_key = (const char *)GRPC_SLICE_START_PTR(key_slice); pem_key_cert_pair.cert_chain = (const char *)GRPC_SLICE_START_PTR(cert_slice); -- cgit v1.2.3