mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-25 08:37:13 +09:00
AEGIS: rename constants to match the draft
This commit is contained in:
@@ -49,9 +49,9 @@ crypto_aead_aegis128l_update(__m128i *const state, const __m128i d1, const __m12
|
||||
static void
|
||||
crypto_aead_aegis128l_init(const unsigned char *key, const unsigned char *nonce, __m128i *const state)
|
||||
{
|
||||
const __m128i c1 = _mm_set_epi8(0xdd, 0x28, 0xb5, 0x73, 0x42, 0x31, 0x11, 0x20, 0xf1, 0x2f, 0xc2, 0x6d,
|
||||
const __m128i c0 = _mm_set_epi8(0xdd, 0x28, 0xb5, 0x73, 0x42, 0x31, 0x11, 0x20, 0xf1, 0x2f, 0xc2, 0x6d,
|
||||
0x55, 0x18, 0x3d, 0xdb);
|
||||
const __m128i c2 = _mm_set_epi8(0x62, 0x79, 0xe9, 0x90, 0x59, 0x37, 0x22, 0x15, 0x0d, 0x08, 0x05, 0x03,
|
||||
const __m128i c1 = _mm_set_epi8(0x62, 0x79, 0xe9, 0x90, 0x59, 0x37, 0x22, 0x15, 0x0d, 0x08, 0x05, 0x03,
|
||||
0x02, 0x01, 0x01, 0x00);
|
||||
__m128i k;
|
||||
__m128i n;
|
||||
@@ -61,13 +61,13 @@ crypto_aead_aegis128l_init(const unsigned char *key, const unsigned char *nonce,
|
||||
n = _mm_loadu_si128((const __m128i *) (const void *) nonce);
|
||||
|
||||
state[0] = _mm_xor_si128(k, n);
|
||||
state[1] = c1;
|
||||
state[2] = c2;
|
||||
state[3] = c1;
|
||||
state[1] = c0;
|
||||
state[2] = c1;
|
||||
state[3] = c0;
|
||||
state[4] = _mm_xor_si128(k, n);
|
||||
state[5] = _mm_xor_si128(k, c2);
|
||||
state[6] = _mm_xor_si128(k, c1);
|
||||
state[7] = _mm_xor_si128(k, c2);
|
||||
state[5] = _mm_xor_si128(k, c1);
|
||||
state[6] = _mm_xor_si128(k, c0);
|
||||
state[7] = _mm_xor_si128(k, c1);
|
||||
for (i = 0; i < 10; i++) {
|
||||
crypto_aead_aegis128l_update(state, n, k);
|
||||
}
|
||||
|
||||
@@ -41,16 +41,16 @@ static void
|
||||
crypto_aead_aegis128l_init(const unsigned char *key, const unsigned char *nonce,
|
||||
uint8x16_t *const state)
|
||||
{
|
||||
static CRYPTO_ALIGN(16) const unsigned char c1_[] = {
|
||||
static CRYPTO_ALIGN(16) const unsigned char c0_[] = {
|
||||
0xdb, 0x3d, 0x18, 0x55, 0x6d, 0xc2, 0x2f, 0xf1, 0x20, 0x11, 0x31, 0x42,
|
||||
0x73, 0xb5, 0x28, 0xdd
|
||||
};
|
||||
static CRYPTO_ALIGN(16) const unsigned char c2_[] = {
|
||||
static CRYPTO_ALIGN(16) const unsigned char c1_[] = {
|
||||
0x00, 0x01, 0x01, 0x02, 0x03, 0x05, 0x08, 0x0d, 0x15, 0x22, 0x37, 0x59,
|
||||
0x90, 0xe9, 0x79, 0x62
|
||||
};
|
||||
const uint8x16_t c0 = vld1q_u8(c0_);
|
||||
const uint8x16_t c1 = vld1q_u8(c1_);
|
||||
const uint8x16_t c2 = vld1q_u8(c2_);
|
||||
uint8x16_t k;
|
||||
uint8x16_t n;
|
||||
int i;
|
||||
@@ -59,13 +59,13 @@ crypto_aead_aegis128l_init(const unsigned char *key, const unsigned char *nonce,
|
||||
n = vld1q_u8(nonce);
|
||||
|
||||
state[0] = veorq_u8(k, n);
|
||||
state[1] = c1;
|
||||
state[2] = c2;
|
||||
state[3] = c1;
|
||||
state[1] = c0;
|
||||
state[2] = c1;
|
||||
state[3] = c0;
|
||||
state[4] = veorq_u8(k, n);
|
||||
state[5] = veorq_u8(k, c2);
|
||||
state[6] = veorq_u8(k, c1);
|
||||
state[7] = veorq_u8(k, c2);
|
||||
state[5] = veorq_u8(k, c1);
|
||||
state[6] = veorq_u8(k, c0);
|
||||
state[7] = veorq_u8(k, c1);
|
||||
for (i = 0; i < 10; i++) {
|
||||
crypto_aead_aegis128l_update(state, n, k);
|
||||
}
|
||||
|
||||
@@ -44,9 +44,9 @@ crypto_aead_aegis256_update(__m128i *const state, const __m128i data)
|
||||
static void
|
||||
crypto_aead_aegis256_init(const unsigned char *key, const unsigned char *nonce, __m128i *const state)
|
||||
{
|
||||
const __m128i c1 = _mm_set_epi8(0xdd, 0x28, 0xb5, 0x73, 0x42, 0x31, 0x11, 0x20, 0xf1, 0x2f, 0xc2, 0x6d,
|
||||
const __m128i c0 = _mm_set_epi8(0xdd, 0x28, 0xb5, 0x73, 0x42, 0x31, 0x11, 0x20, 0xf1, 0x2f, 0xc2, 0x6d,
|
||||
0x55, 0x18, 0x3d, 0xdb);
|
||||
const __m128i c2 = _mm_set_epi8(0x62, 0x79, 0xe9, 0x90, 0x59, 0x37, 0x22, 0x15, 0x0d, 0x08, 0x05, 0x03,
|
||||
const __m128i c1 = _mm_set_epi8(0x62, 0x79, 0xe9, 0x90, 0x59, 0x37, 0x22, 0x15, 0x0d, 0x08, 0x05, 0x03,
|
||||
0x02, 0x01, 0x01, 0x00);
|
||||
__m128i k1, k2;
|
||||
__m128i kxn1, kxn2;
|
||||
@@ -59,10 +59,10 @@ crypto_aead_aegis256_init(const unsigned char *key, const unsigned char *nonce,
|
||||
|
||||
state[0] = kxn1;
|
||||
state[1] = kxn2;
|
||||
state[2] = c1;
|
||||
state[3] = c2;
|
||||
state[4] = _mm_xor_si128(k1, c2);
|
||||
state[5] = _mm_xor_si128(k2, c1);
|
||||
state[2] = c0;
|
||||
state[3] = c1;
|
||||
state[4] = _mm_xor_si128(k1, c1);
|
||||
state[5] = _mm_xor_si128(k2, c0);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
crypto_aead_aegis256_update(state, k1);
|
||||
|
||||
@@ -35,16 +35,16 @@ static void
|
||||
crypto_aead_aegis256_init(const unsigned char *key, const unsigned char *nonce,
|
||||
uint8x16_t *const state)
|
||||
{
|
||||
static CRYPTO_ALIGN(16) const unsigned char c1_[] = {
|
||||
static CRYPTO_ALIGN(16) const unsigned char c0_[] = {
|
||||
0xdb, 0x3d, 0x18, 0x55, 0x6d, 0xc2, 0x2f, 0xf1, 0x20, 0x11, 0x31, 0x42,
|
||||
0x73, 0xb5, 0x28, 0xdd
|
||||
};
|
||||
static CRYPTO_ALIGN(16) const unsigned char c2_[] = {
|
||||
static CRYPTO_ALIGN(16) const unsigned char c1_[] = {
|
||||
0x00, 0x01, 0x01, 0x02, 0x03, 0x05, 0x08, 0x0d, 0x15, 0x22, 0x37, 0x59,
|
||||
0x90, 0xe9, 0x79, 0x62
|
||||
};
|
||||
const uint8x16_t c0 = vld1q_u8(c0_);
|
||||
const uint8x16_t c1 = vld1q_u8(c1_);
|
||||
const uint8x16_t c2 = vld1q_u8(c2_);
|
||||
uint8x16_t k1, k2;
|
||||
uint8x16_t kxn1, kxn2;
|
||||
int i;
|
||||
@@ -56,10 +56,10 @@ crypto_aead_aegis256_init(const unsigned char *key, const unsigned char *nonce,
|
||||
|
||||
state[0] = kxn1;
|
||||
state[1] = kxn2;
|
||||
state[2] = c1;
|
||||
state[3] = c2;
|
||||
state[4] = veorq_u8(k1, c2);
|
||||
state[5] = veorq_u8(k2, c1);
|
||||
state[2] = c0;
|
||||
state[3] = c1;
|
||||
state[4] = veorq_u8(k1, c1);
|
||||
state[5] = veorq_u8(k2, c0);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
crypto_aead_aegis256_update(state, k1);
|
||||
|
||||
Reference in New Issue
Block a user