aboutsummaryrefslogtreecommitdiffstats
path: root/module/icp
diff options
context:
space:
mode:
Diffstat (limited to 'module/icp')
-rw-r--r--module/icp/algs/aes/aes_impl.c11
-rw-r--r--module/icp/algs/modes/gcm.c10
-rw-r--r--module/icp/include/aes/aes_impl.h2
-rw-r--r--module/icp/include/modes/gcm_impl.h4
4 files changed, 17 insertions, 10 deletions
diff --git a/module/icp/algs/aes/aes_impl.c b/module/icp/algs/aes/aes_impl.c
index 457b9e45c..0f11f9999 100644
--- a/module/icp/algs/aes/aes_impl.c
+++ b/module/icp/algs/aes/aes_impl.c
@@ -311,16 +311,21 @@ aes_impl_init(void *arg)
}
aes_supp_impl_cnt = c;
- /* set fastest implementation. assume hardware accelerated is fastest */
+ /*
+ * Set the fastest implementation given the assumption that the
+ * hardware accelerated version is the fastest.
+ */
#if defined(__x86_64)
#if defined(HAVE_AES)
- if (aes_aesni_impl.is_supported())
+ if (aes_aesni_impl.is_supported()) {
memcpy(&aes_fastest_impl, &aes_aesni_impl,
sizeof (aes_fastest_impl));
- else
+ } else
#endif
+ {
memcpy(&aes_fastest_impl, &aes_x86_64_impl,
sizeof (aes_fastest_impl));
+ }
#else
memcpy(&aes_fastest_impl, &aes_generic_impl,
sizeof (aes_fastest_impl));
diff --git a/module/icp/algs/modes/gcm.c b/module/icp/algs/modes/gcm.c
index f6f8434de..423b70e2c 100644
--- a/module/icp/algs/modes/gcm.c
+++ b/module/icp/algs/modes/gcm.c
@@ -647,7 +647,7 @@ const gcm_impl_ops_t *gcm_all_impl[] = {
/* Indicate that benchmark has been completed */
static boolean_t gcm_impl_initialized = B_FALSE;
-/* Select aes implementation */
+/* Select GCM implementation */
#define IMPL_FASTEST (UINT32_MAX)
#define IMPL_CYCLE (UINT32_MAX-1)
@@ -724,13 +724,15 @@ gcm_impl_init(void *arg)
* hardware accelerated version is the fastest.
*/
#if defined(__x86_64) && defined(HAVE_PCLMULQDQ)
- if (gcm_pclmulqdq_impl.is_supported())
+ if (gcm_pclmulqdq_impl.is_supported()) {
memcpy(&gcm_fastest_impl, &gcm_pclmulqdq_impl,
sizeof (gcm_fastest_impl));
- else
+ } else
#endif
+ {
memcpy(&gcm_fastest_impl, &gcm_generic_impl,
sizeof (gcm_fastest_impl));
+ }
strcpy(gcm_fastest_impl.name, "fastest");
@@ -753,7 +755,7 @@ static const struct {
* If we are called before init(), user preference will be saved in
* user_sel_impl, and applied in later init() call. This occurs when module
* parameter is specified on module load. Otherwise, directly update
- * icp_aes_impl.
+ * icp_gcm_impl.
*
* @val Name of gcm implementation to use
* @param Unused.
diff --git a/module/icp/include/aes/aes_impl.h b/module/icp/include/aes/aes_impl.h
index 9fd9c1bd1..329e32a8e 100644
--- a/module/icp/include/aes/aes_impl.h
+++ b/module/icp/include/aes/aes_impl.h
@@ -162,7 +162,7 @@ typedef enum aes_mech_type {
#endif /* _AES_IMPL */
/*
- * Methods used to define aes implementation
+ * Methods used to define AES implementation
*
* @aes_gen_f Key generation
* @aes_enc_f Function encrypts one block
diff --git a/module/icp/include/modes/gcm_impl.h b/module/icp/include/modes/gcm_impl.h
index 138090487..dff372ef8 100644
--- a/module/icp/include/modes/gcm_impl.h
+++ b/module/icp/include/modes/gcm_impl.h
@@ -37,12 +37,12 @@ extern "C" {
#include <sys/crypto/common.h>
/*
- * Methods used to define gcm implementation
+ * Methods used to define GCM implementation
*
* @gcm_mul_f Perform carry-less multiplication
* @gcm_will_work_f Function tests whether implementation will function
*/
-typedef void (*gcm_mul_f)(uint64_t *, uint64_t *, uint64_t *);
+typedef void (*gcm_mul_f)(uint64_t *, uint64_t *, uint64_t *);
typedef boolean_t (*gcm_will_work_f)(void);
#define GCM_IMPL_NAME_MAX (16)