mirror of
https://github.com/ntop/n2n.git
synced 2024-09-19 16:41:11 +02:00
Compilation fixes
This commit is contained in:
parent
bd49b4e3a3
commit
e50d39b5ce
10
edge.c
10
edge.c
|
@ -340,8 +340,6 @@ static int setOption(int optkey, char *optargument, n2n_priv_config_t *ec, n2n_e
|
|||
case 'k': /* encrypt key */
|
||||
{
|
||||
if(conf->encrypt_key) free(conf->encrypt_key);
|
||||
if(conf->transop_id == N2N_TRANSFORM_ID_NULL)
|
||||
conf->transop_id = N2N_TRANSFORM_ID_TWOFISH;
|
||||
conf->encrypt_key = strdup(optargument);
|
||||
traceEvent(TRACE_DEBUG, "encrypt_key = '%s'\n", conf->encrypt_key);
|
||||
break;
|
||||
|
@ -835,6 +833,14 @@ int main(int argc, char* argv[]) {
|
|||
rc = -1;
|
||||
#endif
|
||||
|
||||
if(conf.transop_id == N2N_TRANSFORM_ID_NULL) {
|
||||
if(conf.encrypt_key) {
|
||||
traceEvent(TRACE_WARNING, "Ignoring -k as -A1 was set");
|
||||
free(conf.encrypt_key);
|
||||
conf.encrypt_key = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if(rc < 0)
|
||||
help();
|
||||
|
||||
|
|
5
speck.c
5
speck.c
|
@ -6,6 +6,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "speck.h"
|
||||
|
||||
#if defined (__AVX2__) // AVX support ----------------------------------------------------
|
||||
|
||||
|
@ -606,10 +607,6 @@ int speck_expand_key (const unsigned char *k, speck_context_t *ctx) {
|
|||
#define ROL64(x,r) (((x)<<(r))|((x)>>(64-(r))))
|
||||
#define R(x,y,k) (x=ROR64(x,8), x+=y, x^=k, y=ROL64(y,3), y^=x)
|
||||
|
||||
typedef struct {
|
||||
u64 key[34];
|
||||
} speck_context_t;
|
||||
|
||||
|
||||
static int speck_encrypt (u64 *u, u64 *v, speck_context_t *ctx) {
|
||||
|
||||
|
|
9
speck.h
9
speck.h
|
@ -1,3 +1,12 @@
|
|||
// cipher SPECK -- 128 bit block size -- 256 bit key size
|
||||
// taken from (and modified: removed pure crypto-stream generation and seperated key expansion)
|
||||
// https://github.com/nsacyber/simon-speck-supercop/blob/master/crypto_stream/speck128256ctr/
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <libkern/OSByteOrder.h>
|
||||
#define htole64(x) OSSwapHostToLittleInt64(x)
|
||||
#endif
|
||||
|
||||
#define u64 uint64_t
|
||||
|
||||
#if defined (__AVX2__)
|
||||
|
|
Loading…
Reference in New Issue
Block a user