Browse Source

iwym: cc20.h

pull/1119/head
Hamish Coleman 1 year ago
parent
commit
20df771af7
  1. 8
      include/cc20.h
  2. 1
      include/n2n.h
  3. 8
      src/cc20.c
  4. 1
      src/transform_cc20.c

8
include/cc20.h

@ -21,9 +21,9 @@
#define CC20_H #define CC20_H
#include <stdint.h> #include <stddef.h> // for size_t
#include <stdint.h> // for uint32_t, uint8_t
#include "n2n.h" // HAVE_OPENSSL_1_1, traceEvent ... #include "config.h" // HAVE_OPENSSL_1_1
#define CC20_IV_SIZE 16 #define CC20_IV_SIZE 16
@ -46,8 +46,6 @@ typedef struct cc20_context_t {
#elif defined (__SSE2__) // SSE2 --------------------------------------------------------------------------------- #elif defined (__SSE2__) // SSE2 ---------------------------------------------------------------------------------
#include <immintrin.h>
typedef struct cc20_context { typedef struct cc20_context {
uint32_t keystream32[16]; uint32_t keystream32[16];
uint8_t key[CC20_KEY_BYTES]; uint8_t key[CC20_KEY_BYTES];

1
include/n2n.h

@ -143,7 +143,6 @@
#include "pearson.h" #include "pearson.h"
#include "portable_endian.h" #include "portable_endian.h"
#include "aes.h" #include "aes.h"
#include "cc20.h"
#include "speck.h" #include "speck.h"
#include "curve25519.h" #include "curve25519.h"
#include "n2n_regex.h" #include "n2n_regex.h"

8
src/cc20.c

@ -17,7 +17,11 @@
*/ */
#include <stdlib.h> // for calloc, free, size_t
#include <string.h> // for memcpy
#include "cc20.h" #include "cc20.h"
#include "config.h" // HAVE_OPENSSL_1_1
#include "portable_endian.h" // for htole32
#if defined (HAVE_OPENSSL_1_1) // openSSL 1.1 --------------------------------------------------------------------- #if defined (HAVE_OPENSSL_1_1) // openSSL 1.1 ---------------------------------------------------------------------
@ -84,6 +88,10 @@ int cc20_crypt (unsigned char *out, const unsigned char *in, size_t in_len,
// https://github.com/Ginurx/chacha20-c (public domain) // https://github.com/Ginurx/chacha20-c (public domain)
#include <immintrin.h> // for _mm_xor_si128, _mm_add_epi32, _mm_slli_epi32
#include <xmmintrin.h> // for _MM_SHUFFLE
#define SL _mm_slli_epi32 #define SL _mm_slli_epi32
#define SR _mm_srli_epi32 #define SR _mm_srli_epi32
#define XOR _mm_xor_si128 #define XOR _mm_xor_si128

1
src/transform_cc20.c

@ -17,6 +17,7 @@
*/ */
#include "cc20.h" // for CC20_IV_SIZE, cc20_crypt, cc20_deinit
#include "n2n.h" #include "n2n.h"

Loading…
Cancel
Save