003 File Manager
Current Path:
/usr/src/sys/contrib/libsodium/src/libsodium/crypto_pwhash/argon2
usr
/
src
/
sys
/
contrib
/
libsodium
/
src
/
libsodium
/
crypto_pwhash
/
argon2
/
📁
..
📄
argon2-core.c
(15.29 KB)
📄
argon2-core.h
(9.98 KB)
📄
argon2-encoding.c
(10.01 KB)
📄
argon2-encoding.h
(1.04 KB)
📄
argon2-fill-block-avx2.c
(7.83 KB)
📄
argon2-fill-block-avx512f.c
(8.02 KB)
📄
argon2-fill-block-ref.c
(8.38 KB)
📄
argon2-fill-block-ssse3.c
(7.76 KB)
📄
argon2.c
(7.87 KB)
📄
argon2.h
(10.83 KB)
📄
blake2b-long.c
(3.06 KB)
📄
blake2b-long.h
(151 B)
📄
blamka-round-avx2.h
(5.71 KB)
📄
blamka-round-avx512f.h
(4.46 KB)
📄
blamka-round-ref.h
(1.52 KB)
📄
blamka-round-ssse3.h
(5.32 KB)
📄
pwhash_argon2i.c
(7.78 KB)
📄
pwhash_argon2id.c
(6.23 KB)
Editing: blake2b-long.c
#include <limits.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "crypto_generichash_blake2b.h" #include "private/common.h" #include "utils.h" #include "blake2b-long.h" int blake2b_long(void *pout, size_t outlen, const void *in, size_t inlen) { uint8_t *out = (uint8_t *) pout; crypto_generichash_blake2b_state blake_state; uint8_t outlen_bytes[4 /* sizeof(uint32_t) */] = { 0 }; int ret = -1; if (outlen > UINT32_MAX) { goto fail; /* LCOV_EXCL_LINE */ } /* Ensure little-endian byte order! */ STORE32_LE(outlen_bytes, (uint32_t) outlen); #define TRY(statement) \ do { \ ret = statement; \ if (ret < 0) { \ goto fail; \ } \ } while ((void) 0, 0) if (outlen <= crypto_generichash_blake2b_BYTES_MAX) { TRY(crypto_generichash_blake2b_init(&blake_state, NULL, 0U, outlen)); TRY(crypto_generichash_blake2b_update(&blake_state, outlen_bytes, sizeof(outlen_bytes))); TRY(crypto_generichash_blake2b_update( &blake_state, (const unsigned char *) in, inlen)); TRY(crypto_generichash_blake2b_final(&blake_state, out, outlen)); } else { uint32_t toproduce; uint8_t out_buffer[crypto_generichash_blake2b_BYTES_MAX]; uint8_t in_buffer[crypto_generichash_blake2b_BYTES_MAX]; TRY(crypto_generichash_blake2b_init( &blake_state, NULL, 0U, crypto_generichash_blake2b_BYTES_MAX)); TRY(crypto_generichash_blake2b_update(&blake_state, outlen_bytes, sizeof(outlen_bytes))); TRY(crypto_generichash_blake2b_update( &blake_state, (const unsigned char *) in, inlen)); TRY(crypto_generichash_blake2b_final( &blake_state, out_buffer, crypto_generichash_blake2b_BYTES_MAX)); memcpy(out, out_buffer, crypto_generichash_blake2b_BYTES_MAX / 2); out += crypto_generichash_blake2b_BYTES_MAX / 2; toproduce = (uint32_t) outlen - crypto_generichash_blake2b_BYTES_MAX / 2; while (toproduce > crypto_generichash_blake2b_BYTES_MAX) { memcpy(in_buffer, out_buffer, crypto_generichash_blake2b_BYTES_MAX); TRY(crypto_generichash_blake2b( out_buffer, crypto_generichash_blake2b_BYTES_MAX, in_buffer, crypto_generichash_blake2b_BYTES_MAX, NULL, 0U)); memcpy(out, out_buffer, crypto_generichash_blake2b_BYTES_MAX / 2); out += crypto_generichash_blake2b_BYTES_MAX / 2; toproduce -= crypto_generichash_blake2b_BYTES_MAX / 2; } memcpy(in_buffer, out_buffer, crypto_generichash_blake2b_BYTES_MAX); TRY(crypto_generichash_blake2b(out_buffer, toproduce, in_buffer, crypto_generichash_blake2b_BYTES_MAX, NULL, 0U)); memcpy(out, out_buffer, toproduce); } fail: sodium_memzero(&blake_state, sizeof(blake_state)); return ret; #undef TRY }
Upload File
Create Folder