From 897ccd21b7221982806b5c024518f4e989152f14 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 18 Mar 2016 18:57:19 +0100 Subject: Always require a 64 bit integer type * configure.ac (available_digests_64): Merge with available_digests. (available_kdfs_64): Merge with available_kdfs. <64 bit datatype test>: Bail out if no such type is available. * src/types.h: Emit #error if no u64 can be defined. (PROPERLY_ALIGNED_TYPE): Always add u64 type. * cipher/bithelp.h: Remove all code paths which handle the case of !HAVE_U64_TYPEDEF. * cipher/bufhelp.h: Ditto. * cipher/cipher-ccm.c: Ditto. * cipher/cipher-gcm.c: Ditto. * cipher/cipher-internal.h: Ditto. * cipher/cipher.c: Ditto. * cipher/hash-common.h: Ditto. * cipher/md.c: Ditto. * cipher/poly1305.c: Ditto. * cipher/scrypt.c: Ditto. * cipher/tiger.c: Ditto. * src/g10lib.h: Ditto. * tests/basic.c: Ditto. * tests/bench-slope.c: Ditto. * tests/benchmark.c: Ditto. -- Given that SHA-2 and some other algorithms require a 64 bit type it does not make anymore sense to conditionally compile some part when the platform does not provide such a type. GnuPG-bug-id: 1815. Signed-off-by: Werner Koch --- cipher/cipher.c | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'cipher/cipher.c') diff --git a/cipher/cipher.c b/cipher/cipher.c index a0138466..3a8597f5 100644 --- a/cipher/cipher.c +++ b/cipher/cipher.c @@ -397,15 +397,11 @@ _gcry_cipher_open_internal (gcry_cipher_hd_t *handle, switch (mode) { case GCRY_CIPHER_MODE_CCM: -#ifdef HAVE_U64_TYPEDEF if (spec->blocksize != GCRY_CCM_BLOCK_LEN) err = GPG_ERR_INV_CIPHER_MODE; if (!spec->encrypt || !spec->decrypt) err = GPG_ERR_INV_CIPHER_MODE; break; -#else - err = GPG_ERR_NOT_SUPPORTED; -#endif case GCRY_CIPHER_MODE_ECB: case GCRY_CIPHER_MODE_CBC: @@ -743,11 +739,9 @@ cipher_reset (gcry_cipher_hd_t c) memset (&c->u_mode.poly1305, 0, sizeof c->u_mode.poly1305); break; -#ifdef HAVE_U64_TYPEDEF case GCRY_CIPHER_MODE_CCM: memset (&c->u_mode.ccm, 0, sizeof c->u_mode.ccm); break; -#endif case GCRY_CIPHER_MODE_OCB: memset (&c->u_mode.ocb, 0, sizeof c->u_mode.ocb); @@ -1264,7 +1258,6 @@ _gcry_cipher_ctl (gcry_cipher_hd_t h, int cmd, void *buffer, size_t buflen) break; case GCRYCTL_SET_CCM_LENGTHS: -#ifdef HAVE_U64_TYPEDEF { u64 params[3]; size_t encryptedlen; @@ -1286,9 +1279,6 @@ _gcry_cipher_ctl (gcry_cipher_hd_t h, int cmd, void *buffer, size_t buflen) rc = _gcry_cipher_ccm_set_lengths (h, encryptedlen, aadlen, authtaglen); } -#else - rc = GPG_ERR_NOT_SUPPORTED; -#endif break; case GCRYCTL_SET_TAGLEN: -- cgit v1.2.1