hcrypto: config/roken cleanup

All source files in lib/hcrypto should be built the same way.
Since this source directory is dependent on libroken then all source
files must be built using the roken.h declarations and included headers.

Also, there is no config.h in the local directory so angle brackets
include of quotes should be used.

Finally, because roken.h includes stdio.h, stdlib.h, stdarg.h, limits.h,
strings.h, sys/types.h, etc., do not include them separately.

Start all source files with

  #include <config.h>
  #include <roken.h>

Change-Id: I09ab47f8a5472018efe6c8b59a0e51fde8f24724
This commit is contained in:
Jeffrey Altman
2015-12-26 14:07:38 -05:00
parent 62f982a87b
commit 0f97855826
60 changed files with 84 additions and 238 deletions

View File

@@ -31,15 +31,13 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include "config.h" #include <config.h>
#include <roken.h>
#ifdef KRB5 #ifdef KRB5
#include <krb5-types.h> #include <krb5-types.h>
#endif #endif
#include <string.h>
#include "rijndael-alg-fst.h" #include "rijndael-alg-fst.h"
#include "aes.h" #include "aes.h"

View File

@@ -32,15 +32,9 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <krb5-types.h> #include <krb5-types.h>
#include <roken.h>
#include <rfc2459_asn1.h> /* XXX */ #include <rfc2459_asn1.h> /* XXX */
#include <der.h> #include <der.h>

View File

@@ -30,16 +30,12 @@
* http://info.isl.ntt.co.jp/crypt/eng/camellia/specifications.html * http://info.isl.ntt.co.jp/crypt/eng/camellia/specifications.html
*/ */
#include "config.h" #include <config.h>
#include <roken.h>
#include <string.h>
#include <stdlib.h>
#include <krb5-types.h> #include <krb5-types.h>
#include "camellia-ntt.h" #include "camellia-ntt.h"
#include <roken.h>
/* key constants */ /* key constants */
#define CAMELLIA_SIGMA1L (0xA09E667FL) #define CAMELLIA_SIGMA1L (0xA09E667FL)

View File

@@ -31,19 +31,16 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include "config.h" #include <config.h>
#include <roken.h>
#ifdef KRB5 #ifdef KRB5
#include <krb5-types.h> #include <krb5-types.h>
#endif #endif
#include <string.h>
#include "camellia-ntt.h" #include "camellia-ntt.h"
#include "camellia.h" #include "camellia.h"
#include <roken.h>
int int
CAMELLIA_set_key(const unsigned char *userkey, CAMELLIA_set_key(const unsigned char *userkey,
const int bits, CAMELLIA_KEY *key) const int bits, CAMELLIA_KEY *key)

View File

@@ -34,11 +34,7 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <krb5-types.h> #include <krb5-types.h>
#include <rfc2459_asn1.h> #include <rfc2459_asn1.h>

View File

@@ -83,17 +83,12 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#define HC_DEPRECATED #define HC_DEPRECATED
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <krb5-types.h> #include <krb5-types.h>
#include <assert.h> #include <assert.h>
#include <roken.h>
#include "des.h" #include "des.h"
#include "ui.h" #include "ui.h"

View File

@@ -31,15 +31,13 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include "config.h" #include <config.h>
#include <roken.h>
#ifdef KRB5 #ifdef KRB5
#include <krb5-types.h> #include <krb5-types.h>
#endif #endif
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif

View File

@@ -34,13 +34,10 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#endif #endif
#include <stdio.h>
#include <stdlib.h>
#include <dh.h>
#include <roken.h> #include <roken.h>
#include <dh.h>
#include "tommath.h" #include "tommath.h"
static void static void

View File

@@ -32,13 +32,10 @@
*/ */
#include <config.h> #include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <dh.h>
#include <roken.h> #include <roken.h>
#include <dh.h>
#ifdef USE_HCRYPTO_TFM #ifdef USE_HCRYPTO_TFM
#include "tfm.h" #include "tfm.h"

View File

@@ -34,16 +34,13 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#endif #endif
#include <roken.h>
#include <stdio.h>
#include <stdlib.h>
#include <krb5-types.h> #include <krb5-types.h>
#include <rfc2459_asn1.h> #include <rfc2459_asn1.h>
#include <dh.h> #include <dh.h>
#include <roken.h>
/** /**
* @page page_dh DH - Diffie-Hellman key exchange * @page page_dh DH - Diffie-Hellman key exchange
* *

View File

@@ -32,13 +32,10 @@
*/ */
#include <config.h> #include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <dsa.h>
#include <roken.h> #include <roken.h>
#include <dsa.h>
/* /*
* *
*/ */

View File

