Skip to content

Commit

Permalink
sha1 - fixes for ppc64le
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Jun 7, 2024
1 parent 636ba24 commit f0882e2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
8 changes: 7 additions & 1 deletion crypto/fipsmodule/sha/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,13 @@ struct keccak_st {
// Define SHA{n}[_{variant}]_ASM if sha{n}_block_data_order[_{variant}] is
// defined in assembly.

#if !defined(OPENSSL_NO_ASM) && (defined(OPENSSL_X86) || defined(OPENSSL_ARM))
#if defined(OPENSSL_PPC64LE)
#define SHA1_ALTIVEC

void sha1_block_data_order(uint32_t *state, const uint8_t *data,
size_t num_blocks);

#elif !defined(OPENSSL_NO_ASM) && (defined(OPENSSL_X86) || defined(OPENSSL_ARM))
#define SHA1_ASM
#define SHA256_ASM
#define SHA512_ASM
Expand Down
4 changes: 2 additions & 2 deletions crypto/fipsmodule/sha/sha1.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ uint8_t *SHA1(const uint8_t *data, size_t len, uint8_t out[SHA_DIGEST_LENGTH]) {
return out;
}

#if !defined(SHA1_ASM)
#if !defined(SHA1_ASM) && !defined(SHA1_ALTIVEC)
static void sha1_block_data_order(uint32_t *state, const uint8_t *data,
size_t num);
#endif
Expand Down Expand Up @@ -196,7 +196,7 @@ int SHA1_Final(uint8_t out[SHA_DIGEST_LENGTH], SHA_CTX *c) {
* <appro@fy.chalmers.se> */
#define X(i) XX##i

#if !defined(SHA1_ASM)
#if !defined(SHA1_ASM) && !defined(SHA1_ALTIVEC)

#if !defined(SHA1_ASM_NOHW)
static void sha1_block_data_order_nohw(uint32_t *state, const uint8_t *data,
Expand Down
3 changes: 1 addition & 2 deletions crypto/fipsmodule/sha/sha_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
#include "../../test/abi_test.h"
#include "internal.h"

#if defined(SUPPORTS_ABI_TEST)

#if defined(SHA1_ASM) && defined(SUPPORTS_ABI_TEST)
TEST(SHATest, SHA1ABI) {
SHA_CTX ctx;
SHA1_Init(&ctx);
Expand Down

0 comments on commit f0882e2

Please sign in to comment.