]> rtime.felk.cvut.cz Git - zynq/linux.git/blobdiff - arch/x86/crypto/cast5_avx_glue.c
Apply preempt_rt patch-4.9-rt1.patch.xz
[zynq/linux.git] / arch / x86 / crypto / cast5_avx_glue.c
index 8648158f39166f1cf1603fc7f139af629e163bde..d7699130ee36b5306ed42865a0a1aebfcc276f46 100644 (file)
@@ -59,7 +59,7 @@ static inline void cast5_fpu_end(bool fpu_enabled)
 static int ecb_crypt(struct blkcipher_desc *desc, struct blkcipher_walk *walk,
                     bool enc)
 {
-       bool fpu_enabled = false;
+       bool fpu_enabled;
        struct cast5_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
        const unsigned int bsize = CAST5_BLOCK_SIZE;
        unsigned int nbytes;
@@ -75,7 +75,7 @@ static int ecb_crypt(struct blkcipher_desc *desc, struct blkcipher_walk *walk,
                u8 *wsrc = walk->src.virt.addr;
                u8 *wdst = walk->dst.virt.addr;
 
-               fpu_enabled = cast5_fpu_begin(fpu_enabled, nbytes);
+               fpu_enabled = cast5_fpu_begin(false, nbytes);
 
                /* Process multi-block batch */
                if (nbytes >= bsize * CAST5_PARALLEL_BLOCKS) {
@@ -103,10 +103,9 @@ static int ecb_crypt(struct blkcipher_desc *desc, struct blkcipher_walk *walk,
                } while (nbytes >= bsize);
 
 done:
+               cast5_fpu_end(fpu_enabled);
                err = blkcipher_walk_done(desc, walk, nbytes);
        }
-
-       cast5_fpu_end(fpu_enabled);
        return err;
 }
 
@@ -227,7 +226,7 @@ done:
 static int cbc_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
                       struct scatterlist *src, unsigned int nbytes)
 {
-       bool fpu_enabled = false;
+       bool fpu_enabled;
        struct blkcipher_walk walk;
        int err;
 
@@ -236,12 +235,11 @@ static int cbc_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
        desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
 
        while ((nbytes = walk.nbytes)) {
-               fpu_enabled = cast5_fpu_begin(fpu_enabled, nbytes);
+               fpu_enabled = cast5_fpu_begin(false, nbytes);
                nbytes = __cbc_decrypt(desc, &walk);
+               cast5_fpu_end(fpu_enabled);
                err = blkcipher_walk_done(desc, &walk, nbytes);
        }
-
-       cast5_fpu_end(fpu_enabled);
        return err;
 }
 
@@ -311,7 +309,7 @@ done:
 static int ctr_crypt(struct blkcipher_desc *desc, struct scatterlist *dst,
                     struct scatterlist *src, unsigned int nbytes)
 {
-       bool fpu_enabled = false;
+       bool fpu_enabled;
        struct blkcipher_walk walk;
        int err;
 
@@ -320,13 +318,12 @@ static int ctr_crypt(struct blkcipher_desc *desc, struct scatterlist *dst,
        desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
 
        while ((nbytes = walk.nbytes) >= CAST5_BLOCK_SIZE) {
-               fpu_enabled = cast5_fpu_begin(fpu_enabled, nbytes);
+               fpu_enabled = cast5_fpu_begin(false, nbytes);
                nbytes = __ctr_crypt(desc, &walk);
+               cast5_fpu_end(fpu_enabled);
                err = blkcipher_walk_done(desc, &walk, nbytes);
        }
 
-       cast5_fpu_end(fpu_enabled);
-
        if (walk.nbytes) {
                ctr_crypt_final(desc, &walk);
                err = blkcipher_walk_done(desc, &walk, 0);