Adapt the _ALT style to our new standard

- in .h files: only put the context declaration inside the #ifdef _ALT
  (this was changed in 2.9.0, ie after the original PR)
- in .c file: only leave selftest out of _ALT: even though some function are
  trivial to build from other parts, alt implementors might want to go another
way about them (for efficiency or other reasons)
This commit is contained in:
Manuel Pégourié-Gonnard 2018-05-07 09:58:35 +02:00
parent ce8314f5f0
commit 95d0bdbd84
6 changed files with 27 additions and 27 deletions

View file

@ -32,10 +32,10 @@
#include <stdint.h>
#include <stddef.h>
#if !defined(MBEDTLS_POLY1305_ALT)
#define MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA -0x0041 /**< Invalid input parameter(s). */
#if !defined(MBEDTLS_POLY1305_ALT)
typedef struct
{
uint32_t r[4]; /** Stores the value for 'r' (low 128 bits of the key) */
@ -46,6 +46,10 @@ typedef struct
}
mbedtls_poly1305_context;
#else /* MBEDTLS_POLY1305_ALT */
#include "poly1305_alt.h"
#endif /* MBEDTLS_POLY1305_ALT */
/**
* \brief Initialize a Poly1305 context
*
@ -109,10 +113,6 @@ int mbedtls_poly1305_update( mbedtls_poly1305_context *ctx,
int mbedtls_poly1305_finish( mbedtls_poly1305_context *ctx,
unsigned char mac[16] );
#else /* MBEDTLS_POLY1305_ALT */
#include "poly1305_alt.h"
#endif /* MBEDTLS_POLY1305_ALT */
/**
* \brief Generate the Poly1305 MAC of some data with the given key.
*