diff --git a/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c index 8434aa34..c4dd46a2 100644 --- a/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c +++ b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c @@ -158,7 +158,7 @@ escrypt_r(escrypt_local_t *local, const uint8_t *passwd, size_t passwdlen, prefixlen = src - setting; salt = src; - src = (const uint8_t *) strrchr((char *) salt, '$'); + src = (const uint8_t *) strrchr((const char *) salt, '$'); if (src) { saltlen = src - salt; } else { diff --git a/src/libsodium/crypto_stream/chacha20/stream_chacha20.c b/src/libsodium/crypto_stream/chacha20/stream_chacha20.c index c98d6090..427c3fb0 100644 --- a/src/libsodium/crypto_stream/chacha20/stream_chacha20.c +++ b/src/libsodium/crypto_stream/chacha20/stream_chacha20.c @@ -1,5 +1,6 @@ #include "crypto_stream_chacha20.h" #include "core.h" +#include "private/chacha20_ietf_ext.h" #include "private/common.h" #include "private/implementations.h" #include "randombytes.h" diff --git a/src/libsodium/crypto_stream/salsa20/xmm6int/u1.h b/src/libsodium/crypto_stream/salsa20/xmm6int/u1.h index 1a13e5c3..e82521cd 100644 --- a/src/libsodium/crypto_stream/salsa20/xmm6int/u1.h +++ b/src/libsodium/crypto_stream/salsa20/xmm6int/u1.h @@ -172,10 +172,10 @@ while (bytes >= 64) { diag1 = _mm_shuffle_epi32(diag1, 0x39); \ diag2 = _mm_shuffle_epi32(diag2, 0x39); \ diag3 = _mm_shuffle_epi32(diag3, 0x39); \ - in##A ^= *(uint32_t *) (m + (A * 4)); \ - in##B ^= *(uint32_t *) (m + (B * 4)); \ - in##C ^= *(uint32_t *) (m + (C * 4)); \ - in##D ^= *(uint32_t *) (m + (D * 4)); \ + in##A ^= *(const uint32_t *) (m + (A * 4)); \ + in##B ^= *(const uint32_t *) (m + (B * 4)); \ + in##C ^= *(const uint32_t *) (m + (C * 4)); \ + in##D ^= *(const uint32_t *) (m + (D * 4)); \ *(uint32_t *) (c + (A * 4)) = in##A; \ *(uint32_t *) (c + (B * 4)) = in##B; \ *(uint32_t *) (c + (C * 4)) = in##C; \ diff --git a/src/libsodium/crypto_stream/salsa20/xmm6int/u8.h b/src/libsodium/crypto_stream/salsa20/xmm6int/u8.h index 60f095c7..581b22c2 100644 --- a/src/libsodium/crypto_stream/salsa20/xmm6int/u8.h +++ b/src/libsodium/crypto_stream/salsa20/xmm6int/u8.h @@ -420,41 +420,42 @@ if (bytes >= 512) { z##D = _mm256_unpackhi_epi64(y##C, y##D); \ } -#define ONEOCTO(A, B, C, D, A2, B2, C2, D2) \ - { \ - ONEQUAD_UNPCK(A, B, C, D); \ - ONEQUAD_UNPCK(A2, B2, C2, D2); \ - y##A = _mm256_permute2x128_si256(z##A, z##A2, 0x20); \ - y##A2 = _mm256_permute2x128_si256(z##A, z##A2, 0x31); \ - y##B = _mm256_permute2x128_si256(z##B, z##B2, 0x20); \ - y##B2 = _mm256_permute2x128_si256(z##B, z##B2, 0x31); \ - y##C = _mm256_permute2x128_si256(z##C, z##C2, 0x20); \ - y##C2 = _mm256_permute2x128_si256(z##C, z##C2, 0x31); \ - y##D = _mm256_permute2x128_si256(z##D, z##D2, 0x20); \ - y##D2 = _mm256_permute2x128_si256(z##D, z##D2, 0x31); \ - y##A = _mm256_xor_si256(y##A, _mm256_loadu_si256((__m256i*) (m + 0))); \ - y##B = _mm256_xor_si256( \ +#define ONEOCTO(A, B, C, D, A2, B2, C2, D2) \ + { \ + ONEQUAD_UNPCK(A, B, C, D); \ + ONEQUAD_UNPCK(A2, B2, C2, D2); \ + y##A = _mm256_permute2x128_si256(z##A, z##A2, 0x20); \ + y##A2 = _mm256_permute2x128_si256(z##A, z##A2, 0x31); \ + y##B = _mm256_permute2x128_si256(z##B, z##B2, 0x20); \ + y##B2 = _mm256_permute2x128_si256(z##B, z##B2, 0x31); \ + y##C = _mm256_permute2x128_si256(z##C, z##C2, 0x20); \ + y##C2 = _mm256_permute2x128_si256(z##C, z##C2, 0x31); \ + y##D = _mm256_permute2x128_si256(z##D, z##D2, 0x20); \ + y##D2 = _mm256_permute2x128_si256(z##D, z##D2, 0x31); \ + y##A = _mm256_xor_si256(y##A, \ + _mm256_loadu_si256((const __m256i*) (m + 0))); \ + y##B = _mm256_xor_si256( \ y##B, _mm256_loadu_si256((const __m256i*) (m + 64))); \ - y##C = _mm256_xor_si256( \ - y##C, _mm256_loadu_si256((const __m256i*) (m + 128))); \ - y##D = _mm256_xor_si256( \ - y##D, _mm256_loadu_si256((const __m256i*) (m + 192))); \ - y##A2 = _mm256_xor_si256( \ - y##A2, _mm256_loadu_si256((const __m256i*) (m + 256))); \ - y##B2 = _mm256_xor_si256( \ - y##B2, _mm256_loadu_si256((const __m256i*) (m + 320))); \ - y##C2 = _mm256_xor_si256( \ - y##C2, _mm256_loadu_si256((const __m256i*) (m + 384))); \ - y##D2 = _mm256_xor_si256( \ - y##D2, _mm256_loadu_si256((const __m256i*) (m + 448))); \ - _mm256_storeu_si256((__m256i*) (c + 0), y##A); \ - _mm256_storeu_si256((__m256i*) (c + 64), y##B); \ - _mm256_storeu_si256((__m256i*) (c + 128), y##C); \ - _mm256_storeu_si256((__m256i*) (c + 192), y##D); \ - _mm256_storeu_si256((__m256i*) (c + 256), y##A2); \ - _mm256_storeu_si256((__m256i*) (c + 320), y##B2); \ - _mm256_storeu_si256((__m256i*) (c + 384), y##C2); \ - _mm256_storeu_si256((__m256i*) (c + 448), y##D2); \ + y##C = _mm256_xor_si256( \ + y##C, _mm256_loadu_si256((const __m256i*) (m + 128))); \ + y##D = _mm256_xor_si256( \ + y##D, _mm256_loadu_si256((const __m256i*) (m + 192))); \ + y##A2 = _mm256_xor_si256( \ + y##A2, _mm256_loadu_si256((const __m256i*) (m + 256))); \ + y##B2 = _mm256_xor_si256( \ + y##B2, _mm256_loadu_si256((const __m256i*) (m + 320))); \ + y##C2 = _mm256_xor_si256( \ + y##C2, _mm256_loadu_si256((const __m256i*) (m + 384))); \ + y##D2 = _mm256_xor_si256( \ + y##D2, _mm256_loadu_si256((const __m256i*) (m + 448))); \ + _mm256_storeu_si256((__m256i*) (c + 0), y##A); \ + _mm256_storeu_si256((__m256i*) (c + 64), y##B); \ + _mm256_storeu_si256((__m256i*) (c + 128), y##C); \ + _mm256_storeu_si256((__m256i*) (c + 192), y##D); \ + _mm256_storeu_si256((__m256i*) (c + 256), y##A2); \ + _mm256_storeu_si256((__m256i*) (c + 320), y##B2); \ + _mm256_storeu_si256((__m256i*) (c + 384), y##C2); \ + _mm256_storeu_si256((__m256i*) (c + 448), y##D2); \ } ONEOCTO(0, 1, 2, 3, 4, 5, 6, 7);