This commit is contained in:
Jay D Dee
2017-04-16 12:55:19 -04:00
parent 9afa0d9820
commit 53259692eb
31 changed files with 211 additions and 3934 deletions

View File

@@ -15,7 +15,7 @@
typedef struct
{
#ifdef NO_AES_NI
sph_groestl512_context groestl;
sph_groestl512_context groestl1, groestl2;
#else
hashState_groestl groestl1, groestl2;
#endif
@@ -27,7 +27,8 @@ static groestl_ctx_holder groestl_ctx;
void init_groestl_ctx()
{
#ifdef NO_AES_NI
sph_groestl512_init( &groestl_ctx.groestl );
sph_groestl512_init( &groestl_ctx.groestl1 );
sph_groestl512_init( &groestl_ctx.groestl2 );
#else
init_groestl( &groestl_ctx.groestl1, 64 );
init_groestl( &groestl_ctx.groestl2, 64 );
@@ -41,16 +42,16 @@ void groestlhash( void *output, const void *input )
memcpy( &ctx, &groestl_ctx, sizeof(groestl_ctx) );
#ifdef NO_AES_NI
sph_groestl512(&ctx.groestl, input, 80);
sph_groestl512_close(&ctx.groestl, hash);
sph_groestl512(&ctx.groestl1, input, 80);
sph_groestl512_close(&ctx.groestl1, hash);
sph_groestl512(&ctx.groestl, hash, 64);
sph_groestl512_close(&ctx.groestl, hash);
sph_groestl512(&ctx.groestl2, hash, 64);
sph_groestl512_close(&ctx.groestl2, hash);
#else
update_and_final_groestl( &ctx.groestl1, (char*)hash,
(const char*)input, 640 );
update_and_final_groestl( &ctx.groestl1, (char*)hash,
update_and_final_groestl( &ctx.groestl2, (char*)hash,
(const char*)hash, 512 );
#endif
memcpy(output, hash, 32);
@@ -110,3 +111,10 @@ bool register_groestl_algo( algo_gate_t* gate )
return true;
};
bool register_dmd_gr_algo( algo_gate_t* gate )
{
register_groestl_algo( gate );
gate->gen_merkle_root = (void*)&sha256d_gen_merkle_root;
return true;
};

View File

@@ -12,7 +12,7 @@
#include "aes_ni/hash-groestl.h"
#endif
#if defined (SHA_NI)
#if defined __SHA__
#include <openssl/sha.h>
#else
#include "algo/sha/sph_sha2.h"
@@ -24,7 +24,7 @@ typedef struct {
#else
hashState_groestl groestl;
#endif
#if defined (SHA_NI)
#if defined __SHA__
SHA256_CTX sha;
#else
sph_sha256_context sha;
@@ -40,7 +40,7 @@ void init_myrgr_ctx()
#else
init_groestl (&myrgr_ctx.groestl, 64 );
#endif
#if defined (SHA_NI)
#if defined __SHA__
SHA256_Init( &myrgr_ctx.sha );
#else
sph_sha256_init( &myrgr_ctx.sha );
@@ -61,7 +61,7 @@ void myriadhash( void *output, const void *input )
(const char*)input, 640 );
#endif
#if defined (SHA_NI)
#if defined __SHA__
SHA256_Update( &ctx.sha, hash, 64 );
SHA256_Final( (unsigned char*) hash, &ctx.sha );
#else