]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - arch/arm/crypto/crct10dif-ce-glue.c
crypto: arm/crct10dif - revert to C code for short inputs
[linux.git] / arch / arm / crypto / crct10dif-ce-glue.c
index d428355cf38d9b848c88e5024d8d4d03badeb754..14c19c70a8416bec170eebef2ee7f3fb1fb6b7ba 100644 (file)
@@ -35,26 +35,15 @@ static int crct10dif_update(struct shash_desc *desc, const u8 *data,
                            unsigned int length)
 {
        u16 *crc = shash_desc_ctx(desc);
-       unsigned int l;
 
-       if (!may_use_simd()) {
-               *crc = crc_t10dif_generic(*crc, data, length);
+       if (length >= CRC_T10DIF_PMULL_CHUNK_SIZE && may_use_simd()) {
+               kernel_neon_begin();
+               *crc = crc_t10dif_pmull(*crc, data, length);
+               kernel_neon_end();
        } else {
-               if (unlikely((u32)data % CRC_T10DIF_PMULL_CHUNK_SIZE)) {
-                       l = min_t(u32, length, CRC_T10DIF_PMULL_CHUNK_SIZE -
-                                 ((u32)data % CRC_T10DIF_PMULL_CHUNK_SIZE));
-
-                       *crc = crc_t10dif_generic(*crc, data, l);
-
-                       length -= l;
-                       data += l;
-               }
-               if (length > 0) {
-                       kernel_neon_begin();
-                       *crc = crc_t10dif_pmull(*crc, data, length);
-                       kernel_neon_end();
-               }
+               *crc = crc_t10dif_generic(*crc, data, length);
        }
+
        return 0;
 }