Whamcloud - gitweb
LU-1339 libcfs: add crc32 pclmulqdq implementation
[fs/lustre-release.git] / libcfs / libcfs / linux / linux-crypto.c
index 245fca2..bacf26a 100644 (file)
@@ -339,11 +339,19 @@ static int cfs_crypto_test_hashes(void)
 
 static int crc32, adler32;
 
+#ifdef CONFIG_X86
+static int crc32pclmul;
+#endif
+
 int cfs_crypto_register(void)
 {
        crc32 = cfs_crypto_crc32_register();
        adler32 = cfs_crypto_adler32_register();
 
+#ifdef CONFIG_X86
+       crc32pclmul = cfs_crypto_crc32_pclmul_register();
+#endif
+
        /* check all algorithms and do perfermance test */
        cfs_crypto_test_hashes();
        return 0;
@@ -354,5 +362,11 @@ void cfs_crypto_unregister(void)
                cfs_crypto_crc32_unregister();
        if (adler32 == 0)
                cfs_crypto_adler32_unregister();
+
+#ifdef CONFIG_X86
+       if (crc32pclmul == 0)
+               cfs_crypto_crc32_pclmul_unregister();
+#endif
+
        return;
 }