Skip to content

Commit

Permalink
[Crypto]: Fix salsa20_8(B) when compiled with -Os optimisation level (
Browse files Browse the repository at this point in the history
  • Loading branch information
satoshiotomakan committed Oct 19, 2023
1 parent 829ee47 commit b08c6f3
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions trezor-crypto/crypto/scrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,20 @@
#include <stdlib.h>
#include <string.h>

static void blkcpy(void *, void *, size_t);
static void blkcpy(uint32_t *, const uint32_t *, size_t);
static void blkxor(void *, void *, size_t);
static void salsa20_8(uint32_t[16]);
static void blockmix_salsa8(uint32_t *, uint32_t *, uint32_t *, size_t);
static uint64_t integerify(void *, size_t);
static void smix(uint8_t *, size_t, uint64_t, uint32_t *, uint32_t *);

static void
blkcpy(void * dest, void * src, size_t len)
blkcpy(uint32_t * dest, const uint32_t * src, size_t len)
{
size_t * D = dest;
size_t * S = src;
size_t L = len / sizeof(size_t);
size_t i;
size_t L = len / sizeof(uint32_t);

for (i = 0; i < L; i++)
D[i] = S[i];
for (size_t i = 0; i < L; i++)
dest[i] = src[i];
}

static void
Expand Down

0 comments on commit b08c6f3

Please sign in to comment.