Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenCL inline fixes and GOST formats tweaks #5662

Merged
merged 2 commits into from
Feb 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions run/opencl/opencl_gost94.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ INLINE void rhash_gost94_compute_sum_and_hash(gost94_ctx * ctx, const uint* bloc
* @param msg message chunk
* @param size length of the message chunk
*/
NOINLINE void gost94_update(gost94_ctx *ctx, const uchar* msg, uint size, MAYBE_LOCAL const rhash_gost94_sbox *sbox)
static NOINLINE void gost94_update(gost94_ctx *ctx, const uchar* msg, uint size, MAYBE_LOCAL const rhash_gost94_sbox *sbox)
{
uint index = ctx->length & 31;
ctx->length += size;
Expand Down Expand Up @@ -361,7 +361,7 @@ INLINE void rhash_u32_swap_copy(void* to, const void* from, uint length) {
* @param ctx the algorithm context containing current hashing state
* @param result calculated hash in binary form
*/
NOINLINE void gost94_final(gost94_ctx *ctx, uchar *result, MAYBE_LOCAL const rhash_gost94_sbox *sbox)
static NOINLINE void gost94_final(gost94_ctx *ctx, uchar *result, MAYBE_LOCAL const rhash_gost94_sbox *sbox)
{
uint index = ctx->length & 31;
uint* msg32 = (uint*)ctx->message;
Expand Down
2 changes: 2 additions & 0 deletions run/opencl/opencl_misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,15 @@ typedef uint32_t host_size_t;

#define NOINLINE __attribute__((noinline))

#ifndef INLINE
#if __MESA__
#define INLINE
#elif __POCL__
#define INLINE inline
#else
#define INLINE static inline
#endif
#endif

#endif /* _OPENCL_COMPILER */

Expand Down
19 changes: 12 additions & 7 deletions run/opencl/opencl_streebog.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
#define UNROLL16
#endif

#if STREEBOG512CRYPT && !defined STREEBOG512
#define STREEBOG512 1
#endif

#if STREEBOG_VECTOR
#define memcpy512(dst, src) do { \
(dst)->VWORD = (src)->VWORD; \
Expand Down Expand Up @@ -906,7 +910,7 @@ stage3(GOST34112012Context *CTX, __local localbuf *loc_buf)
g0(&(CTX->h), &(CTX->Sigma), loc_buf);
}

NOINLINE void
static NOINLINE void
GOST34112012Update(GOST34112012Context *CTX, const uchar *data, uint len, __local localbuf *loc_buf)
{
if (CTX->bufsize) {
Expand Down Expand Up @@ -937,15 +941,16 @@ GOST34112012Update(GOST34112012Context *CTX, const uchar *data, uint len, __loca
}
}

NOINLINE void
static NOINLINE void
GOST34112012Final(GOST34112012Context *CTX,
#if STREEBOG512CRYPT
uint512_u
void *_digest,
__local localbuf *loc_buf)
{
#if STREEBOG512
uint512_u *digest = _digest;
#else
uint256_u
uint256_u *digest = _digest;
#endif
*digest, __local localbuf *loc_buf)
{
stage3(CTX, loc_buf);

CTX->bufsize = 0;
Expand Down