Skip to content

Commit

Permalink
OpenCL bitlocker, pwsafe and shared twofish: Use shared ror32
Browse files Browse the repository at this point in the history
This currently ends up with "rotate(x, 32U-(n))" on all platforms anyway
so no net change.
  • Loading branch information
magnumripper committed Dec 25, 2024
1 parent df25c0c commit 8e52f7d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion run/opencl/opencl_bitlocker.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
#ifndef _BITCRACKER_H
#define _BITCRACKER_H

#define ROR(x, i) (rotate((x), 32U - (i)))
#include "opencl_rotate.h"
#define ROR(x, i) ror32(x, i)

#define SCHEDULE0() \
schedule0 = schedule16 + schedule25 \
Expand Down
3 changes: 2 additions & 1 deletion run/opencl/opencl_twofish.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#define OPENCL_TWOFISH_H_

#include "opencl_misc.h"
#include "opencl_rotate.h"

typedef uchar Twofish_Byte;
typedef uint Twofish_UInt32;
Expand All @@ -49,7 +50,7 @@ typedef struct {

#define UINT32_MASK ( (((UInt32)2)<<31) - 1 )
#define ROL32( x, n ) rotate((x), (uint)(n))
#define ROR32( x, n ) rotate((x), (32U - (n)))
#define ROR32( x, n ) ror32(x, n)

#if __OS_X__
#define LARGE_Q_TABLE 0
Expand Down
3 changes: 2 additions & 1 deletion run/opencl/pwsafe_kernel.cl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/
#include "opencl_device_info.h"
#include "opencl_misc.h"
#include "opencl_rotate.h"

#if HAVE_LUT3
#define Ch(x, y, z) lut3(x, y, z, 0xca)
Expand All @@ -28,7 +29,7 @@
#endif
#endif

#define ror(x,n) rotate(x, 32U-n)
#define ror(x, n) ror32(x, n)

#define Sigma0(x) ((ror(x, 2)) ^ (ror(x, 13)) ^ (ror(x, 22)))
#define Sigma1(x) ((ror(x, 6)) ^ (ror(x, 11)) ^ (ror(x, 25)))
Expand Down

0 comments on commit 8e52f7d

Please sign in to comment.