mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-25 08:37:13 +09:00
Reuse ROTR64
This commit is contained in:
@@ -46,7 +46,6 @@ libsodium_la_SOURCES = \
|
||||
crypto_pwhash/argon2/argon2-encoding.c \
|
||||
crypto_pwhash/argon2/argon2-encoding.h \
|
||||
crypto_pwhash/argon2/argon2-fill-block-ref.c \
|
||||
crypto_pwhash/argon2/argon2-impl.h \
|
||||
crypto_pwhash/argon2/argon2.c \
|
||||
crypto_pwhash/argon2/argon2.h \
|
||||
crypto_pwhash/argon2/blake2b-long.c \
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "private/common.h"
|
||||
|
||||
#include "argon2-core.h"
|
||||
#include "argon2-impl.h"
|
||||
#include "blake2b-long.h"
|
||||
|
||||
#if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
#include "argon2.h"
|
||||
#include "argon2-core.h"
|
||||
#include "argon2-impl.h"
|
||||
#include "blamka-round-ref.h"
|
||||
#include "private/common.h"
|
||||
|
||||
static void fill_block(const block *prev_block, const block *ref_block,
|
||||
block *next_block) {
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
|
||||
#include "argon2.h"
|
||||
#include "argon2-core.h"
|
||||
#include "argon2-impl.h"
|
||||
#include "blamka-round-ssse3.h"
|
||||
#include "private/common.h"
|
||||
|
||||
static void fill_block(__m128i *state, const uint8_t *ref_block, uint8_t *next_block) {
|
||||
__m128i block_XY[ARGON2_OWORDS_IN_BLOCK];
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
BLAKE2 reference source code package - reference C implementations
|
||||
|
||||
Written in 2012 by Samuel Neves <sneves@dei.uc.pt>
|
||||
|
||||
To the extent possible under law, the author(s) have dedicated all copyright
|
||||
and related and neighboring rights to this software to the public domain
|
||||
worldwide. This software is distributed without any warranty.
|
||||
|
||||
You should have received a copy of the CC0 Public Domain Dedication along with
|
||||
this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||
*/
|
||||
|
||||
#ifndef argon2_impl_H
|
||||
#define argon2_impl_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
static inline uint32_t rotl32( const uint32_t w, const unsigned c )
|
||||
{
|
||||
return ( w << c ) | ( w >> ( 32 - c ) );
|
||||
}
|
||||
|
||||
static inline uint64_t rotl64( const uint64_t w, const unsigned c )
|
||||
{
|
||||
return ( w << c ) | ( w >> ( 64 - c ) );
|
||||
}
|
||||
|
||||
static inline uint32_t rotr32( const uint32_t w, const unsigned c )
|
||||
{
|
||||
return ( w >> c ) | ( w << ( 32 - c ) );
|
||||
}
|
||||
|
||||
static inline uint64_t rotr64( const uint64_t w, const unsigned c )
|
||||
{
|
||||
return ( w >> c ) | ( w << ( 64 - c ) );
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "utils.h"
|
||||
#include "private/common.h"
|
||||
|
||||
#include "argon2-impl.h"
|
||||
#include "blake2b-long.h"
|
||||
|
||||
int blake2b_long(void *pout, size_t outlen, const void *in, size_t inlen) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef blamka_round_ref_H
|
||||
#define blamka_round_ref_H
|
||||
|
||||
#include "argon2-impl.h"
|
||||
#include "private/common.h"
|
||||
|
||||
/*designed by the Lyra PHC team */
|
||||
static inline uint64_t fBlaMka(uint64_t x, uint64_t y) {
|
||||
@@ -13,13 +13,13 @@ static inline uint64_t fBlaMka(uint64_t x, uint64_t y) {
|
||||
#define G(a, b, c, d) \
|
||||
do { \
|
||||
a = fBlaMka(a, b); \
|
||||
d = rotr64(d ^ a, 32); \
|
||||
d = ROTR64(d ^ a, 32); \
|
||||
c = fBlaMka(c, d); \
|
||||
b = rotr64(b ^ c, 24); \
|
||||
b = ROTR64(b ^ c, 24); \
|
||||
a = fBlaMka(a, b); \
|
||||
d = rotr64(d ^ a, 16); \
|
||||
d = ROTR64(d ^ a, 16); \
|
||||
c = fBlaMka(c, d); \
|
||||
b = rotr64(b ^ c, 63); \
|
||||
b = ROTR64(b ^ c, 63); \
|
||||
} while ((void)0, 0)
|
||||
|
||||
#define BLAKE2_ROUND_NOMSG(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, \
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef blamka_round_ssse3_H
|
||||
#define blamka_round_ssse3_H
|
||||
|
||||
#include "argon2-impl.h"
|
||||
#include "private/common.h"
|
||||
|
||||
#define r16 \
|
||||
(_mm_setr_epi8(2, 3, 4, 5, 6, 7, 0, 1, 10, 11, 12, 13, 14, 15, 8, 9))
|
||||
|
||||
Reference in New Issue
Block a user