From 19f7e5e24a9fa2e9c0472c846416c6d186b2f5d4 Mon Sep 17 00:00:00 2001 From: Ben Laurie Date: Sat, 1 May 2010 14:41:25 +0000 Subject: [PATCH] Missing declarations, no assembler in PEDANTIC. --- crypto/modes/gcm128.c | 8 ++++---- crypto/modes/modes.h | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/crypto/modes/gcm128.c b/crypto/modes/gcm128.c index 7501833007..8dc69cbcfb 100644 --- a/crypto/modes/gcm128.c +++ b/crypto/modes/gcm128.c @@ -83,7 +83,7 @@ typedef struct { u64 hi,lo; } u128; # undef STRICT_ALIGNMENT #endif -#if defined(__GNUC__) && __GNUC__>=2 +#if defined(__GNUC__) && __GNUC__>=2 && !defined(PEDANTIC) # if defined(__x86_64) || defined(__x86_64__) # define BSWAP8(x) ({ u64 ret=(x); \ asm volatile ("bswapq %0" \ @@ -91,7 +91,7 @@ typedef struct { u64 hi,lo; } u128; # define BSWAP4(x) ({ u32 ret=(x); \ asm volatile ("bswapl %0" \ : "+r"(ret)); ret; }) -# elif defined(__i386) || defined(__i386__) +# elif (defined(__i386) || defined(__i386__)) && !defined(PEDANTIC) # define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \ asm volatile ("bswapl %0; bswapl %1" \ : "+r"(hi),"+r"(lo)); \ @@ -565,7 +565,7 @@ static void gcm_gmult_1bit(u64 Xi[2],const u64 H[2]) #endif -typedef struct { +struct gcm128_context { /* Following 6 names follow names in GCM specification */ union { u64 u[2]; u32 d[4]; u8 c[16]; } Yi,EKi,EK0, Xi,H, @@ -579,7 +579,7 @@ typedef struct { unsigned int res, ctr; block128_f block; void *key; -} GCM128_CONTEXT; +}; void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx,void *key,block128_f block) { diff --git a/crypto/modes/modes.h b/crypto/modes/modes.h index 12e1374978..b70942bd78 100644 --- a/crypto/modes/modes.h +++ b/crypto/modes/modes.h @@ -70,3 +70,18 @@ size_t CRYPTO_nistcts128_decrypt_block(const unsigned char *in, unsigned char *o size_t CRYPTO_nistcts128_decrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], cbc128_f cbc); + +typedef struct gcm128_context GCM128_CONTEXT; + +void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx, void *key, block128_f block); +void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv, + size_t len); +void CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad, + size_t len); +void CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, + const unsigned char *in, unsigned char *out, + size_t len); +void CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, + const unsigned char *in, unsigned char *out, + size_t len); +void CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx); -- 2.34.1