diff --git a/CMakeLists.txt b/CMakeLists.txt index 700c3a958..d419d8202 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -220,7 +220,6 @@ set(SOURCES_H crypto/include/datatypes.h crypto/include/err.h crypto/include/hmac.h - crypto/include/integers.h crypto/include/key.h crypto/include/null_auth.h crypto/include/null_cipher.h diff --git a/crypto/cipher/cipher.c b/crypto/cipher/cipher.c index 35a2321b6..4458c276b 100644 --- a/crypto/cipher/cipher.c +++ b/crypto/cipher/cipher.c @@ -54,6 +54,8 @@ #include "err.h" /* for srtp_debug */ #include "alloc.h" /* for crypto_alloc(), crypto_free() */ +#include + srtp_debug_module_t srtp_mod_cipher = { false, /* debugging is off by default */ "cipher" /* printable module name */ diff --git a/crypto/include/datatypes.h b/crypto/include/datatypes.h index 4510cc870..a64fd0cd9 100644 --- a/crypto/include/datatypes.h +++ b/crypto/include/datatypes.h @@ -46,13 +46,8 @@ #ifndef DATATYPES_H #define DATATYPES_H -#include "integers.h" /* definitions of uint32_t, et cetera */ -#include "alloc.h" - -#include +#include #include - -#include #include #include #ifdef HAVE_NETINET_IN_H diff --git a/crypto/include/integers.h b/crypto/include/integers.h deleted file mode 100644 index 01136d631..000000000 --- a/crypto/include/integers.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * integers.h - * - * defines integer types (or refers to their definitions) - * - * David A. McGrew - * Cisco Systems, Inc. - */ - -/* - * - * Copyright (c) 2001-2017, Cisco Systems, 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 the Cisco Systems, 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 HOLDERS 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 INTEGERS_H -#define INTEGERS_H - -/* use standard integer definitions, if they're available */ -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_STDINT_H -#include -#endif -#ifdef HAVE_INTTYPES_H -#include -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_INT_TYPES_H -#include /* this exists on Sun OS */ -#endif -#ifdef HAVE_MACHINE_TYPES_H -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* Can we do 64 bit integers? */ -#if !defined(HAVE_UINT64_T) -#if SIZEOF_UNSIGNED_LONG == 8 -typedef unsigned long uint64_t; -#elif SIZEOF_UNSIGNED_LONG_LONG == 8 -typedef unsigned long long uint64_t; -#else -#error "NO_64BIT_MATH" -#endif -#endif - -/* Reasonable defaults for 32 bit machines - you may need to - * edit these definitions for your own machine. */ -#ifndef HAVE_UINT8_T -typedef unsigned char uint8_t; -#endif -#ifndef HAVE_UINT16_T -typedef unsigned short int uint16_t; -#endif -#ifndef HAVE_UINT32_T -typedef unsigned int uint32_t; -#endif -#ifndef HAVE_INT32_T -typedef int int32_t; -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* INTEGERS_H */ diff --git a/crypto/include/rdb.h b/crypto/include/rdb.h index 208dff3ff..f65925e4a 100644 --- a/crypto/include/rdb.h +++ b/crypto/include/rdb.h @@ -46,7 +46,6 @@ #ifndef REPLAY_DB_H #define REPLAY_DB_H -#include "integers.h" /* for uint32_t */ #include "datatypes.h" /* for v128_t */ #include "err.h" /* for srtp_err_status_t */ diff --git a/crypto/kernel/alloc.c b/crypto/kernel/alloc.c index f36152d58..d48aae55e 100644 --- a/crypto/kernel/alloc.c +++ b/crypto/kernel/alloc.c @@ -49,6 +49,8 @@ #include "alloc.h" #include "crypto_kernel.h" +#include + /* the debug module for memory allocation */ srtp_debug_module_t srtp_mod_alloc = { @@ -65,8 +67,6 @@ srtp_debug_module_t srtp_mod_alloc = { * address. */ -#if defined(HAVE_STDLIB_H) - void *srtp_crypto_alloc(size_t size) { void *ptr; @@ -93,9 +93,3 @@ void srtp_crypto_free(void *ptr) free(ptr); } - -#else /* we need to define our own memory allocation routines */ - -#error no memory allocation defined yet - -#endif diff --git a/crypto/kernel/crypto_kernel.c b/crypto/kernel/crypto_kernel.c index b83d3a164..f85a5ffbb 100644 --- a/crypto/kernel/crypto_kernel.c +++ b/crypto/kernel/crypto_kernel.c @@ -46,10 +46,11 @@ #include #endif -#include "alloc.h" - #include "crypto_kernel.h" #include "cipher_types.h" +#include "alloc.h" + +#include /* the debug module for the crypto_kernel */ diff --git a/crypto/math/datatypes.c b/crypto/math/datatypes.c index 9930fcd7c..5daaf1258 100644 --- a/crypto/math/datatypes.c +++ b/crypto/math/datatypes.c @@ -47,12 +47,13 @@ #include #endif +#include "datatypes.h" +#include "alloc.h" + #ifdef OPENSSL #include #endif -#include "datatypes.h" - #if defined(__SSE2__) #include #endif diff --git a/crypto/test/aes_calc.c b/crypto/test/aes_calc.c index 0a2a22751..9aaa54f33 100644 --- a/crypto/test/aes_calc.c +++ b/crypto/test/aes_calc.c @@ -61,9 +61,11 @@ #endif #include "aes.h" +#include "util.h" + #include #include -#include "util.h" +#include void usage(char *prog_name) { diff --git a/crypto/test/cipher_driver.c b/crypto/test/cipher_driver.c index 89806b024..f15073efb 100644 --- a/crypto/test/cipher_driver.c +++ b/crypto/test/cipher_driver.c @@ -47,11 +47,14 @@ #include #endif -#include /* for printf() */ #include "getopt_s.h" #include "cipher.h" #include "cipher_priv.h" #include "datatypes.h" +#include "alloc.h" + +#include /* for printf() */ +#include #define PRINT_DEBUG 0 diff --git a/crypto/test/datatypes_driver.c b/crypto/test/datatypes_driver.c index b30401935..f4b613606 100644 --- a/crypto/test/datatypes_driver.c +++ b/crypto/test/datatypes_driver.c @@ -47,11 +47,13 @@ #include #endif -#include /* for printf() */ -#include /* for strlen() */ #include "datatypes.h" #include "util.h" +#include /* for printf() */ +#include /* for strlen() */ +#include + void byte_order(void); void test_hex_string_funcs(void); diff --git a/crypto/test/kernel_driver.c b/crypto/test/kernel_driver.c index ada85dca3..e305b6d30 100644 --- a/crypto/test/kernel_driver.c +++ b/crypto/test/kernel_driver.c @@ -46,10 +46,12 @@ #include #endif -#include /* for printf() */ #include "getopt_s.h" #include "crypto_kernel.h" +#include /* for printf() */ +#include + void usage(char *prog_name) { printf("usage: %s [ -v ][ -d debug_module ]*\n", prog_name); diff --git a/crypto/test/sha1_driver.c b/crypto/test/sha1_driver.c index 90ef2ad99..858bedc8f 100644 --- a/crypto/test/sha1_driver.c +++ b/crypto/test/sha1_driver.c @@ -47,11 +47,13 @@ #include #endif -#include -#include #include "sha1.h" #include "util.h" +#include +#include +#include + #define SHA_PASS 0 #define SHA_FAIL 1 diff --git a/include/srtp_priv.h b/include/srtp_priv.h index 8fa4b08c3..b3244a010 100644 --- a/include/srtp_priv.h +++ b/include/srtp_priv.h @@ -51,7 +51,6 @@ #include "srtp.h" #include "rdbx.h" #include "rdb.h" -#include "integers.h" #include "cipher.h" #include "auth.h" #include "aes.h" diff --git a/test/rdbx_driver.c b/test/rdbx_driver.c index 399376380..f420134a7 100644 --- a/test/rdbx_driver.c +++ b/test/rdbx_driver.c @@ -46,12 +46,13 @@ #include #endif -#include /* for printf() */ #include "getopt_s.h" /* for local getopt() */ - #include "rdbx.h" #include "cipher_priv.h" +#include /* for printf() */ +#include + #ifdef ROC_TEST #error "srtp_rdbx_t won't work with ROC_TEST - bitmask same size as seq_median" #endif diff --git a/test/replay_driver.c b/test/replay_driver.c index 662b00a00..d751e7f9c 100644 --- a/test/replay_driver.c +++ b/test/replay_driver.c @@ -47,13 +47,13 @@ #include #endif -#include - #include "rdb.h" #include "ut_sim.h" - #include "cipher_priv.h" +#include +#include + /* * num_trials defines the number of trials that are used in the * validation functions below diff --git a/test/roc_driver.c b/test/roc_driver.c index 466a95628..1010fd0e3 100644 --- a/test/roc_driver.c +++ b/test/roc_driver.c @@ -60,6 +60,8 @@ #include "rdbx.h" #include "ut_sim.h" +#include + srtp_err_status_t roc_test(size_t num_trials); int main(void) diff --git a/test/rtp.c b/test/rtp.c index 4c8ca571a..718e38c32 100644 --- a/test/rtp.c +++ b/test/rtp.c @@ -45,16 +45,16 @@ #include "rtp.h" +#include "cipher_priv.h" + #include #include - +#include #include #ifdef HAVE_SYS_SOCKET_H #include #endif -#include "cipher_priv.h" - #define PRINT_DEBUG 0 /* set to 1 to print out debugging data */ #define VERBOSE_DEBUG 0 /* set to 1 to print out more data */ diff --git a/test/rtp_decoder.c b/test/rtp_decoder.c index 20023e390..6a413b8b9 100644 --- a/test/rtp_decoder.c +++ b/test/rtp_decoder.c @@ -63,12 +63,14 @@ * */ #include "getopt_s.h" /* for local getopt() */ -#include /* for assert() */ #include #include "rtp_decoder.h" #include "util.h" +#include /* for assert() */ +#include + #ifndef timersub #define timersub(a, b, result) \ do { \ diff --git a/test/ut_sim.c b/test/ut_sim.c index 06f494910..02099cf7e 100644 --- a/test/ut_sim.c +++ b/test/ut_sim.c @@ -51,6 +51,8 @@ #include "ut_sim.h" #include "cipher_priv.h" +#include + int ut_compar(const void *a, const void *b) { uint8_t r; diff --git a/test/ut_sim.h b/test/ut_sim.h index e678b5fdf..5462ccee2 100644 --- a/test/ut_sim.h +++ b/test/ut_sim.h @@ -47,7 +47,7 @@ #ifndef UT_SIM_H #define UT_SIM_H -#include "integers.h" /* for uint32_t */ +#include "datatypes.h" #ifdef __cplusplus extern "C" {