summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2017-05-23 17:48:15 +0200
committerWerner Koch <wk@gnupg.org>2017-05-23 17:48:15 +0200
commitd764c9894013727ff82eb194da6030209c273528 (patch)
tree6efe429ba2673604c016f8ae53be2cc8b91ecc30
parentc1bb3d9fdb6fe5f336af1d5a03fc42bfdc1f8b0b (diff)
downloadlibgcrypt-d764c9894013727ff82eb194da6030209c273528.tar.gz
cipher: Fix compiler warnings.
* cipher/poly1305.c (poly1305_default_ops): Move to the top. Add prototypes and compile only if USE_SSE2 is not defined. (poly1305_init_ext_ref32): Compile only if USE_SSE2 is not defined. (poly1305_blocks_ref32): Ditto. (poly1305_finish_ext_ref32): Ditto. Signed-off-by: Werner Koch <wk@gnupg.org>
-rw-r--r--cipher/poly1305.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/cipher/poly1305.c b/cipher/poly1305.c
index 7ae35923..22255fb1 100644
--- a/cipher/poly1305.c
+++ b/cipher/poly1305.c
@@ -55,7 +55,24 @@ static const poly1305_ops_t poly1305_amd64_sse2_ops = {
_gcry_poly1305_amd64_sse2_finish_ext
};
-#endif
+#else /* !POLY1305_USE_SSE2 */
+
+static OPS_FUNC_ABI void poly1305_init_ext_ref32
+/**/ (void *state, const poly1305_key_t *key);
+static OPS_FUNC_ABI unsigned int poly1305_blocks_ref32
+/**/ (void *state, const byte *m, size_t bytes);
+static OPS_FUNC_ABI unsigned int poly1305_finish_ext_ref32
+/**/ (void *state, const byte * m,
+ size_t remaining, byte mac[POLY1305_TAGLEN]);
+
+static const poly1305_ops_t poly1305_default_ops = {
+ POLY1305_REF_BLOCKSIZE,
+ poly1305_init_ext_ref32,
+ poly1305_blocks_ref32,
+ poly1305_finish_ext_ref32
+};
+
+#endif /* !POLY1305_USE_SSE2 */
#ifdef POLY1305_USE_AVX2
@@ -111,6 +128,7 @@ typedef struct poly1305_state_ref32_s
} poly1305_state_ref32_t;
+#ifndef POLY1305_USE_SSE2
static OPS_FUNC_ABI void
poly1305_init_ext_ref32 (void *state, const poly1305_key_t * key)
{
@@ -141,8 +159,10 @@ poly1305_init_ext_ref32 (void *state, const poly1305_key_t * key)
st->final = 0;
}
+#endif /* !POLY1305_USE_SSE2 */
+#ifndef POLY1305_USE_SSE2
static OPS_FUNC_ABI unsigned int
poly1305_blocks_ref32 (void *state, const byte * m, size_t bytes)
{
@@ -229,8 +249,10 @@ poly1305_blocks_ref32 (void *state, const byte * m, size_t bytes)
return (16 * sizeof (u32) + 5 * sizeof (u64) + 5 * sizeof (void *));
}
+#endif /* !POLY1305_USE_SSE2 */
+#ifndef POLY1305_USE_SSE2
static OPS_FUNC_ABI unsigned int
poly1305_finish_ext_ref32 (void *state, const byte * m,
size_t remaining, byte mac[POLY1305_TAGLEN])
@@ -347,15 +369,9 @@ poly1305_finish_ext_ref32 (void *state, const byte * m,
return (13 * sizeof (u32) + sizeof (u64) +
POLY1305_REF_BLOCKSIZE + 6 * sizeof (void *)) + burn;
}
+#endif /* !POLY1305_USE_SSE2*/
-static const poly1305_ops_t poly1305_default_ops = {
- POLY1305_REF_BLOCKSIZE,
- poly1305_init_ext_ref32,
- poly1305_blocks_ref32,
- poly1305_finish_ext_ref32
-};
-