Get rid of core_hchacha20.h
This commit is contained in:
parent
7bbeba5723
commit
d26c8adf84
@ -154,7 +154,6 @@ libsodium_la_SOURCES += \
|
||||
crypto_aead/xchacha20poly1305/sodium/aead_xchacha20poly1305.c \
|
||||
crypto_box/curve25519xchacha20poly1305/box_curve25519xchacha20poly1305.c \
|
||||
crypto_core/hchacha20/core_hchacha20.c \
|
||||
crypto_core/hchacha20/core_hchacha20.h \
|
||||
crypto_core/salsa2012/core_salsa2012.c \
|
||||
crypto_core/salsa2012/ref/core_salsa2012_ref.c \
|
||||
crypto_core/salsa208/core_salsa208.c \
|
||||
|
@ -2,10 +2,17 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "core_hchacha20.h"
|
||||
#include "crypto_core_hchacha20.h"
|
||||
#include "private/common.h"
|
||||
|
||||
#define QUARTERROUND(A, B, C, D) \
|
||||
do { \
|
||||
A += B; D = ROTL32(D ^ A, 16); \
|
||||
C += D; B = ROTL32(B ^ C, 12); \
|
||||
A += B; D = ROTL32(D ^ A, 8); \
|
||||
C += D; B = ROTL32(B ^ C, 7); \
|
||||
} while(0)
|
||||
|
||||
int
|
||||
crypto_core_hchacha20(unsigned char *out, const unsigned char *in,
|
||||
const unsigned char *k, const unsigned char *c)
|
||||
@ -15,10 +22,10 @@ crypto_core_hchacha20(unsigned char *out, const unsigned char *in,
|
||||
uint32_t x8, x9, x10, x11, x12, x13, x14, x15;
|
||||
|
||||
if (c == NULL) {
|
||||
x0 = U32C(0x61707865);
|
||||
x1 = U32C(0x3320646e);
|
||||
x2 = U32C(0x79622d32);
|
||||
x3 = U32C(0x6b206574);
|
||||
x0 = 0x61707865;
|
||||
x1 = 0x3320646e;
|
||||
x2 = 0x79622d32;
|
||||
x3 = 0x6b206574;
|
||||
} else {
|
||||
x0 = LOAD32_LE(c + 0);
|
||||
x1 = LOAD32_LE(c + 4);
|
||||
|
@ -1,26 +0,0 @@
|
||||
#ifndef core_hchacha20_H
|
||||
#define core_hchacha20_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define U8C(v) (v##U)
|
||||
#define U32C(v) (v##U)
|
||||
|
||||
#define U8V(v) ((uint8_t)(v) & U8C(0xFF))
|
||||
#define U32V(v) ((uint32_t)(v) & U32C(0xFFFFFFFF))
|
||||
|
||||
#define ROTATE(v, c) (ROTL32(v, c))
|
||||
#define XOR(v, w) ((v) ^ (w))
|
||||
#define PLUS(v, w) (U32V((v) + (w)))
|
||||
|
||||
#define QUARTERROUND(a, b, c, d) \
|
||||
do { \
|
||||
a = PLUS(a, b); d = ROTATE(XOR(d, a), 16); \
|
||||
c = PLUS(c, d); b = ROTATE(XOR(b, c), 12); \
|
||||
a = PLUS(a, b); d = ROTATE(XOR(d, a), 8); \
|
||||
c = PLUS(c, d); b = ROTATE(XOR(b, c), 7); \
|
||||
} while(0)
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user