diff --git a/LICENCE b/LICENCE index 846270f..c964f1f 100644 --- a/LICENCE +++ b/LICENCE @@ -1,7 +1,7 @@ Copyright (c) 2009 Colin Percival, 2011 ArtForz Copyright (c) 2012 Andrew Moon (floodyberry) Copyright (c) 2012 Samuel Neves -Copyright (c) 2014-2016 John Doering +Copyright (c) 2014-2018 John Doering All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/README.md b/README.md index 01853ed..c39c79e 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,11 @@ NeoScrypt NeoScrypt is a strong memory intensive key derivation function. Compile time definitions: - - -DSHA256 enables optional SHA-256 support (Scrypt compatibility); - - -DBLAKE256 enables optional BLAKE-256 support; - - -DOPT enables FastKDF performance optimisations; - - -DASM enables 32-bit and 64-bit assembly optimisations; - - -DMINER_4WAY enables 4-way mining per thread (requires -DASM). + - -DNEOSCRYPT_SHA256 enables optional SHA-256 support (Scrypt compatibility); + - -DNEOSCRYPT_BLAKE256 enables optional BLAKE-256 support; + - -DNEOSCRYPT_OPT enables FastKDF performance optimisations; + - -DNEOSCRYPT_ASM enables 32-bit and 64-bit assembly optimisations; + - -DNEOSCRYPT_MINER_4WAY enables 4-way mining per thread (requires -DNEOSCRYPT_ASM). There are also test vectors and benchmarks available. diff --git a/build.sh b/build.sh index 83e2780..5651a98 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #!/bin/sh -DEFINES="-DASM -DOPT -DMINER_4WAY -DSHA256" +DEFINES="-DNEOSCRYPT_ASM -DNEOSCRYPT_OPT -DNEOSCRYPT_MINER_4WAY -DNEOSCRYPT_SHA256" CC="gcc" CFLAGS="-Wall -O2 -fomit-frame-pointer -fno-stack-protector" diff --git a/neoscrypt.c b/neoscrypt.c index d9198f1..97c6bf4 100644 --- a/neoscrypt.c +++ b/neoscrypt.c @@ -35,7 +35,7 @@ #include "neoscrypt.h" -#ifdef SHA256 +#ifdef NEOSCRYPT_SHA256 /* SHA-256 */ @@ -274,10 +274,10 @@ void neoscrypt_pbkdf2_sha256(const uchar *password, uint password_len, } } -#endif /* SHA256 */ +#endif /* NEOSCRYPT_SHA256 */ -#ifdef BLAKE256 +#ifdef NEOSCRYPT_BLAKE256 /* BLAKE-256 */ @@ -566,12 +566,12 @@ static void neoscrypt_pbkdf2_blake256(const uchar *password, } } -#endif /* BLAKE256 */ +#endif /* NEOSCRYPT_BLAKE256 */ /* NeoScrypt */ -#ifdef ASM +#ifdef NEOSCRYPT_ASM extern void neoscrypt_copy(void *dstp, const void *srcp, uint len); extern void neoscrypt_erase(void *dstp, uint len); @@ -748,7 +748,7 @@ void neoscrypt_xor(void *dstp, const void *srcp, uint len) { dst[i] ^= src[i]; } -#endif /* ASM */ +#endif /* NEOSCRYPT_ASM */ /* BLAKE2s */ @@ -783,7 +783,7 @@ static const uint blake2s_IV[8] = { 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 }; -#ifdef ASM +#ifdef NEOSCRYPT_ASM extern void blake2s_compress(blake2s_state *S); @@ -2192,7 +2192,7 @@ static void blake2s_compress(blake2s_state *S) { S->h[7] ^= v[7] ^ v[15]; } -#endif /* ASM */ +#endif /* NEOSCRYPT_ASM */ static void blake2s_update(blake2s_state *S, const uchar *input, uint input_size) { @@ -2264,7 +2264,7 @@ void neoscrypt_blake2s(const void *input, const uint input_size, neoscrypt_copy(output, S, output_size); } -#ifndef OPT +#ifndef NEOSCRYPT_OPT #define FASTKDF_BUFFER_SIZE 256U @@ -2362,7 +2362,7 @@ void neoscrypt_fastkdf(const uchar *password, uint password_len, #else -#ifdef ASM +#ifdef NEOSCRYPT_ASM extern void neoscrypt_fastkdf_opt(const uchar *password, const uchar *salt, uchar *output, uint mode); @@ -2459,12 +2459,12 @@ void neoscrypt_fastkdf_opt(const uchar *password, const uchar *salt, } } -#endif /* ASM */ +#endif /* NEOSCRYPT_ASM */ -#endif /* !(OPT) */ +#endif /* !(NEOSCRYPT_OPT) */ -#ifndef ASM +#ifndef NEOSCRYPT_ASM /* Configurable optimised block mixer */ static void neoscrypt_blkmix(uint *X, uint *Y, uint r, uint mixmode) { @@ -2604,7 +2604,7 @@ void neoscrypt(const uchar *password, uchar *output, uint profile) { default: case(0x0): -#ifdef OPT +#ifdef NEOSCRYPT_OPT neoscrypt_fastkdf_opt(password, password, (uchar *) X, 0); #else neoscrypt_fastkdf(password, 80, password, 80, 32, @@ -2612,14 +2612,14 @@ void neoscrypt(const uchar *password, uchar *output, uint profile) { #endif break; -#ifdef SHA256 +#ifdef NEOSCRYPT_SHA256 case(0x1): neoscrypt_pbkdf2_sha256(password, 80, password, 80, 1, (uchar *) X, r * 2 * BLOCK_SIZE); break; #endif -#ifdef BLAKE256 +#ifdef NEOSCRYPT_BLAKE256 case(0x2): neoscrypt_pbkdf2_blake256(password, 80, password, 80, 1, (uchar *) X, r * 2 * BLOCK_SIZE); @@ -2677,7 +2677,7 @@ void neoscrypt(const uchar *password, uchar *output, uint profile) { default: case(0x0): -#ifdef OPT +#ifdef NEOSCRYPT_OPT neoscrypt_fastkdf_opt(password, (uchar *) X, output, 1); #else neoscrypt_fastkdf(password, 80, (uchar *) X, @@ -2685,14 +2685,14 @@ void neoscrypt(const uchar *password, uchar *output, uint profile) { #endif break; -#ifdef SHA256 +#ifdef NEOSCRYPT_SHA256 case(0x1): neoscrypt_pbkdf2_sha256(password, 80, (uchar *) X, r * 2 * BLOCK_SIZE, 1, output, 32); break; #endif -#ifdef BLAKE256 +#ifdef NEOSCRYPT_BLAKE256 case(0x2): neoscrypt_pbkdf2_blake256(password, 80, (uchar *) X, r * 2 * BLOCK_SIZE, 1, output, 32); @@ -2703,10 +2703,10 @@ void neoscrypt(const uchar *password, uchar *output, uint profile) { } -#endif /* !(ASM) */ +#endif /* !(NEOSCRYPT_ASM) */ -#if defined(ASM) && defined(MINER_4WAY) +#if defined(NEOSCRYPT_ASM) && defined(NEOSCRYPT_MINER_4WAY) extern void neoscrypt_xor_salsa_4way(uint *X, uint *X0, uint *Y, uint double_rounds); extern void neoscrypt_xor_chacha_4way(uint *Z, uint *Z0, uint *Y, uint double_rounds); @@ -2910,7 +2910,7 @@ void neoscrypt_4way(const uchar *password, uchar *output, uchar *scratchpad) { (uchar *) &scratchpad[0], 1); } -#ifdef SHA256 +#ifdef NEOSCRYPT_SHA256 /* 4-way Scrypt(1024, 1, 1) with Salsa20/8 */ void scrypt_4way(const uchar *password, uchar *output, uchar *scratchpad) { const uint N = 1024, r = 1, double_rounds = 4; @@ -2960,7 +2960,7 @@ void scrypt_4way(const uchar *password, uchar *output, uchar *scratchpad) { (uchar *) &Y[k * r * 32], r * 128, 1, (uchar *) &output[k * 32], 32); } -#endif /* SHA256 */ +#endif /* NEOSCRYPT_SHA256 */ extern void blake2s_compress_4way(void *T); @@ -3242,9 +3242,9 @@ void neoscrypt_fastkdf_4way(const uchar *password, const uchar *salt, } -#endif /* (ASM) && (MINER_4WAY) */ +#endif /* (NEOSCRYPT_ASM) && (NEOSCRYPT_MINER_4WAY) */ -#ifndef ASM +#ifndef NEOSCRYPT_ASM uint cpu_vec_exts() { /* No assembly, no extensions */ diff --git a/neoscrypt.h b/neoscrypt.h index f385b43..72383f4 100644 --- a/neoscrypt.h +++ b/neoscrypt.h @@ -13,11 +13,11 @@ void neoscrypt_copy(void *dstp, const void *srcp, unsigned int len); void neoscrypt_erase(void *dstp, unsigned int len); void neoscrypt_xor(void *dstp, const void *srcp, unsigned int len); -#if defined(ASM) && defined(MINER_4WAY) +#if defined(NEOSCRYPT_ASM) && defined(NEOSCRYPT_MINER_4WAY) void neoscrypt_4way(const unsigned char *password, unsigned char *output, unsigned char *scratchpad); -#ifdef SHA256 +#ifdef NEOSCRYPT_SHA256 void scrypt_4way(const unsigned char *password, unsigned char *output, unsigned char *scratchpad); #endif diff --git a/neoscrypt_asm.S b/neoscrypt_asm.S index 3889cb8..3e9ec85 100644 --- a/neoscrypt_asm.S +++ b/neoscrypt_asm.S @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2016 John Doering + * Copyright (c) 2014-2018 John Doering * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -24,10 +24,11 @@ * SUCH DAMAGE. */ -#if defined(ASM) && defined(__x86_64__) +#if defined(NEOSCRYPT_ASM) && defined(__x86_64__) -/* MOVQ_FIX addresses incorrect behaviour of old GNU assembler when transferring - * data between a 64-bit general purpose register and an MMX/SSE register: +/* NEOSCRYPT_MOVQ_FIX addresses incorrect behaviour of old GNU assembler + * when transferring data between a 64-bit general purpose register + * and an MMX/SSE register: * suffix or operands invalid for `movq' */ /* blake2s_compress(mem) @@ -49,7 +50,7 @@ _blake2s_compress: movq %rcx, %rdi #endif -#ifndef MOVQ_FIX +#ifndef NEOSCRYPT_MOVQ_FIX movq %rsp, %mm0 #else movd %esp, %mm0 @@ -1312,7 +1313,7 @@ _blake2s_compress: xorl %r12d, 16(%rdi) /* finalise */ xorl %r14d, 24(%rdi) /* finalise */ -#ifndef MOVQ_FIX +#ifndef NEOSCRYPT_MOVQ_FIX movq %mm0, %rsp #else movd %mm0, %esp @@ -1718,7 +1719,7 @@ _neoscrypt_fastkdf_opt: psadbw %xmm5, %xmm0 movhlps %xmm0, %xmm1 paddq %xmm1, %xmm0 -#ifndef MOVQ_FIX +#ifndef NEOSCRYPT_MOVQ_FIX movq %xmm0, %r13 #else movq %xmm0, 0(%r14) @@ -2519,7 +2520,7 @@ _neoscrypt: movq %rsi, %r15 movq %rdx, %rbx -#ifdef SHA256 +#ifdef NEOSCRYPT_SHA256 /* Scrypt mode */ testl $0x01, %ebx jnz .scrypt @@ -2552,7 +2553,7 @@ _neoscrypt: /* FastKDF */ #ifdef WIN64 -#ifdef OPT +#ifdef NEOSCRYPT_OPT movq %r14, %rcx movq %r14, %rdx movq %rbp, %r8 @@ -2568,9 +2569,9 @@ _neoscrypt: movq %rbp, 40(%rsp) movq $256, 48(%rsp) call neoscrypt_fastkdf -#endif /* OPT */ +#endif /* NEOSCRYPT_OPT */ #else -#ifdef OPT +#ifdef NEOSCRYPT_OPT movq %r14, %rdi movq %r14, %rsi movq %rbp, %rdx @@ -2594,7 +2595,7 @@ _neoscrypt: #else call neoscrypt_fastkdf #endif /* __APPLE__ */ -#endif /* OPT */ +#endif /* NEOSCRYPT_OPT */ #endif /* WIN64 */ /* blkcpy(Z, X) */ @@ -3047,7 +3048,7 @@ _neoscrypt: /* FastKDF */ #ifdef WIN64 -#ifdef OPT +#ifdef NEOSCRYPT_OPT movq %r14, %rcx movq %rbp, %rdx movq %r15, %r8 @@ -3064,9 +3065,9 @@ _neoscrypt: movq %r15, 40(%rsp) movq %rax, 48(%rsp) call neoscrypt_fastkdf -#endif /* OPT */ +#endif /* NEOSCRYPT_OPT */ #else -#ifdef OPT +#ifdef NEOSCRYPT_OPT movq %r14, %rdi movq %rbp, %rsi movq %r15, %rdx @@ -3090,7 +3091,7 @@ _neoscrypt: #else call neoscrypt_fastkdf #endif /* __APPLE__ */ -#endif /* OPT */ +#endif /* NEOSCRYPT_OPT */ #endif /* WIN64 */ #ifdef WIN64 @@ -3533,7 +3534,7 @@ _neoscrypt: /* FastKDF */ #ifdef WIN64 -#ifdef OPT +#ifdef NEOSCRYPT_OPT movq %r14, %rcx movq %rbp, %rdx movq %r15, %r8 @@ -3550,9 +3551,9 @@ _neoscrypt: movq %r15, 40(%rsp) movq %rax, 48(%rsp) call neoscrypt_fastkdf -#endif /* OPT */ +#endif /* NEOSCRYPT_OPT */ #else -#ifdef OPT +#ifdef NEOSCRYPT_OPT movq %r14, %rdi movq %rbp, %rsi movq %r15, %rdx @@ -3577,7 +3578,7 @@ _neoscrypt: #else call neoscrypt_fastkdf #endif /* __APPLE__ */ -#endif /* OPT */ +#endif /* NEOSCRYPT_OPT */ #endif /* WIN64 */ #ifdef WIN64 @@ -3602,7 +3603,7 @@ _neoscrypt: #endif ret -#ifdef SHA256 +#ifdef NEOSCRYPT_SHA256 .scrypt: #ifdef WIN64 @@ -3939,9 +3940,9 @@ _neoscrypt: #endif ret -#endif /* SHA256 */ +#endif /* NEOSCRYPT_SHA256 */ -#ifdef MINER_4WAY +#ifdef NEOSCRYPT_MINER_4WAY /* blake2s_compress_4way(mem) * AMD64 (SSE2) BLAKE2s 4-way block compression */ @@ -3998,7 +3999,7 @@ _blake2s_compress_4way: movq %r8, 136(%rsi) /* movq %r9, 144(%rsi) */ /* movq %r9, 152(%rsi) */ -#ifndef MOVQ_FIX +#ifndef NEOSCRYPT_MOVQ_FIX movq %r9, %xmm9 movlhps %xmm9, %xmm9 #else @@ -4010,7 +4011,7 @@ _blake2s_compress_4way: movq %r10, 168(%rsi) /* movq %r11, 176(%rsi) */ /* movq %r11, 184(%rsi) */ -#ifndef MOVQ_FIX +#ifndef NEOSCRYPT_MOVQ_FIX movq %r11, %xmm11 movlhps %xmm11, %xmm11 #else @@ -4051,7 +4052,7 @@ _blake2s_compress_4way: /* movq %rax, 192(%rsi) */ /* movq %rbx, 200(%rsi) */ /* movdqa 192(%rsi), %xmm3 */ /* A */ -#ifndef MOVQ_FIX +#ifndef NEOSCRYPT_MOVQ_FIX movq %rax, %xmm3 movq %rbx, %xmm15 movlhps %xmm15, %xmm3 @@ -4066,7 +4067,7 @@ _blake2s_compress_4way: /* movq %r8, 224(%rsi) */ /* movq %r9, 232(%rsi) */ /* movdqa 224(%rsi), %xmm7 */ /* C */ -#ifndef MOVQ_FIX +#ifndef NEOSCRYPT_MOVQ_FIX movq %r8, %xmm7 movq %r9, %xmm15 movlhps %xmm15, %xmm7 @@ -7919,7 +7920,7 @@ _neoscrypt_xor_chacha_4way: #endif ret -#endif /* MINER_4WAY */ +#endif /* NEOSCRYPT_MINER_4WAY */ /* cpu_vec_exts() * AMD64 detector of any processor vector extensions present @@ -8017,10 +8018,10 @@ _cpu_vec_exts: popq %rbx ret -#endif /* (ASM) && (__x86_64__) */ +#endif /* (NEOSCRYPT_ASM) && (__x86_64__) */ -#if defined(ASM) && defined(__i386__) +#if defined(NEOSCRYPT_ASM) && defined(__i386__) /* blake2s_compress(mem) * i386 BLAKE2s block compression */ @@ -11306,7 +11307,7 @@ _neoscrypt: movl 24(%esp), %edi movl 28(%esp), %ebx -#ifdef SHA256 +#ifdef NEOSCRYPT_SHA256 /* Scrypt mode */ testl $0x01, %ebx jnz .scrypt @@ -11338,7 +11339,7 @@ _neoscrypt: #endif /* WIN32 */ /* FastKDF */ -#ifdef OPT +#ifdef NEOSCRYPT_OPT movl %esi, 0(%esp) movl %esi, 4(%esp) movl %ebp, 8(%esp) @@ -11363,7 +11364,7 @@ _neoscrypt: #else call neoscrypt_fastkdf #endif /* (WIN32) || (__APPLE__) */ -#endif /* OPT */ +#endif /* NEOSCRYPT_OPT */ /* SSE2 switch */ testl $0x1000, %ebx @@ -12128,7 +12129,7 @@ _neoscrypt: movq %mm7, 248(%ebp) /* FastKDF */ -#ifdef OPT +#ifdef NEOSCRYPT_OPT movl %esi, 0(%esp) movl %ebp, 4(%esp) movl %edi, 8(%esp) @@ -12151,7 +12152,7 @@ _neoscrypt: #else call neoscrypt_fastkdf #endif /* (WIN32) || (__APPLE__) */ -#endif /* OPT */ +#endif /* NEOSCRYPT_OPT */ #ifdef WIN32 /* free memory */ @@ -12633,7 +12634,7 @@ _neoscrypt: movdqa %xmm7, 240(%ebp) /* FastKDF */ -#ifdef OPT +#ifdef NEOSCRYPT_OPT movl %esi, 0(%esp) movl %ebp, 4(%esp) movl %edi, 8(%esp) @@ -12656,7 +12657,7 @@ _neoscrypt: #else call neoscrypt_fastkdf #endif /* (WIN32) || (__APPLE__) */ -#endif /* OPT */ +#endif /* NEOSCRYPT_OPT */ #ifdef WIN32 /* free memory */ @@ -12675,7 +12676,7 @@ _neoscrypt: popl %ebx ret -#ifdef SHA256 +#ifdef NEOSCRYPT_SHA256 .scrypt: #ifdef WIN32 @@ -13006,9 +13007,9 @@ _neoscrypt: popl %ebx ret -#endif /* SHA256 */ +#endif /* NEOSCRYPT_SHA256 */ -#ifdef MINER_4WAY +#ifdef NEOSCRYPT_MINER_4WAY /* blake2s_compress_4way(mem) * i386 (SSE2) BLAKE2s 4-way block compression */ @@ -16939,7 +16940,7 @@ _neoscrypt_xor_chacha_4way: ret -#endif /* MINER_4WAY */ +#endif /* NEOSCRYPT_MINER_4WAY */ /* cpu_vec_exts() * i386 detector of any vector extensions present @@ -17061,4 +17062,4 @@ _cpu_vec_exts: popl %ebx ret -#endif /* (ASM) && (__i386__) */ +#endif /* (NEOSCRYPT_ASM) && (__i386__) */ diff --git a/neoscrypt_test.c b/neoscrypt_test.c index a444fb8..ebd4db7 100644 --- a/neoscrypt_test.c +++ b/neoscrypt_test.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2016 John Doering + * Copyright (c) 2014-2018 John Doering * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,7 +35,7 @@ #include "neoscrypt.h" -#ifdef OPT +#ifdef NEOSCRYPT_OPT extern void neoscrypt_fastkdf_opt(const uchar *password, const uchar *salt, uchar *output, uint mode); #else @@ -62,12 +62,12 @@ int main(int argc, char *argv[]) { uint kdf_input_len = 80, kdf_output_len = 256; uint neoscrypt_output_len = 32; uchar input[kdf_input_len], output[kdf_output_len]; -#if defined(ASM) && defined(MINER_4WAY) +#if defined(NEOSCRYPT_ASM) && defined(NEOSCRYPT_MINER_4WAY) uchar prf_input_4way[256], prf_key_4way[128]; uchar kdf_input_4way[320], kdf_key_4way[320], kdf_output_4way[1024]; const size_t align = 0x40; uchar *scratchbuf; -#ifndef SHA256 +#ifndef NEOSCRYPT_SHA256 scratchbuf = (uchar *) malloc(134464 + align); #else scratchbuf = (uchar *) malloc(525632 + align); @@ -82,7 +82,7 @@ int main(int argc, char *argv[]) { struct timeval time; ullong delta, start, ustart, finish, ufinish; uint *pinput = (uint *) &input[0]; -#if defined(ASM) && defined(MINER_4WAY) +#if defined(NEOSCRYPT_ASM) && defined(NEOSCRYPT_MINER_4WAY) uint *pprf_input = (uint *) &prf_input_4way[0]; uint *pkdf_input = (uint *) &kdf_input_4way[0]; #endif @@ -135,7 +135,7 @@ int main(int argc, char *argv[]) { start = time.tv_sec; ustart = time.tv_usec; for(i = 0; i < it; i++) { -#ifdef OPT +#ifdef NEOSCRYPT_OPT neoscrypt_fastkdf_opt(input, input, output, 0); #else neoscrypt_fastkdf(input, kdf_input_len, input, kdf_input_len, 32, @@ -164,7 +164,7 @@ int main(int argc, char *argv[]) { finish = time.tv_sec; ufinish = time.tv_usec; delta = (finish - start) * 1000000 + ufinish - ustart; -#ifndef ASM +#ifndef NEOSCRYPT_ASM printf("NeoScrypt: %.3f KH/s\n", #else printf("NeoScrypt INT: %.3f KH/s\n", @@ -172,7 +172,7 @@ int main(int argc, char *argv[]) { (double)it * 1000 / (double)delta); return(0); -#ifdef SHA256 +#ifdef NEOSCRYPT_SHA256 case(4): if(!it) it = 5000; gettimeofday(&time, NULL); @@ -186,7 +186,7 @@ int main(int argc, char *argv[]) { finish = time.tv_sec; ufinish = time.tv_usec; delta = (finish - start) * 1000000 + ufinish - ustart; -#ifndef ASM +#ifndef NEOSCRYPT_ASM printf("Scrypt: %.3f KH/s\n", #else printf("Scrypt INT: %.3f KH/s\n", @@ -208,7 +208,7 @@ int main(int argc, char *argv[]) { finish = time.tv_sec; ufinish = time.tv_usec; delta = (finish - start) * 1000000 + ufinish - ustart; -#ifndef ASM +#ifndef NEOSCRYPT_ASM printf("NeoScrypt: %.3f KH/s\n", #else printf("NeoScrypt SSE2: %.3f KH/s\n", @@ -216,7 +216,7 @@ int main(int argc, char *argv[]) { (double)it * 1000 / (double)delta); return(0); -#ifdef SHA256 +#ifdef NEOSCRYPT_SHA256 case(6): if(!it) it = 5000; gettimeofday(&time, NULL); @@ -230,7 +230,7 @@ int main(int argc, char *argv[]) { finish = time.tv_sec; ufinish = time.tv_usec; delta = (finish - start) * 1000000 + ufinish - ustart; -#ifndef ASM +#ifndef NEOSCRYPT_ASM printf("Scrypt: %.3f KH/s\n", #else printf("Scrypt SSE2: %.3f KH/s\n", @@ -239,7 +239,7 @@ int main(int argc, char *argv[]) { return(0); #endif -#if defined(ASM) && defined(MINER_4WAY) +#if defined(NEOSCRYPT_ASM) && defined(NEOSCRYPT_MINER_4WAY) case(7): if(!it) it = 1000000; gettimeofday(&time, NULL); @@ -293,7 +293,7 @@ int main(int argc, char *argv[]) { (double)it * 1000 / (double)delta); return(0); -#ifdef SHA256 +#ifdef NEOSCRYPT_SHA256 case(10): if(!it) it = 5000; gettimeofday(&time, NULL); @@ -339,7 +339,7 @@ int main(int argc, char *argv[]) { printf("BLAKE2s integrity test %s", status ? fail_str : pass_str); -#ifdef OPT +#ifdef NEOSCRYPT_OPT neoscrypt_fastkdf_opt(input, input, output, 0); #else neoscrypt_fastkdf(input, kdf_input_len, input, kdf_input_len, 32, @@ -407,7 +407,7 @@ int main(int argc, char *argv[]) { } } -#ifndef ASM +#ifndef NEOSCRYPT_ASM printf("NeoScrypt integrity test %s", status ? fail_str : pass_str); #else printf("NeoScrypt INT integrity test %s", status ? fail_str : pass_str); @@ -425,7 +425,7 @@ int main(int argc, char *argv[]) { printf("NeoScrypt SSE2 integrity test %s", status ? fail_str : pass_str); #endif -#ifdef SHA256 +#ifdef NEOSCRYPT_SHA256 neoscrypt(input, output, 0x80000903); @@ -443,7 +443,7 @@ int main(int argc, char *argv[]) { } } -#ifndef ASM +#ifndef NEOSCRYPT_ASM printf("Scrypt integrity test %s", status ? fail_str : pass_str); #else printf("Scrypt INT integrity test %s", status ? fail_str : pass_str); @@ -461,9 +461,9 @@ int main(int argc, char *argv[]) { printf("Scrypt SSE2 integrity test %s", status ? fail_str : pass_str); #endif -#endif /* SHA256 */ +#endif /* NEOSCRYPT_SHA256 */ -#if defined(ASM) && defined(MINER_4WAY) +#if defined(NEOSCRYPT_ASM) && defined(NEOSCRYPT_MINER_4WAY) prf_input_4way[0] = 0x00; prf_key_4way[0] = 0x00; @@ -792,7 +792,7 @@ int main(int argc, char *argv[]) { printf("NeoScrypt SSE2 4-way part D integrity test %s", status ? fail_str : pass_str); -#ifdef SHA256 +#ifdef NEOSCRYPT_SHA256 scrypt_4way(input, output, (uchar *) &scratchbuf[(size_t)scratchbuf & (align - 1)]); @@ -858,11 +858,11 @@ int main(int argc, char *argv[]) { printf("Scrypt SSE2 4-way part D integrity test %s", status ? fail_str : pass_str); -#endif /* SHA256 */ +#endif /* NEOSCRYPT_SHA256 */ free(scratchbuf); -#endif /* (ASM) && (MINER_4WAY) */ +#endif /* (NEOSCRYPT_ASM) && (NEOSCRYPT_MINER_4WAY) */ return(ret_status); }