Changeset View
Changeset View
Standalone View
Standalone View
cipher/cipher-internal.h
| Show First 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | |||||
| #if defined(GCM_USE_TABLES) | #if defined(GCM_USE_TABLES) | ||||
| #if defined(HAVE_ARM_ARCH_V6) && defined(__ARMEL__) && \ | #if defined(HAVE_ARM_ARCH_V6) && defined(__ARMEL__) && \ | ||||
| defined(HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS) && \ | defined(HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS) && \ | ||||
| defined(HAVE_GCC_INLINE_ASM_NEON) | defined(HAVE_GCC_INLINE_ASM_NEON) | ||||
| # define GCM_USE_ARM_NEON 1 | # define GCM_USE_ARM_NEON 1 | ||||
| #endif | #endif | ||||
| #endif /* GCM_USE_ARM_NEON */ | #endif /* GCM_USE_ARM_NEON */ | ||||
| /* GCM_USE_PPC_VPMSUM indicates whether to compile GCM with PPC Power 8 polynomial multiplication instruction */ | |||||
| #undef GCM_USE_PPC_VPMSUM | |||||
| #if defined(GCM_USE_TABLES) | |||||
| #if defined(ENABLE_PPC_CRYPTO_SUPPORT) && defined(__powerpc64__) && defined(__LITTLE_ENDIAN__) && \ | |||||
| defined(HAVE_COMPATIBLE_CC_PPC_ALTIVEC) && \ | |||||
| defined(HAVE_GCC_INLINE_ASM_PPC_ALTIVEC) && \ | |||||
| __GNUC__ >= 4 | |||||
| # define GCM_USE_PPC_VPMSUM 1 | |||||
| # define NEED_16BYTE_ALIGNED_CONTEXT 1 /* this also aligns gcm_table */ | |||||
| #endif | |||||
| #endif /* GCM_USE_PPC_VPMSUM */ | |||||
| typedef unsigned int (*ghash_fn_t) (gcry_cipher_hd_t c, byte *result, | typedef unsigned int (*ghash_fn_t) (gcry_cipher_hd_t c, byte *result, | ||||
| const byte *buf, size_t nblocks); | const byte *buf, size_t nblocks); | ||||
| /* A structure with function pointers for mode operations. */ | /* A structure with function pointers for mode operations. */ | ||||
| typedef struct cipher_mode_ops | typedef struct cipher_mode_ops | ||||
| { | { | ||||
| gcry_err_code_t (*encrypt)(gcry_cipher_hd_t c, unsigned char *outbuf, | gcry_err_code_t (*encrypt)(gcry_cipher_hd_t c, unsigned char *outbuf, | ||||
| ▲ Show 20 Lines • Show All 200 Lines • ▼ Show 20 Lines | struct { | ||||
| /* --- Following members are not cleared in gcry_cipher_reset --- */ | /* --- Following members are not cleared in gcry_cipher_reset --- */ | ||||
| /* GHASH multiplier from key. */ | /* GHASH multiplier from key. */ | ||||
| union { | union { | ||||
| cipher_context_alignment_t iv_align; | cipher_context_alignment_t iv_align; | ||||
| unsigned char key[MAX_BLOCKSIZE]; | unsigned char key[MAX_BLOCKSIZE]; | ||||
| } u_ghash_key; | } u_ghash_key; | ||||
| /* GHASH implementation in use. */ | |||||
| ghash_fn_t ghash_fn; | |||||
| /* Pre-calculated table for GCM. */ | /* Pre-calculated table for GCM. */ | ||||
| #ifdef GCM_USE_TABLES | #ifdef GCM_USE_TABLES | ||||
| #if (SIZEOF_UNSIGNED_LONG == 8 || defined(__x86_64__)) | #if (SIZEOF_UNSIGNED_LONG == 8 || defined(__x86_64__)) | ||||
| #define GCM_TABLES_USE_U64 1 | #define GCM_TABLES_USE_U64 1 | ||||
| u64 gcm_table[4 * 16]; | u64 gcm_table[4 * 16]; | ||||
| #else | #else | ||||
| #undef GCM_TABLES_USE_U64 | #undef GCM_TABLES_USE_U64 | ||||
| u32 gcm_table[8 * 16]; | u32 gcm_table[8 * 16]; | ||||
| #endif | #endif | ||||
| #endif | #endif | ||||
| /* GHASH implementation in use. */ | |||||
| ghash_fn_t ghash_fn; | |||||
| } gcm; | } gcm; | ||||
| /* Mode specific storage for OCB mode. */ | /* Mode specific storage for OCB mode. */ | ||||
| struct { | struct { | ||||
| /* --- Following members are not cleared in gcry_cipher_reset --- */ | /* --- Following members are not cleared in gcry_cipher_reset --- */ | ||||
| /* Helper variables and pre-computed table of L values. */ | /* Helper variables and pre-computed table of L values. */ | ||||
| unsigned char L_star[OCB_BLOCK_LEN]; | unsigned char L_star[OCB_BLOCK_LEN]; | ||||
| ▲ Show 20 Lines • Show All 464 Lines • Show Last 20 Lines | |||||