Merge pull request #2277 from julek-wolfssl/arm-poly1305

ARM Poly1305
This commit is contained in:
Sean Parkinson
2019-06-27 09:21:09 +10:00
committed by GitHub
4 changed files with 1210 additions and 8 deletions
+10 -8
View File
@@ -24,6 +24,7 @@
* and Daniel J. Bernstein
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -190,7 +191,7 @@ extern void poly1305_final_avx2(Poly1305* ctx, byte* mac);
#endif
#elif defined(POLY130564)
#ifndef WOLFSSL_ARMASM
static word64 U8TO64(const byte* p)
{
return
@@ -214,7 +215,7 @@ extern void poly1305_final_avx2(Poly1305* ctx, byte* mac);
p[6] = (v >> 48) & 0xff;
p[7] = (v >> 56) & 0xff;
}
#endif/* WOLFSSL_ARMASM */
#else /* if not 64 bit then use 32 bit */
static word32 U8TO32(const byte *p)
@@ -244,8 +245,9 @@ static void U32TO64(word32 v, byte* p)
p[3] = (v >> 24) & 0xFF;
}
static void poly1305_blocks(Poly1305* ctx, const unsigned char *m,
size_t bytes)
#if !defined(WOLFSSL_ARMASM) || !defined(__aarch64__)
void poly1305_blocks(Poly1305* ctx, const unsigned char *m,
size_t bytes)
{
#ifdef USE_INTEL_SPEEDUP
/* AVX2 is handled in wc_Poly1305Update. */
@@ -368,7 +370,7 @@ static void poly1305_blocks(Poly1305* ctx, const unsigned char *m,
#endif /* end of 64 bit cpu blocks or 32 bit cpu */
}
static void poly1305_block(Poly1305* ctx, const unsigned char *m)
void poly1305_block(Poly1305* ctx, const unsigned char *m)
{
#ifdef USE_INTEL_SPEEDUP
/* No call to poly1305_block when AVX2, AVX2 does 4 blocks at a time. */
@@ -377,8 +379,9 @@ static void poly1305_block(Poly1305* ctx, const unsigned char *m)
poly1305_blocks(ctx, m, POLY1305_BLOCK_SIZE);
#endif
}
#endif /* !defined(WOLFSSL_ARMASM) || !defined(__aarch64__) */
#if !defined(WOLFSSL_ARMASM) || !defined(__aarch64__)
int wc_Poly1305SetKey(Poly1305* ctx, const byte* key, word32 keySz)
{
#if defined(POLY130564)
@@ -465,7 +468,6 @@ int wc_Poly1305SetKey(Poly1305* ctx, const byte* key, word32 keySz)
return 0;
}
int wc_Poly1305Final(Poly1305* ctx, byte* mac)
{
#ifdef USE_INTEL_SPEEDUP
@@ -646,6 +648,7 @@ int wc_Poly1305Final(Poly1305* ctx, byte* mac)
return 0;
}
#endif /* !defined(WOLFSSL_ARMASM) || !defined(__aarch64__) */
int wc_Poly1305Update(Poly1305* ctx, const byte* m, word32 bytes)
@@ -818,4 +821,3 @@ int wc_Poly1305_MAC(Poly1305* ctx, byte* additional, word32 addSz,
}
#endif /* HAVE_POLY1305 */
File diff suppressed because it is too large Load Diff