Skip to content

Commit

Permalink
Avoid macro name collision in sha384/sha512 includes
Browse files Browse the repository at this point in the history
  • Loading branch information
jsteube committed Nov 27, 2022
1 parent a7dbd73 commit db9455b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions OpenCL/inc_hash_sha384.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
#ifndef _INC_HASH_SHA384_H
#define _INC_HASH_SHA384_H

#define SHIFT_RIGHT_64(x,n) ((x) >> (n))
#define SHA384_SHR_64(x,n) ((x) >> (n))

#define SHA384_S0_S(x) (hc_rotr64_S ((x), 28) ^ hc_rotr64_S ((x), 34) ^ hc_rotr64_S ((x), 39))
#define SHA384_S1_S(x) (hc_rotr64_S ((x), 14) ^ hc_rotr64_S ((x), 18) ^ hc_rotr64_S ((x), 41))
#define SHA384_S2_S(x) (hc_rotr64_S ((x), 1) ^ hc_rotr64_S ((x), 8) ^ SHIFT_RIGHT_64 ((x), 7))
#define SHA384_S3_S(x) (hc_rotr64_S ((x), 19) ^ hc_rotr64_S ((x), 61) ^ SHIFT_RIGHT_64 ((x), 6))
#define SHA384_S2_S(x) (hc_rotr64_S ((x), 1) ^ hc_rotr64_S ((x), 8) ^ SHA384_SHR_64 ((x), 7))
#define SHA384_S3_S(x) (hc_rotr64_S ((x), 19) ^ hc_rotr64_S ((x), 61) ^ SHA384_SHR_64 ((x), 6))

#define SHA384_S0(x) (hc_rotr64 ((x), 28) ^ hc_rotr64 ((x), 34) ^ hc_rotr64 ((x), 39))
#define SHA384_S1(x) (hc_rotr64 ((x), 14) ^ hc_rotr64 ((x), 18) ^ hc_rotr64 ((x), 41))
#define SHA384_S2(x) (hc_rotr64 ((x), 1) ^ hc_rotr64 ((x), 8) ^ SHIFT_RIGHT_64 ((x), 7))
#define SHA384_S3(x) (hc_rotr64 ((x), 19) ^ hc_rotr64 ((x), 61) ^ SHIFT_RIGHT_64 ((x), 6))
#define SHA384_S2(x) (hc_rotr64 ((x), 1) ^ hc_rotr64 ((x), 8) ^ SHA384_SHR_64 ((x), 7))
#define SHA384_S3(x) (hc_rotr64 ((x), 19) ^ hc_rotr64 ((x), 61) ^ SHA384_SHR_64 ((x), 6))

#define SHA384_F0(x,y,z) ((z) ^ ((x) & ((y) ^ (z))))
#define SHA384_F1(x,y,z) (((x) & (y)) | ((z) & ((x) ^ (y))))
Expand Down
10 changes: 5 additions & 5 deletions OpenCL/inc_hash_sha512.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
#ifndef _INC_HASH_SHA512_H
#define _INC_HASH_SHA512_H

#define SHIFT_RIGHT_64(x,n) ((x) >> (n))
#define SHA512_SHR_64(x,n) ((x) >> (n))

#define SHA512_S0_S(x) (hc_rotr64_S ((x), 28) ^ hc_rotr64_S ((x), 34) ^ hc_rotr64_S ((x), 39))
#define SHA512_S1_S(x) (hc_rotr64_S ((x), 14) ^ hc_rotr64_S ((x), 18) ^ hc_rotr64_S ((x), 41))
#define SHA512_S2_S(x) (hc_rotr64_S ((x), 1) ^ hc_rotr64_S ((x), 8) ^ SHIFT_RIGHT_64 ((x), 7))
#define SHA512_S3_S(x) (hc_rotr64_S ((x), 19) ^ hc_rotr64_S ((x), 61) ^ SHIFT_RIGHT_64 ((x), 6))
#define SHA512_S2_S(x) (hc_rotr64_S ((x), 1) ^ hc_rotr64_S ((x), 8) ^ SHA512_SHR_64 ((x), 7))
#define SHA512_S3_S(x) (hc_rotr64_S ((x), 19) ^ hc_rotr64_S ((x), 61) ^ SHA512_SHR_64 ((x), 6))

#define SHA512_S0(x) (hc_rotr64 ((x), 28) ^ hc_rotr64 ((x), 34) ^ hc_rotr64 ((x), 39))
#define SHA512_S1(x) (hc_rotr64 ((x), 14) ^ hc_rotr64 ((x), 18) ^ hc_rotr64 ((x), 41))
#define SHA512_S2(x) (hc_rotr64 ((x), 1) ^ hc_rotr64 ((x), 8) ^ SHIFT_RIGHT_64 ((x), 7))
#define SHA512_S3(x) (hc_rotr64 ((x), 19) ^ hc_rotr64 ((x), 61) ^ SHIFT_RIGHT_64 ((x), 6))
#define SHA512_S2(x) (hc_rotr64 ((x), 1) ^ hc_rotr64 ((x), 8) ^ SHA512_SHR_64 ((x), 7))
#define SHA512_S3(x) (hc_rotr64 ((x), 19) ^ hc_rotr64 ((x), 61) ^ SHA512_SHR_64 ((x), 6))

#define SHA512_F0(x,y,z) ((z) ^ ((x) & ((y) ^ (z))))
#define SHA512_F1(x,y,z) (((x) & (y)) | ((z) & ((x) ^ (y))))
Expand Down

0 comments on commit db9455b

Please sign in to comment.