diff options
author | Tomas Mraz <tomas@openssl.org> | 2021-06-18 17:35:40 +0200 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2021-06-25 09:49:45 +0200 |
commit | 3d178db73b1ac13011e950baae5225837c587df1 (patch) | |
tree | 448200c4eb072c508064fa3da5dfac76a89829c9 /crypto/sha | |
parent | CMP: Improve reporting of error codes and related strings via 'error' msg (diff) | |
download | openssl-3d178db73b1ac13011e950baae5225837c587df1.tar.xz openssl-3d178db73b1ac13011e950baae5225837c587df1.zip |
ppccap.c: Split out algorithm-specific functions
Fixes #13336
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15828)
Diffstat (limited to 'crypto/sha')
-rw-r--r-- | crypto/sha/build.info | 3 | ||||
-rw-r--r-- | crypto/sha/sha_ppc.c | 33 |
2 files changed, 35 insertions, 1 deletions
diff --git a/crypto/sha/build.info b/crypto/sha/build.info index 4f0ad6571e..5d988e7ab5 100644 --- a/crypto/sha/build.info +++ b/crypto/sha/build.info @@ -37,7 +37,8 @@ IF[{- !$disabled{asm} -}] $SHA1DEF_parisc20_64=$SHA1DEF_parisc11 $SHA1ASM_ppc32=\ - sha1-ppc.s sha256-ppc.s sha512-ppc.s sha256p8-ppc.s sha512p8-ppc.s + sha_ppc.c sha1-ppc.s sha256-ppc.s sha512-ppc.s sha256p8-ppc.s \ + sha512p8-ppc.s $SHA1DEF_ppc32=SHA1_ASM SHA256_ASM SHA512_ASM $SHA1ASM_ppc64=$SHA1ASM_ppc32 $SHA1DEF_ppc64=$SHA1DEF_ppc32 diff --git a/crypto/sha/sha_ppc.c b/crypto/sha/sha_ppc.c new file mode 100644 index 0000000000..accf19d8a2 --- /dev/null +++ b/crypto/sha/sha_ppc.c @@ -0,0 +1,33 @@ +/* + * Copyright 2009-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#include <stdlib.h> +#include <string.h> + +#include <openssl/opensslconf.h> +#include <openssl/sha.h> +#include "crypto/ppc_arch.h" + +void sha256_block_p8(void *ctx, const void *inp, size_t len); +void sha256_block_ppc(void *ctx, const void *inp, size_t len); +void sha256_block_data_order(void *ctx, const void *inp, size_t len); +void sha256_block_data_order(void *ctx, const void *inp, size_t len) +{ + OPENSSL_ppccap_P & PPC_CRYPTO207 ? sha256_block_p8(ctx, inp, len) : + sha256_block_ppc(ctx, inp, len); +} + +void sha512_block_p8(void *ctx, const void *inp, size_t len); +void sha512_block_ppc(void *ctx, const void *inp, size_t len); +void sha512_block_data_order(void *ctx, const void *inp, size_t len); +void sha512_block_data_order(void *ctx, const void *inp, size_t len) +{ + OPENSSL_ppccap_P & PPC_CRYPTO207 ? sha512_block_p8(ctx, inp, len) : + sha512_block_ppc(ctx, inp, len); +} |