@@ -72,7 +72,7 @@ namespace blake2s {
72
72
return a;
73
73
}
74
74
75
- __device__ uint32_t cuda_blake2s_ROTR32 (uint32_t a, uint8_t b) { return (a >> b) | (a << (32 - b)); }
75
+ __inline__ __device__ uint32_t cuda_blake2s_ROTR32 (uint32_t a, uint8_t b) { return (a >> b) | (a << (32 - b)); }
76
76
77
77
__device__ void
78
78
cuda_blake2s_G (cuda_blake2s_ctx_t * ctx, uint32_t m1, uint32_t m2, int32_t a, int32_t b, int32_t c, int32_t d)
@@ -221,8 +221,8 @@ namespace blake2s {
221
221
}
222
222
223
223
extern " C" {
224
- void
225
- mcm_cuda_blake2s_hash_batch (BYTE* key, WORD keylen, BYTE* in, WORD inlen, BYTE* out, WORD output_len, WORD n_batch)
224
+ cudaError_t
225
+ cuda_blake2s_hash_batch (BYTE* key, WORD keylen, BYTE* in, WORD inlen, BYTE* out, WORD output_len, WORD n_batch)
226
226
{
227
227
BYTE* cuda_indata;
228
228
BYTE* cuda_outdata;
@@ -231,9 +231,6 @@ namespace blake2s {
231
231
cudaMalloc (&cuda_outdata, BLAKE2S_BLOCK_SIZE * n_batch);
232
232
assert (keylen <= 32 );
233
233
234
- // CUDA_BLAKE2S_CTX ctx;
235
- // cpu_blake2s_init(&ctx, key, keylen, n_outbit);
236
- // cudaMemcpyToSymbol(c_CTX, &ctx, sizeof(CUDA_BLAKE2S_CTX), 0, cudaMemcpyHostToDevice);
237
234
238
235
cudaMemcpy (cuda_indata, in, inlen * n_batch, cudaMemcpyHostToDevice);
239
236
@@ -242,10 +239,12 @@ namespace blake2s {
242
239
kernel_blake2s_hash<<<block, thread>>> (cuda_indata, inlen, cuda_outdata, n_batch, BLAKE2S_BLOCK_SIZE);
243
240
cudaMemcpy (out, cuda_outdata, BLAKE2S_BLOCK_SIZE * n_batch, cudaMemcpyDeviceToHost);
244
241
cudaDeviceSynchronize ();
245
- cudaError_t error = cudaGetLastError ();
246
- if (error != cudaSuccess) { printf (" Error cuda blake2s hash: %s \n " , cudaGetErrorString (error)); }
242
+ // cudaError_t error = cudaGetLastError();
243
+ // if (error != cudaSuccess) { printf("Error cuda blake2s hash: %s \n", cudaGetErrorString(error)); }
247
244
cudaFree (cuda_indata);
248
245
cudaFree (cuda_outdata);
246
+ CHK_IF_RETURN (cudaPeekAtLastError ());
247
+ return CHK_LAST ();
249
248
}
250
249
}
251
250
0 commit comments