Hello Salem, i can't find a way to post as John did, i will post on the table this time and figure it out on my next post how to do it, sorry for that...
So this is my new lyra2z330.c file folowing John's advises
Code:
#include <stdlib.h> |
|
#include <stdint.h> |
|
#include <string.h> |
|
#include <stdio.h> |
|
#include <stdbool.h> |
|
#include "Lyra2.h" |
|
|
|
#define _ALIGN(x) __attribute__ ((aligned(x))) |
|
|
|
__thread uint64_t* lyra2z330_wholeMatrix; |
|
|
|
void lyra2z330_hash(const char *input, char *state, uint32_t height) |
|
{ |
|
uint32_t _ALIGN(256) hash[16]; |
|
|
|
LYRA2Z((void*)hash, 32, (void*)input, 80, (void*)input, 80, 2, 330, 256); |
|
memcpy(state, hash, 32); |
|
|
|
memcpy(state, hash, 32); |
|
} |
|
|
|
bool lyra2z330_thread_init() |
|
{ |
|
const int64_t ROW_LEN_INT64 = BLOCK_LEN_INT64 * 256; // nCols |
|
const int64_t ROW_LEN_BYTES = ROW_LEN_INT64 * 8; |
|
int i = (int64_t)ROW_LEN_BYTES * 330; // nRows; |
|
lyra2z330_wholeMatrix = _mm_malloc( i, 64 ); |
|
return lyra2z330_wholeMatrix; |
|
} |
This is the error i get when compiling
Code:
lyra2z330.c: In function ‘lyra2z330_hash’:
lyra2z330.c:16:29: warning: passing argument 2 of ‘LYRA2Z’ makes pointer from integer without a cast [-Wint-conversion]
LYRA2Z((void*)hash, 32, (void*)input, 80, (void*)input, 80, 2, 330, 256);
^
In file included from lyra2z330.c:6:0:
Lyra2.h:53:5: note: expected ‘void *’ but argument is of type ‘int’
int LYRA2Z( uint64_t*, void *K, uint64_t kLen, const void *pwd,
^
lyra2z330.c:16:33: warning: passing argument 3 of ‘LYRA2Z’ makes integer from pointer without a cast [-Wint-conversion]
LYRA2Z((void*)hash, 32, (void*)input, 80, (void*)input, 80, 2, 330, 256);
^
In file included from lyra2z330.c:6:0:
Lyra2.h:53:5: note: expected ‘uint64_t {aka long unsigned int}’ but argument is of type ‘void *’
int LYRA2Z( uint64_t*, void *K, uint64_t kLen, const void *pwd,
^
lyra2z330.c:16:47: warning: passing argument 4 of ‘LYRA2Z’ makes pointer from integer without a cast [-Wint-conversion]
LYRA2Z((void*)hash, 32, (void*)input, 80, (void*)input, 80, 2, 330, 256);
^
In file included from lyra2z330.c:6:0:
Lyra2.h:53:5: note: expected ‘const void *’ but argument is of type ‘int’
int LYRA2Z( uint64_t*, void *K, uint64_t kLen, const void *pwd,
^
lyra2z330.c:16:51: warning: passing argument 5 of ‘LYRA2Z’ makes integer from pointer without a cast [-Wint-conversion]
LYRA2Z((void*)hash, 32, (void*)input, 80, (void*)input, 80, 2, 330, 256);
^
In file included from lyra2z330.c:6:0:
Lyra2.h:53:5: note: expected ‘uint64_t {aka long unsigned int}’ but argument is of type ‘void *’
int LYRA2Z( uint64_t*, void *K, uint64_t kLen, const void *pwd,
^
lyra2z330.c:16:66: warning: passing argument 6 of ‘LYRA2Z’ makes pointer from integer without a cast [-Wint-conversion]
LYRA2Z((void*)hash, 32, (void*)input, 80, (void*)input, 80, 2, 330, 256);
^
In file included from lyra2z330.c:6:0:
Lyra2.h:53:5: note: expected ‘const void *’ but argument is of type ‘int’
int LYRA2Z( uint64_t*, void *K, uint64_t kLen, const void *pwd,
^
lyra2z330.c:16:9: error: too few arguments to function ‘LYRA2Z’
LYRA2Z((void*)hash, 32, (void*)input, 80, (void*)input, 80, 2, 330, 256);
^
In file included from lyra2z330.c:6:0:
Lyra2.h:53:5: note: declared here
int LYRA2Z( uint64_t*, void *K, uint64_t kLen, const void *pwd,
^
makefile:36: recipe for target 'lyra2z330.o' failed
make[1]: *** [lyra2z330.o] Error 1
make[1]: Leaving directory '/home/pool/yiimp/stratum/algos'
Makefile:38: recipe for target 'projectcode1' failed
make: *** [projectcode1] Error 2
cp: cannot stat 'stratum': No such file or directory
and this is my lyra2z.h file, where LYRA2Z is declared
Code:
#ifndef LYRA2_H_ |
|
#define LYRA2_H_ |
|
|
|
#include <stdint.h> |
|
#include "sha3-defs.h" |
|
|
|
//typedef unsigned char byte; |
|
|
|
//Block length required so Blake2's Initialization Vector (IV) is not overwritten (THIS SHOULD NOT BE MODIFIED) |
|
#define BLOCK_LEN_BLAKE2_SAFE_INT64 8 //512 bits (=64 bytes, =8 uint64_t) |
|
#define BLOCK_LEN_BLAKE2_SAFE_BYTES (BLOCK_LEN_BLAKE2_SAFE_INT64 * 8) //same as above, in bytes |
|
|
|
|
|
#ifdef BLOCK_LEN_BITS |
|
#define BLOCK_LEN_INT64 (BLOCK_LEN_BITS/64) //Block length: 768 bits (=96 bytes, =12 uint64_t) |
|
#define BLOCK_LEN_BYTES (BLOCK_LEN_BITS/8) //Block length, in bytes |
|
#else //default block lenght: 768 bits |
|
#define BLOCK_LEN_INT64 12 //Block length: 768 bits (=96 bytes, =12 uint64_t) |
|
#define BLOCK_LEN_BYTES (BLOCK_LEN_INT64 * 8) //Block length, in bytes |
|
#endif |
|
|
|
#define BLOCK_LEN_M256I (BLOCK_LEN_INT64 / 4 ) |
|
#define BLOCK_LEN_M128I (BLOCK_LEN_INT64 / 2 ) |
|
|
|
int LYRA2RE( void *K, uint64_t kLen, const void *pwd, |
|
uint64_t pwdlen, const void *salt, uint64_t saltlen, |
|
uint64_t timeCost, uint64_t nRows, uint64_t nCols ); |
|
|
|
|
|
int LYRA2REV2( uint64_t*, void *K, uint64_t kLen, const void *pwd, |
|
uint64_t pwdlen, const void *salt, uint64_t saltlen, |
|
uint64_t timeCost, uint64_t nRows, uint64_t nCols ); |
|
|
|
int LYRA2Z( uint64_t*, void *K, uint64_t kLen, const void *pwd, |
|
uint64_t pwdlen, const void *salt, uint64_t saltlen, |
|
uint64_t timeCost, uint64_t nRows, uint64_t nCols ); |
|
|
|
|
|
int LYRA2(void *K, int64_t kLen, const void *pwd, int32_t pwdlen, const void *salt, int32_t saltlen, int64_t timeCost, const int16_t nRows, const int16_t nCols); |
|
|
|
#endif /* LYRA2_H_ */ |