mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-25 08:37:13 +09:00
MSVC compat
This commit is contained in:
@@ -41,7 +41,7 @@ typedef __m128i BlockVec;
|
||||
typedef BlockVec KeySchedule[1 + ROUNDS];
|
||||
|
||||
static void
|
||||
expand_key(KeySchedule rkeys, const uint8_t key[16])
|
||||
expand_key(BlockVec *rkeys, const uint8_t key[16])
|
||||
{
|
||||
BlockVec t, s;
|
||||
size_t i = 0;
|
||||
@@ -68,7 +68,7 @@ expand_key(KeySchedule rkeys, const uint8_t key[16])
|
||||
}
|
||||
|
||||
static void
|
||||
aes_encrypt(uint8_t out[16], const uint8_t in[16], const KeySchedule rkeys)
|
||||
aes_encrypt(uint8_t out[16], const uint8_t in[16], const BlockVec *rkeys)
|
||||
{
|
||||
BlockVec t;
|
||||
size_t i;
|
||||
@@ -82,7 +82,7 @@ aes_encrypt(uint8_t out[16], const uint8_t in[16], const KeySchedule rkeys)
|
||||
}
|
||||
|
||||
static void
|
||||
aes_decrypt(uint8_t out[16], const uint8_t in[16], const KeySchedule rkeys)
|
||||
aes_decrypt(uint8_t out[16], const uint8_t in[16], const BlockVec *rkeys)
|
||||
{
|
||||
KeySchedule rkeys_inv;
|
||||
BlockVec t;
|
||||
@@ -109,7 +109,7 @@ tweak_expand(const uint8_t tweak[8])
|
||||
|
||||
static void
|
||||
aes_encrypt_with_tweak(uint8_t out[16], const uint8_t in[16], const uint8_t tweak[8],
|
||||
const KeySchedule rkeys)
|
||||
const BlockVec *rkeys)
|
||||
{
|
||||
const BlockVec tweak_block = tweak_expand(tweak);
|
||||
BlockVec t;
|
||||
@@ -125,7 +125,7 @@ aes_encrypt_with_tweak(uint8_t out[16], const uint8_t in[16], const uint8_t twea
|
||||
|
||||
static void
|
||||
aes_decrypt_with_tweak(uint8_t out[16], const uint8_t in[16], const uint8_t tweak[8],
|
||||
const KeySchedule rkeys)
|
||||
const BlockVec *rkeys)
|
||||
{
|
||||
KeySchedule rkeys_inv;
|
||||
const BlockVec tweak_block = tweak_expand(tweak);
|
||||
@@ -145,7 +145,7 @@ aes_decrypt_with_tweak(uint8_t out[16], const uint8_t in[16], const uint8_t twea
|
||||
}
|
||||
|
||||
static BlockVec
|
||||
aes_xex_tweak(const uint8_t tweak[16], const KeySchedule tkeys)
|
||||
aes_xex_tweak(const uint8_t tweak[16], const BlockVec *tkeys)
|
||||
{
|
||||
BlockVec tt;
|
||||
size_t i;
|
||||
@@ -160,7 +160,7 @@ aes_xex_tweak(const uint8_t tweak[16], const KeySchedule tkeys)
|
||||
|
||||
static void
|
||||
aes_xex_encrypt(uint8_t out[16], const uint8_t in[16], const uint8_t tweak[16],
|
||||
const KeySchedule tkeys, const KeySchedule rkeys)
|
||||
const BlockVec *tkeys, const BlockVec *rkeys)
|
||||
{
|
||||
const BlockVec tt = aes_xex_tweak(tweak, tkeys);
|
||||
BlockVec t;
|
||||
@@ -176,7 +176,7 @@ aes_xex_encrypt(uint8_t out[16], const uint8_t in[16], const uint8_t tweak[16],
|
||||
|
||||
static void
|
||||
aes_xex_decrypt(uint8_t out[16], const uint8_t in[16], const uint8_t tweak[16],
|
||||
const KeySchedule tkeys, const KeySchedule rkeys)
|
||||
const BlockVec *tkeys, const BlockVec *rkeys)
|
||||
{
|
||||
KeySchedule rkeys_inv;
|
||||
const BlockVec tt = aes_xex_tweak(tweak, tkeys);
|
||||
|
||||
@@ -68,7 +68,7 @@ AES_KEYGEN(BlockVec block_vec, const int rc)
|
||||
}
|
||||
|
||||
static void
|
||||
expand_key(KeySchedule rkeys, const uint8_t key[16])
|
||||
expand_key(BlockVec *rkeys, const uint8_t key[16])
|
||||
{
|
||||
BlockVec t, s;
|
||||
size_t i = 0;
|
||||
@@ -95,7 +95,7 @@ expand_key(KeySchedule rkeys, const uint8_t key[16])
|
||||
}
|
||||
|
||||
static void
|
||||
aes_encrypt(uint8_t out[16], const uint8_t in[16], const KeySchedule rkeys)
|
||||
aes_encrypt(uint8_t out[16], const uint8_t in[16], const BlockVec *rkeys)
|
||||
{
|
||||
BlockVec t;
|
||||
size_t i;
|
||||
@@ -110,7 +110,7 @@ aes_encrypt(uint8_t out[16], const uint8_t in[16], const KeySchedule rkeys)
|
||||
}
|
||||
|
||||
static void
|
||||
aes_decrypt(uint8_t out[16], const uint8_t in[16], const KeySchedule rkeys)
|
||||
aes_decrypt(uint8_t out[16], const uint8_t in[16], const BlockVec *rkeys)
|
||||
{
|
||||
KeySchedule rkeys_inv;
|
||||
BlockVec t;
|
||||
@@ -136,7 +136,7 @@ tweak_expand(const uint8_t tweak[8])
|
||||
|
||||
static void
|
||||
aes_encrypt_with_tweak(uint8_t out[16], const uint8_t in[16], const uint8_t tweak[8],
|
||||
const KeySchedule rkeys)
|
||||
const BlockVec *rkeys)
|
||||
{
|
||||
const BlockVec tweak_block = tweak_expand(tweak);
|
||||
BlockVec t;
|
||||
@@ -153,7 +153,7 @@ aes_encrypt_with_tweak(uint8_t out[16], const uint8_t in[16], const uint8_t twea
|
||||
|
||||
static void
|
||||
aes_decrypt_with_tweak(uint8_t out[16], const uint8_t in[16], const uint8_t tweak[8],
|
||||
const KeySchedule rkeys)
|
||||
const BlockVec *rkeys)
|
||||
{
|
||||
KeySchedule rkeys_inv;
|
||||
const BlockVec tweak_block = tweak_expand(tweak);
|
||||
@@ -174,7 +174,7 @@ aes_decrypt_with_tweak(uint8_t out[16], const uint8_t in[16], const uint8_t twea
|
||||
}
|
||||
|
||||
static BlockVec
|
||||
aes_xex_tweak(const uint8_t tweak[16], const KeySchedule tkeys)
|
||||
aes_xex_tweak(const uint8_t tweak[16], const BlockVec *tkeys)
|
||||
{
|
||||
BlockVec tt;
|
||||
size_t i;
|
||||
@@ -190,7 +190,7 @@ aes_xex_tweak(const uint8_t tweak[16], const KeySchedule tkeys)
|
||||
|
||||
static void
|
||||
aes_xex_encrypt(uint8_t out[16], const uint8_t in[16], const uint8_t tweak[16],
|
||||
const KeySchedule tkeys, const KeySchedule rkeys)
|
||||
const BlockVec *tkeys, const BlockVec *rkeys)
|
||||
{
|
||||
const BlockVec tt = aes_xex_tweak(tweak, tkeys);
|
||||
BlockVec t;
|
||||
@@ -207,7 +207,7 @@ aes_xex_encrypt(uint8_t out[16], const uint8_t in[16], const uint8_t tweak[16],
|
||||
|
||||
static void
|
||||
aes_xex_decrypt(uint8_t out[16], const uint8_t in[16], const uint8_t tweak[16],
|
||||
const KeySchedule tkeys, const KeySchedule rkeys)
|
||||
const BlockVec *tkeys, const BlockVec *rkeys)
|
||||
{
|
||||
KeySchedule rkeys_inv;
|
||||
const BlockVec tt = aes_xex_tweak(tweak, tkeys);
|
||||
|
||||
@@ -24,8 +24,6 @@ int
|
||||
crypto_xof_shake128(unsigned char *out, size_t outlen, const unsigned char *in,
|
||||
unsigned long long inlen)
|
||||
{
|
||||
shake128_state_internal state;
|
||||
|
||||
COMPILER_ASSERT(sizeof(crypto_xof_shake128_state) >= sizeof(shake128_state_internal));
|
||||
|
||||
return shake128_ref(out, outlen, in, (size_t) inlen);
|
||||
|
||||
@@ -24,8 +24,6 @@ int
|
||||
crypto_xof_shake256(unsigned char *out, size_t outlen, const unsigned char *in,
|
||||
unsigned long long inlen)
|
||||
{
|
||||
shake256_state_internal state;
|
||||
|
||||
COMPILER_ASSERT(sizeof(crypto_xof_shake256_state) >= sizeof(shake256_state_internal));
|
||||
|
||||
return shake256_ref(out, outlen, in, (size_t) inlen);
|
||||
|
||||
@@ -24,8 +24,6 @@ int
|
||||
crypto_xof_turboshake128(unsigned char *out, size_t outlen, const unsigned char *in,
|
||||
unsigned long long inlen)
|
||||
{
|
||||
turboshake128_state_internal state;
|
||||
|
||||
COMPILER_ASSERT(sizeof(crypto_xof_turboshake128_state) >= sizeof(turboshake128_state_internal));
|
||||
|
||||
return turboshake128_ref(out, outlen, in, (size_t) inlen);
|
||||
|
||||
@@ -24,8 +24,6 @@ int
|
||||
crypto_xof_turboshake256(unsigned char *out, size_t outlen, const unsigned char *in,
|
||||
unsigned long long inlen)
|
||||
{
|
||||
turboshake256_state_internal state;
|
||||
|
||||
COMPILER_ASSERT(sizeof(crypto_xof_turboshake256_state) >= sizeof(turboshake256_state_internal));
|
||||
|
||||
return turboshake256_ref(out, outlen, in, (size_t) inlen);
|
||||
|
||||
Reference in New Issue
Block a user