1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-24 20:45:17 -07:00

Merge branch 'master' of github.com:jedisct1/libsodium

* 'master' of github.com:jedisct1/libsodium:
  Invert (1-y) just before the multiplication by (1+y) for readability
  Nits
This commit is contained in:
Frank Denis 2018-07-22 21:40:39 +02:00
commit 922e4dcd9e
4 changed files with 7 additions and 6 deletions

View File

@ -67,7 +67,7 @@ store_block(void *output, const block *src)
* @param m_cost number of blocks to allocate in the memory * @param m_cost number of blocks to allocate in the memory
* @return ARGON2_OK if @memory is a valid pointer and memory is allocated * @return ARGON2_OK if @memory is a valid pointer and memory is allocated
*/ */
static int allocate_memory(block_region **memory, uint32_t m_cost); static int allocate_memory(block_region **region, uint32_t m_cost);
static int static int
allocate_memory(block_region **region, uint32_t m_cost) allocate_memory(block_region **region, uint32_t m_cost)
@ -153,7 +153,7 @@ clear_memory(argon2_instance_t *instance, int clear)
/* Deallocates memory /* Deallocates memory
* @param memory pointer to the blocks * @param memory pointer to the blocks
*/ */
static void free_memory(block_region *memory); static void free_memory(block_region *region);
static void static void
free_memory(block_region *region) free_memory(block_region *region)

View File

@ -163,8 +163,9 @@ salsa20_8(uint32_t B[16])
x[15] ^= R(x[14] + x[13], 18); x[15] ^= R(x[14] + x[13], 18);
#undef R #undef R
} }
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++) {
B[i] += x[i]; B[i] += x[i];
}
} }
/** /**

View File

@ -55,9 +55,9 @@ alloc_region(escrypt_region_t *region, size_t size)
aligned = base; aligned = base;
#else #else
base = aligned = NULL; base = aligned = NULL;
if (size + 63 < size) if (size + 63 < size) {
errno = ENOMEM; errno = ENOMEM;
else if ((base = (uint8_t *) malloc(size + 63)) != NULL) { } else if ((base = (uint8_t *) malloc(size + 63)) != NULL) {
aligned = base + 63; aligned = base + 63;
aligned -= (uintptr_t) aligned & 63; aligned -= (uintptr_t) aligned & 63;
} }

View File

@ -61,9 +61,9 @@ crypto_sign_ed25519_pk_to_curve25519(unsigned char *curve25519_pk,
} }
fe25519_1(one_minus_y); fe25519_1(one_minus_y);
fe25519_sub(one_minus_y, one_minus_y, A.Y); fe25519_sub(one_minus_y, one_minus_y, A.Y);
fe25519_invert(one_minus_y, one_minus_y);
fe25519_1(x); fe25519_1(x);
fe25519_add(x, x, A.Y); fe25519_add(x, x, A.Y);
fe25519_invert(one_minus_y, one_minus_y);
fe25519_mul(x, x, one_minus_y); fe25519_mul(x, x, one_minus_y);
fe25519_tobytes(curve25519_pk, x); fe25519_tobytes(curve25519_pk, x);