@@ -31,6 +31,9 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include <config.h>
#include <roken.h>
#include "ec.h" #include "ec.h"
struct EC_POINT { struct EC_POINT {

View File

@@ -32,10 +32,7 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <engine.h> #include <engine.h>

View File

@@ -37,12 +37,9 @@
#ifdef __APPLE__ #ifdef __APPLE__
#include "config.h" #include <config.h>
#include <roken.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h> #include <assert.h>
#ifdef HAVE_COMMONCRYPTO_COMMONDIGEST_H #ifdef HAVE_COMMONCRYPTO_COMMONDIGEST_H

View File

@@ -34,13 +34,10 @@
/* Windows crypto provider plugin, sample */ /* Windows crypto provider plugin, sample */
#include <config.h> #include <config.h>
#include <roken.h>
#define HC_DEPRECATED #define HC_DEPRECATED
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h> #include <assert.h>
#include <evp.h> #include <evp.h>

View File

@@ -32,13 +32,10 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#define HC_DEPRECATED #define HC_DEPRECATED
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h> #include <assert.h>
#include <evp.h> #include <evp.h>

View File

@@ -30,9 +30,8 @@
/* PKCS#11 provider */ /* PKCS#11 provider */
#include "config.h" #include <config.h>
#include <roken.h> #include <roken.h>
#include <assert.h> #include <assert.h>
#ifdef HAVE_DLFCN_H #ifdef HAVE_DLFCN_H
#include <dlfcn.h> #include <dlfcn.h>

View File

@@ -35,9 +35,9 @@
* crypto APIs from Vista onwards). * crypto APIs from Vista onwards).
*/ */
#include "config.h" #include <config.h>
#include <roken.h>
#include <windows.h>
#include <assert.h> #include <assert.h>
#include <evp.h> #include <evp.h>

View File

@@ -30,9 +30,8 @@
/* Windows CNG provider */ /* Windows CNG provider */
#include "config.h" #include <config.h>
#include <roken.h>
#include <windows.h>
#include <assert.h> #include <assert.h>
#include <evp.h> #include <evp.h>

View File

@@ -34,14 +34,11 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#endif #endif
#include <roken.h>
#define HC_DEPRECATED #define HC_DEPRECATED
#define HC_DEPRECATED_CRYPTO #define HC_DEPRECATED_CRYPTO
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h> #include <assert.h>
#include <evp.h> #include <evp.h>
@@ -51,7 +48,6 @@
#include <evp-pkcs11.h> #include <evp-pkcs11.h>
#include <krb5-types.h> #include <krb5-types.h>
#include <roken.h>
#ifndef HCRYPTO_DEF_PROVIDER #ifndef HCRYPTO_DEF_PROVIDER
# ifdef __APPLE__ # ifdef __APPLE__

View File

@@ -31,17 +31,15 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include <config.h>
#include <roken.h>
#include <krb5-types.h> /* should really be stdint.h */ #include <krb5-types.h> /* should really be stdint.h */
#include <hcrypto/evp.h> #include <hcrypto/evp.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <err.h> #include <err.h>
#include <assert.h> #include <assert.h>
#include "roken.h"
/* key and initial vector */ /* key and initial vector */
static char key[16] = static char key[16] =
"\xaa\xbb\x45\xd4\xaa\xbb\x45\xd4" "\xaa\xbb\x45\xd4\xaa\xbb\x45\xd4"

View File

@@ -31,10 +31,9 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include <sys/types.h> #include <config.h>
#include <stdio.h> #include <roken.h>
#include <stdlib.h>
#include <string.h>
#include <hmac.h> #include <hmac.h>
void void

View File

@@ -31,7 +31,8 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include "config.h" #include <config.h>
#include <roken.h>
#include "hash.h" #include "hash.h"
#include "md2.h" #include "md2.h"

View File

@@ -31,7 +31,8 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include "config.h" #include <config.h>
#include <roken.h>
#include "hash.h" #include "hash.h"
#include "md4.h" #include "md4.h"

View File

@@ -31,7 +31,8 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include "config.h" #include <config.h>
#include <roken.h>
#include "hash.h" #include "hash.h"
#include "md5.h" #include "md5.h"

View File

