Make it more difficult for the compiler to optimize crypto_verify_*()

This commit is contained in:
Frank Denis 2017-07-15 18:17:44 +02:00
parent c746eb2776
commit 37e99aa4fc

View File

@ -7,9 +7,13 @@
#include "crypto_verify_64.h"
int
crypto_verify_16(const unsigned char *x, const unsigned char *y)
crypto_verify_16(const unsigned char *x_, const unsigned char *y_)
{
uint_fast16_t d = 0U;
const volatile unsigned char *volatile x =
(const volatile unsigned char *volatile) x_;
const volatile unsigned char *volatile y =
(const volatile unsigned char *volatile) y_;
volatile uint_fast16_t d = 0U;
int i;
for (i = 0; i < 16; i++) {
@ -25,9 +29,13 @@ crypto_verify_16_bytes(void)
}
int
crypto_verify_32(const unsigned char *x, const unsigned char *y)
crypto_verify_32(const unsigned char *x_, const unsigned char *y_)
{
uint_fast16_t d = 0U;
const volatile unsigned char *volatile x =
(const volatile unsigned char *volatile) x_;
const volatile unsigned char *volatile y =
(const volatile unsigned char *volatile) y_;
volatile uint_fast16_t d = 0U;
int i;
for (i = 0; i < 32; i++) {
@ -43,9 +51,13 @@ crypto_verify_32_bytes(void)
}
int
crypto_verify_64(const unsigned char *x, const unsigned char *y)
crypto_verify_64(const unsigned char *x_, const unsigned char *y_)
{
uint_fast16_t d = 0U;
const volatile unsigned char *volatile x =
(const volatile unsigned char *volatile) x_;
const volatile unsigned char *volatile y =
(const volatile unsigned char *volatile) y_;
volatile uint_fast16_t d = 0U;
int i;
for (i = 0; i < 64; i++) {