diff options
Diffstat (limited to 'sys/contrib/openzfs/module/icp/algs/sha2')
| -rw-r--r-- | sys/contrib/openzfs/module/icp/algs/sha2/sha256_impl.c | 3 | ||||
| -rw-r--r-- | sys/contrib/openzfs/module/icp/algs/sha2/sha2_generic.c | 41 | ||||
| -rw-r--r-- | sys/contrib/openzfs/module/icp/algs/sha2/sha512_impl.c | 3 | 
3 files changed, 30 insertions, 17 deletions
| diff --git a/sys/contrib/openzfs/module/icp/algs/sha2/sha256_impl.c b/sys/contrib/openzfs/module/icp/algs/sha2/sha256_impl.c index 6d3bcca9f995..dcb0a391dda4 100644 --- a/sys/contrib/openzfs/module/icp/algs/sha2/sha256_impl.c +++ b/sys/contrib/openzfs/module/icp/algs/sha2/sha256_impl.c @@ -38,11 +38,14 @@  	kfpu_begin(); E(s, d, b); kfpu_end(); \  } +#if defined(__x86_64) || defined(__aarch64__) || defined(__arm__) || \ +    defined(__PPC64__)  /* some implementation is always okay */  static inline boolean_t sha2_is_supported(void)  {  	return (B_TRUE);  } +#endif  #if defined(__x86_64) diff --git a/sys/contrib/openzfs/module/icp/algs/sha2/sha2_generic.c b/sys/contrib/openzfs/module/icp/algs/sha2/sha2_generic.c index d0fcca798fa9..ad707341eec7 100644 --- a/sys/contrib/openzfs/module/icp/algs/sha2/sha2_generic.c +++ b/sys/contrib/openzfs/module/icp/algs/sha2/sha2_generic.c @@ -77,7 +77,8 @@ static const uint32_t SHA256_K[64] = {  	h = g, g = f, f = e, e = d + T1; \  	d = c, c = b, b = a, a = T1 + T2; -static void sha256_generic(uint32_t state[8], const void *data, size_t num_blks) +static void +icp_sha256_generic(uint32_t state[8], const void *data, size_t num_blks)  {  	uint64_t blk; @@ -173,7 +174,8 @@ static const uint64_t SHA512_K[80] = {  	0x5fcb6fab3ad6faec, 0x6c44198c4a475817  }; -static void sha512_generic(uint64_t state[8], const void *data, size_t num_blks) +static void +icp_sha512_generic(uint64_t state[8], const void *data, size_t num_blks)  {  	uint64_t blk; @@ -226,7 +228,8 @@ static void sha512_generic(uint64_t state[8], const void *data, size_t num_blks)  	}  } -static void sha256_update(sha256_ctx *ctx, const uint8_t *data, size_t len) +static void +icp_sha256_update(sha256_ctx *ctx, const uint8_t *data, size_t len)  {  	uint64_t pos = ctx->count[0];  	uint64_t total = ctx->count[1]; @@ -258,7 +261,8 @@ static void sha256_update(sha256_ctx *ctx, const uint8_t *data, size_t len)  	ctx->count[1] = total;  } -static void sha512_update(sha512_ctx *ctx, const uint8_t *data, size_t len) +static void +icp_sha512_update(sha512_ctx *ctx, const uint8_t *data, size_t len)  {  	uint64_t pos = ctx->count[0];  	uint64_t total = ctx->count[1]; @@ -290,7 +294,8 @@ static void sha512_update(sha512_ctx *ctx, const uint8_t *data, size_t len)  	ctx->count[1] = total;  } -static void sha256_final(sha256_ctx *ctx, uint8_t *result, int bits) +static void +icp_sha256_final(sha256_ctx *ctx, uint8_t *result, int bits)  {  	uint64_t mlen, pos = ctx->count[0];  	uint8_t *m = ctx->wbuf; @@ -334,7 +339,8 @@ static void sha256_final(sha256_ctx *ctx, uint8_t *result, int bits)  	memset(ctx, 0, sizeof (*ctx));  } -static void sha512_final(sha512_ctx *ctx, uint8_t *result, int bits) +static void +icp_sha512_final(sha512_ctx *ctx, uint8_t *result, int bits)  {  	uint64_t mlen, pos = ctx->count[0];  	uint8_t *m = ctx->wbuf, *r; @@ -461,14 +467,14 @@ SHA2Update(SHA2_CTX *ctx, const void *data, size_t len)  	switch (ctx->algotype) {  		case SHA256: -			sha256_update(&ctx->sha256, data, len); +			icp_sha256_update(&ctx->sha256, data, len);  			break;  		case SHA512:  		case SHA512_HMAC_MECH_INFO_TYPE: -			sha512_update(&ctx->sha512, data, len); +			icp_sha512_update(&ctx->sha512, data, len);  			break;  		case SHA512_256: -			sha512_update(&ctx->sha512, data, len); +			icp_sha512_update(&ctx->sha512, data, len);  			break;  	}  } @@ -479,32 +485,33 @@ SHA2Final(void *digest, SHA2_CTX *ctx)  {  	switch (ctx->algotype) {  		case SHA256: -			sha256_final(&ctx->sha256, digest, 256); +			icp_sha256_final(&ctx->sha256, digest, 256);  			break;  		case SHA512:  		case SHA512_HMAC_MECH_INFO_TYPE: -			sha512_final(&ctx->sha512, digest, 512); +			icp_sha512_final(&ctx->sha512, digest, 512);  			break;  		case SHA512_256: -			sha512_final(&ctx->sha512, digest, 256); +			icp_sha512_final(&ctx->sha512, digest, 256);  			break;  	}  }  /* the generic implementation is always okay */ -static boolean_t sha2_is_supported(void) +static boolean_t +icp_sha2_is_supported(void)  {  	return (B_TRUE);  }  const sha256_ops_t sha256_generic_impl = {  	.name = "generic", -	.transform = sha256_generic, -	.is_supported = sha2_is_supported +	.transform = icp_sha256_generic, +	.is_supported = icp_sha2_is_supported  };  const sha512_ops_t sha512_generic_impl = {  	.name = "generic", -	.transform = sha512_generic, -	.is_supported = sha2_is_supported +	.transform = icp_sha512_generic, +	.is_supported = icp_sha2_is_supported  }; diff --git a/sys/contrib/openzfs/module/icp/algs/sha2/sha512_impl.c b/sys/contrib/openzfs/module/icp/algs/sha2/sha512_impl.c index 2efd9fcf4c99..a85a71a83df4 100644 --- a/sys/contrib/openzfs/module/icp/algs/sha2/sha512_impl.c +++ b/sys/contrib/openzfs/module/icp/algs/sha2/sha512_impl.c @@ -38,11 +38,14 @@  	kfpu_begin(); E(s, d, b); kfpu_end(); \  } +#if defined(__x86_64) || defined(__aarch64__) || defined(__arm__) || \ +    defined(__aarch64__) || defined(__arm__) || defined(__PPC64__)  /* some implementation is always okay */  static inline boolean_t sha2_is_supported(void)  {  	return (B_TRUE);  } +#endif  #if defined(__x86_64) | 