@@ -32,9 +32,7 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#include <stdio.h>
#include <string.h>
#include <des.h> #include <des.h>
struct test { struct test {

View File

@@ -32,14 +32,10 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#define HC_DEPRECATED_CRYPTO #define HC_DEPRECATED_CRYPTO
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <string.h>
#ifdef KRB5 #ifdef KRB5
#include <krb5-types.h> #include <krb5-types.h>
#endif #endif

View File

@@ -37,9 +37,9 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#ifdef WIN32 /* Visual C++ 4.0 (Windows95/NT) */ #ifdef WIN32 /* Visual C++ 4.0 (Windows95/NT) */
#include <Windows.h>
#include "passwd_dlg.h" #include "passwd_dlg.h"
#include "Resource.h" #include "Resource.h"
#define passwdBufSZ 64 #define passwdBufSZ 64

View File

@@ -32,16 +32,12 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h> #include <assert.h>
#include <pkcs12.h> #include <pkcs12.h>
#include <bn.h> #include <bn.h>
#include <roken.h>
int int
PKCS12_key_gen(const void *key, size_t keylen, PKCS12_key_gen(const void *key, size_t keylen,
const void *salt, size_t saltlen, const void *salt, size_t saltlen,

View File

@@ -32,19 +32,15 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#ifdef KRB5 #ifdef KRB5
#include <krb5-types.h> #include <krb5-types.h>
#endif #endif
#include <stdio.h>
#include <stdlib.h>
#include <evp.h> #include <evp.h>
#include <hmac.h> #include <hmac.h>
#include <roken.h>
/** /**
* As descriped in PKCS5, convert a password, salt, and iteration counter into a crypto key. * As descriped in PKCS5, convert a password, salt, and iteration counter into a crypto key.
* *

View File

@@ -30,16 +30,13 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#include <stdio.h>
#include <stdlib.h>
#include <rand.h> #include <rand.h>
#include <heim_threads.h> #include <heim_threads.h>
#ifdef KRB5 #ifdef KRB5
#include <krb5-types.h> #include <krb5-types.h>
#endif #endif
#include <roken.h>
#include "randi.h" #include "randi.h"
#include "aes.h" #include "aes.h"

View File

@@ -32,13 +32,10 @@
*/ */
#include <config.h> #include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <rand.h>
#include <roken.h> #include <roken.h>
#include <rand.h>
#include "randi.h" #include "randi.h"
#ifndef WIN32 /* don't bother with this on windows */ #ifndef WIN32 /* don't bother with this on windows */

View File

@@ -32,14 +32,11 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#include <stdio.h>
#include <stdlib.h>
#include <rand.h> #include <rand.h>
#include <heim_threads.h> #include <heim_threads.h>
#include <roken.h>
#include "randi.h" #include "randi.h"
/* /*

View File

@@ -36,8 +36,6 @@
#include <wincrypt.h> #include <wincrypt.h>
#include <stdio.h>
#include <stdlib.h>
#include <rand.h> #include <rand.h>
#include <heim_threads.h> #include <heim_threads.h>

View File

@@ -34,14 +34,11 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#include <stdio.h>
#include <stdlib.h>
#include <rand.h> #include <rand.h>
#include <randi.h> #include <randi.h>
#include <roken.h>
#ifndef O_BINARY #ifndef O_BINARY
#define O_BINARY 0 #define O_BINARY 0
#endif #endif

View File

@@ -32,11 +32,9 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#include "rc2.h" #include "rc2.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* /*
* Implemented from Peter Gutmann's "Specification for Ron Rivests Cipher No.2" * Implemented from Peter Gutmann's "Specification for Ron Rivests Cipher No.2"

View File

@@ -32,11 +32,9 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#include <rc2.h> #include <rc2.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct { struct {
const void *key; const void *key;

View File

@@ -33,7 +33,8 @@
/* implemented from description in draft-kaukonen-cipher-arcfour-03.txt */ /* implemented from description in draft-kaukonen-cipher-arcfour-03.txt */
#include "config.h" #include <config.h>
#include <roken.h>
#include <rc4.h> #include <rc4.h>

View File

@@ -32,9 +32,7 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#include <stdio.h>
#include <string.h>
#include <rc4.h> #include <rc4.h>
static unsigned char plain1[8] = static unsigned char plain1[8] =

View File

@@ -28,10 +28,9 @@
/* "$NetBSD: rijndael-alg-fst.c,v 1.5 2001/11/13 01:40:10 lukem Exp $" */ /* "$NetBSD: rijndael-alg-fst.c,v 1.5 2001/11/13 01:40:10 lukem Exp $" */
#include "config.h" #include <config.h>
#include <roken.h>
#include <stdlib.h>
#ifdef KRB5 #ifdef KRB5
#include <krb5-types.h> #include <krb5-types.h>
#endif #endif

View File

@@ -31,15 +31,14 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include "config.h" #include <config.h>
#include <roken.h>
#define HC_DEPRECATED #define HC_DEPRECATED
#ifdef KRB5 #ifdef KRB5
#include <krb5-types.h> #include <krb5-types.h>
#endif #endif
#include <stdlib.h>
#include <des.h> #include <des.h>
#include <rand.h> #include <rand.h>

View File

@@ -32,16 +32,12 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#include <stdio.h>
#include <stdlib.h>
#include <krb5-types.h> #include <krb5-types.h>
#include <assert.h> #include <assert.h>
#include <rsa.h> #include <rsa.h>
#include <roken.h>
#ifdef HAVE_GMP #ifdef HAVE_GMP
#include <gmp.h> #include <gmp.h>

View File

@@ -32,16 +32,12 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#include <stdio.h>
#include <stdlib.h>
#include <krb5-types.h> #include <krb5-types.h>
#include <assert.h> #include <assert.h>
#include <rsa.h> #include <rsa.h>
#include <roken.h>
#include "tommath.h" #include "tommath.h"
static int static int

View File

@@ -32,16 +32,12 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#include <stdio.h>
#include <stdlib.h>
#include <krb5-types.h> #include <krb5-types.h>
#include <assert.h> #include <assert.h>
#include <rsa.h> #include <rsa.h>
#include <roken.h>
#ifdef USE_HCRYPTO_TFM #ifdef USE_HCRYPTO_TFM
#include "tfm.h" #include "tfm.h"

View File

@@ -32,9 +32,7 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#include <stdio.h>
#include <stdlib.h>
#include <krb5-types.h> #include <krb5-types.h>
#include <rfc2459_asn1.h> #include <rfc2459_asn1.h>
@@ -44,8 +42,6 @@
#include "common.h" #include "common.h"
#include <roken.h>
/** /**
* @page page_rsa RSA - public-key cryptography * @page page_rsa RSA - public-key cryptography
* *

View File

@@ -31,7 +31,8 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include "config.h" #include <config.h>
#include <roken.h>
#include "hash.h" #include "hash.h"
#include "sha.h" #include "sha.h"

View File

@@ -31,7 +31,8 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include "config.h" #include <config.h>
#include <roken.h>
#include "hash.h" #include "hash.h"
#include "sha.h" #include "sha.h"

View File

@@ -31,7 +31,8 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include "config.h" #include <config.h>
#include <roken.h>
#include "hash.h" #include "hash.h"
#include "sha.h" #include "sha.h"

View File

@@ -32,12 +32,7 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#include <sys/types.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <bn.h> #include <bn.h>
#include <rand.h> #include <rand.h>

View File

@@ -32,15 +32,9 @@
*/ */
#include <config.h> #include <config.h>
#include <sys/types.h>
#include <assert.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getarg.h>
#include <roken.h> #include <roken.h>
#include <assert.h>
#include <getarg.h>
#include <evp.h> #include <evp.h>
#include <evp-hcrypto.h> #include <evp-hcrypto.h>

View File

@@ -32,16 +32,11 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#define HC_DEPRECATED_CRYPTO #define HC_DEPRECATED_CRYPTO
#include <sys/types.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getarg.h> #include <getarg.h>
#include <roken.h>
#include <evp.h> #include <evp.h>
#include <evp-hcrypto.h> #include <evp-hcrypto.h>

View File

@@ -38,11 +38,9 @@
*/ */
#include <config.h> #include <config.h>
#include <stdio.h>
#include <ctype.h>
#include <roken.h> #include <roken.h>
#include <ctype.h>
#include <getarg.h> #include <getarg.h>
#include <dh.h> #include <dh.h>

View File

@@ -32,9 +32,6 @@
*/ */
#include <config.h> #include <config.h>
#include <stdio.h>
#include <roken.h> #include <roken.h>
#include <getarg.h> #include <getarg.h>

View File

@@ -32,16 +32,10 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#include <sys/types.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <hmac.h> #include <hmac.h>
#include <evp.h> #include <evp.h>
#include <roken.h>
int int
main(int argc, char **argv) main(int argc, char **argv)

View File

@@ -32,12 +32,7 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#include <sys/types.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pkcs12.h> #include <pkcs12.h>
#include <evp.h> #include <evp.h>

View File

@@ -32,12 +32,7 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#include <sys/types.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <err.h> #include <err.h>
#include <evp.h> #include <evp.h>

View File

@@ -34,12 +34,9 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h> #include <math.h>
#include <roken.h>
#include <getarg.h> #include <getarg.h>
#include "rand.h" #include "rand.h"

View File

@@ -32,9 +32,6 @@
*/ */
#include <config.h> #include <config.h>
#include <stdio.h>
#include <roken.h> #include <roken.h>
#include <getarg.h> #include <getarg.h>

View File

@@ -32,15 +32,11 @@
*/ */
#include <config.h> #include <config.h>
#include <roken.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h> #include <signal.h>
#ifdef HAVE_TERMIOS_H #ifdef HAVE_TERMIOS_H
#include <termios.h> #include <termios.h>
#endif #endif
#include <roken.h>
#include <ui.h> #include <ui.h>
#ifdef HAVE_CONIO_H #ifdef HAVE_CONIO_H

View File

@@ -32,12 +32,6 @@
*/ */
#include <config.h> #include <config.h>
#include <sys/types.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <roken.h> #include <roken.h>
#include <evp.h> #include <evp.h>