Skip to content

Commit

Permalink
remove integers.h
Browse files Browse the repository at this point in the history
With the requirement of C99 this files becomes redundant.
Add some missing includes and reorder some includes.
  • Loading branch information
pabuhler committed Feb 1, 2024
1 parent 7bd4598 commit 64d24c8
Show file tree
Hide file tree
Showing 21 changed files with 46 additions and 141 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions crypto/cipher/cipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
#include "err.h" /* for srtp_debug */
#include "alloc.h" /* for crypto_alloc(), crypto_free() */

#include <stdlib.h>

srtp_debug_module_t srtp_mod_cipher = {
false, /* debugging is off by default */
"cipher" /* printable module name */
Expand Down
7 changes: 1 addition & 6 deletions crypto/include/datatypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,8 @@
#ifndef DATATYPES_H
#define DATATYPES_H

#include "integers.h" /* definitions of uint32_t, et cetera */
#include "alloc.h"

#include <stdarg.h>
#include <inttypes.h>
#include <stdbool.h>

#include <stdio.h>
#include <string.h>
#include <time.h>
#ifdef HAVE_NETINET_IN_H
Expand Down
103 changes: 0 additions & 103 deletions crypto/include/integers.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto/include/rdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down
10 changes: 2 additions & 8 deletions crypto/kernel/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
#include "alloc.h"
#include "crypto_kernel.h"

#include <stdlib.h>

/* the debug module for memory allocation */

srtp_debug_module_t srtp_mod_alloc = {
Expand All @@ -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;
Expand All @@ -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
5 changes: 3 additions & 2 deletions crypto/kernel/crypto_kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@
#include <config.h>
#endif

#include "alloc.h"

#include "crypto_kernel.h"
#include "cipher_types.h"
#include "alloc.h"

#include <stdlib.h>

/* the debug module for the crypto_kernel */

Expand Down
5 changes: 3 additions & 2 deletions crypto/math/datatypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@
#include <config.h>
#endif

#include "datatypes.h"
#include "alloc.h"

#ifdef OPENSSL
#include <openssl/crypto.h>
#endif

#include "datatypes.h"

#if defined(__SSE2__)
#include <tmmintrin.h>
#endif
Expand Down
4 changes: 3 additions & 1 deletion crypto/test/aes_calc.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@
#endif

#include "aes.h"
#include "util.h"

#include <stdio.h>
#include <string.h>
#include "util.h"
#include <stdlib.h>

void usage(char *prog_name)
{
Expand Down
5 changes: 4 additions & 1 deletion crypto/test/cipher_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,14 @@
#include <config.h>
#endif

#include <stdio.h> /* for printf() */
#include "getopt_s.h"
#include "cipher.h"
#include "cipher_priv.h"
#include "datatypes.h"
#include "alloc.h"

#include <stdio.h> /* for printf() */
#include <stdlib.h>

#define PRINT_DEBUG 0

Expand Down
6 changes: 4 additions & 2 deletions crypto/test/datatypes_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@
#include <config.h>
#endif

#include <stdio.h> /* for printf() */
#include <string.h> /* for strlen() */
#include "datatypes.h"
#include "util.h"

#include <stdio.h> /* for printf() */
#include <string.h> /* for strlen() */
#include <stdlib.h>

void byte_order(void);

void test_hex_string_funcs(void);
Expand Down
4 changes: 3 additions & 1 deletion crypto/test/kernel_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@
#include <config.h>
#endif

#include <stdio.h> /* for printf() */
#include "getopt_s.h"
#include "crypto_kernel.h"

#include <stdio.h> /* for printf() */
#include <stdlib.h>

void usage(char *prog_name)
{
printf("usage: %s [ -v ][ -d debug_module ]*\n", prog_name);
Expand Down
6 changes: 4 additions & 2 deletions crypto/test/sha1_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@
#include <config.h>
#endif

#include <stdio.h>
#include <string.h>
#include "sha1.h"
#include "util.h"

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define SHA_PASS 0
#define SHA_FAIL 1

Expand Down
1 change: 0 additions & 1 deletion include/srtp_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 3 additions & 2 deletions test/rdbx_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@
#include <config.h>
#endif

#include <stdio.h> /* for printf() */
#include "getopt_s.h" /* for local getopt() */

#include "rdbx.h"
#include "cipher_priv.h"

#include <stdio.h> /* for printf() */
#include <stdlib.h>

#ifdef ROC_TEST
#error "srtp_rdbx_t won't work with ROC_TEST - bitmask same size as seq_median"
#endif
Expand Down
6 changes: 3 additions & 3 deletions test/replay_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@
#include <config.h>
#endif

#include <stdio.h>

#include "rdb.h"
#include "ut_sim.h"

#include "cipher_priv.h"

#include <stdio.h>
#include <stdlib.h>

/*
* num_trials defines the number of trials that are used in the
* validation functions below
Expand Down
2 changes: 2 additions & 0 deletions test/roc_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
#include "rdbx.h"
#include "ut_sim.h"

#include <stdlib.h>

srtp_err_status_t roc_test(size_t num_trials);

int main(void)
Expand Down
6 changes: 3 additions & 3 deletions test/rtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@

#include "rtp.h"

#include "cipher_priv.h"

#include <stdio.h>
#include <string.h>

#include <stdlib.h>
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#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 */

Expand Down
4 changes: 3 additions & 1 deletion test/rtp_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,14 @@
*
*/
#include "getopt_s.h" /* for local getopt() */
#include <assert.h> /* for assert() */

#include <pcap.h>
#include "rtp_decoder.h"
#include "util.h"

#include <assert.h> /* for assert() */
#include <stdlib.h>

#ifndef timersub
#define timersub(a, b, result) \
do { \
Expand Down
2 changes: 2 additions & 0 deletions test/ut_sim.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
#include "ut_sim.h"
#include "cipher_priv.h"

#include <stdlib.h>

int ut_compar(const void *a, const void *b)
{
uint8_t r;
Expand Down
2 changes: 1 addition & 1 deletion test/ut_sim.h
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down

0 comments on commit 64d24c8

Please sign in to comment.