mm, numa: reclaim from all nodes within reclaim distance
[linux-3.10.git] / crypto / tcrypt.c
index 8f147bf..e87fa60 100644 (file)
@@ -97,7 +97,6 @@ static int test_cipher_cycles(struct blkcipher_desc *desc, int enc,
        int ret = 0;
        int i;
 
-       local_bh_disable();
        local_irq_disable();
 
        /* Warm-up run. */
@@ -130,7 +129,6 @@ static int test_cipher_cycles(struct blkcipher_desc *desc, int enc,
 
 out:
        local_irq_enable();
-       local_bh_enable();
 
        if (ret == 0)
                printk("1 operation in %lu cycles (%d bytes)\n",
@@ -300,7 +298,6 @@ static int test_hash_cycles_digest(struct hash_desc *desc,
        int i;
        int ret;
 
-       local_bh_disable();
        local_irq_disable();
 
        /* Warm-up run. */
@@ -327,7 +324,6 @@ static int test_hash_cycles_digest(struct hash_desc *desc,
 
 out:
        local_irq_enable();
-       local_bh_enable();
 
        if (ret)
                return ret;
@@ -348,7 +344,6 @@ static int test_hash_cycles(struct hash_desc *desc, struct scatterlist *sg,
        if (plen == blen)
                return test_hash_cycles_digest(desc, sg, blen, out);
 
-       local_bh_disable();
        local_irq_disable();
 
        /* Warm-up run. */
@@ -391,7 +386,6 @@ static int test_hash_cycles(struct hash_desc *desc, struct scatterlist *sg,
 
 out:
        local_irq_enable();
-       local_bh_enable();
 
        if (ret)
                return ret;
@@ -809,7 +803,7 @@ static void test_acipher_speed(const char *algo, int enc, unsigned int sec,
                               struct cipher_speed_template *template,
                               unsigned int tcount, u8 *keysize)
 {
-       unsigned int ret, i, j, iv_len;
+       unsigned int ret, i, j, k, iv_len;
        struct tcrypt_result tresult;
        const char *key;
        char iv[128];
@@ -883,11 +877,23 @@ static void test_acipher_speed(const char *algo, int enc, unsigned int sec,
                        }
 
                        sg_init_table(sg, TVMEMSIZE);
-                       sg_set_buf(sg, tvmem[0] + *keysize,
+
+                       k = *keysize + *b_size;
+                       if (k > PAGE_SIZE) {
+                               sg_set_buf(sg, tvmem[0] + *keysize,
                                   PAGE_SIZE - *keysize);
-                       for (j = 1; j < TVMEMSIZE; j++) {
-                               sg_set_buf(sg + j, tvmem[j], PAGE_SIZE);
-                               memset(tvmem[j], 0xff, PAGE_SIZE);
+                               k -= PAGE_SIZE;
+                               j = 1;
+                               while (k > PAGE_SIZE) {
+                                       sg_set_buf(sg + j, tvmem[j], PAGE_SIZE);
+                                       memset(tvmem[j], 0xff, PAGE_SIZE);
+                                       j++;
+                                       k -= PAGE_SIZE;
+                               }
+                               sg_set_buf(sg + j, tvmem[j], k);
+                               memset(tvmem[j], 0xff, k);
+                       } else {
+                               sg_set_buf(sg, tvmem[0] + *keysize, *b_size);
                        }
 
                        iv_len = crypto_ablkcipher_ivsize(tfm);
@@ -1025,10 +1031,16 @@ static int do_test(int m)
 
        case 14:
                ret += tcrypt_test("ecb(cast5)");
+               ret += tcrypt_test("cbc(cast5)");
+               ret += tcrypt_test("ctr(cast5)");
                break;
 
        case 15:
                ret += tcrypt_test("ecb(cast6)");
+               ret += tcrypt_test("cbc(cast6)");
+               ret += tcrypt_test("ctr(cast6)");
+               ret += tcrypt_test("lrw(cast6)");
+               ret += tcrypt_test("xts(cast6)");
                break;
 
        case 16:
@@ -1100,6 +1112,9 @@ static int do_test(int m)
        case 32:
                ret += tcrypt_test("ecb(camellia)");
                ret += tcrypt_test("cbc(camellia)");
+               ret += tcrypt_test("ctr(camellia)");
+               ret += tcrypt_test("lrw(camellia)");
+               ret += tcrypt_test("xts(camellia)");
                break;
        case 33:
                ret += tcrypt_test("sha224");
@@ -1153,6 +1168,10 @@ static int do_test(int m)
                ret += tcrypt_test("rfc4309(ccm(aes))");
                break;
 
+       case 46:
+               ret += tcrypt_test("ghash");
+               break;
+
        case 100:
                ret += tcrypt_test("hmac(md5)");
                break;
@@ -1192,6 +1211,9 @@ static int do_test(int m)
        case 109:
                ret += tcrypt_test("vmac(aes)");
                break;
+       case 110:
+               ret += tcrypt_test("hmac(crc32)");
+               break;
 
        case 150:
                ret += tcrypt_test("ansi_cprng");
@@ -1339,6 +1361,49 @@ static int do_test(int m)
                                  speed_template_32_64);
                break;
 
+       case 208:
+               test_cipher_speed("ecb(arc4)", ENCRYPT, sec, NULL, 0,
+                                 speed_template_8);
+               break;
+
+       case 209:
+               test_cipher_speed("ecb(cast5)", ENCRYPT, sec, NULL, 0,
+                                 speed_template_8_16);
+               test_cipher_speed("ecb(cast5)", DECRYPT, sec, NULL, 0,
+                                 speed_template_8_16);
+               test_cipher_speed("cbc(cast5)", ENCRYPT, sec, NULL, 0,
+                                 speed_template_8_16);
+               test_cipher_speed("cbc(cast5)", DECRYPT, sec, NULL, 0,
+                                 speed_template_8_16);
+               test_cipher_speed("ctr(cast5)", ENCRYPT, sec, NULL, 0,
+                                 speed_template_8_16);
+               test_cipher_speed("ctr(cast5)", DECRYPT, sec, NULL, 0,
+                                 speed_template_8_16);
+               break;
+
+       case 210:
+               test_cipher_speed("ecb(cast6)", ENCRYPT, sec, NULL, 0,
+                                 speed_template_16_32);
+               test_cipher_speed("ecb(cast6)", DECRYPT, sec, NULL, 0,
+                                 speed_template_16_32);
+               test_cipher_speed("cbc(cast6)", ENCRYPT, sec, NULL, 0,
+                                 speed_template_16_32);
+               test_cipher_speed("cbc(cast6)", DECRYPT, sec, NULL, 0,
+                                 speed_template_16_32);
+               test_cipher_speed("ctr(cast6)", ENCRYPT, sec, NULL, 0,
+                                 speed_template_16_32);
+               test_cipher_speed("ctr(cast6)", DECRYPT, sec, NULL, 0,
+                                 speed_template_16_32);
+               test_cipher_speed("lrw(cast6)", ENCRYPT, sec, NULL, 0,
+                                 speed_template_32_48);
+               test_cipher_speed("lrw(cast6)", DECRYPT, sec, NULL, 0,
+                                 speed_template_32_48);
+               test_cipher_speed("xts(cast6)", ENCRYPT, sec, NULL, 0,
+                                 speed_template_32_64);
+               test_cipher_speed("xts(cast6)", DECRYPT, sec, NULL, 0,
+                                 speed_template_32_64);
+               break;
+
        case 300:
                /* fall through */
 
@@ -1512,6 +1577,14 @@ static int do_test(int m)
                                   speed_template_16_24_32);
                test_acipher_speed("ctr(aes)", DECRYPT, sec, NULL, 0,
                                   speed_template_16_24_32);
+               test_acipher_speed("cfb(aes)", ENCRYPT, sec, NULL, 0,
+                                  speed_template_16_24_32);
+               test_acipher_speed("cfb(aes)", DECRYPT, sec, NULL, 0,
+                                  speed_template_16_24_32);
+               test_acipher_speed("ofb(aes)", ENCRYPT, sec, NULL, 0,
+                                  speed_template_16_24_32);
+               test_acipher_speed("ofb(aes)", DECRYPT, sec, NULL, 0,
+                                  speed_template_16_24_32);
                break;
 
        case 501:
@@ -1527,6 +1600,18 @@ static int do_test(int m)
                test_acipher_speed("cbc(des3_ede)", DECRYPT, sec,
                                   des3_speed_template, DES3_SPEED_VECTORS,
                                   speed_template_24);
+               test_acipher_speed("cfb(des3_ede)", ENCRYPT, sec,
+                                  des3_speed_template, DES3_SPEED_VECTORS,
+                                  speed_template_24);
+               test_acipher_speed("cfb(des3_ede)", DECRYPT, sec,
+                                  des3_speed_template, DES3_SPEED_VECTORS,
+                                  speed_template_24);
+               test_acipher_speed("ofb(des3_ede)", ENCRYPT, sec,
+                                  des3_speed_template, DES3_SPEED_VECTORS,
+                                  speed_template_24);
+               test_acipher_speed("ofb(des3_ede)", DECRYPT, sec,
+                                  des3_speed_template, DES3_SPEED_VECTORS,
+                                  speed_template_24);
                break;
 
        case 502:
@@ -1538,6 +1623,14 @@ static int do_test(int m)
                                   speed_template_8);
                test_acipher_speed("cbc(des)", DECRYPT, sec, NULL, 0,
                                   speed_template_8);
+               test_acipher_speed("cfb(des)", ENCRYPT, sec, NULL, 0,
+                                  speed_template_8);
+               test_acipher_speed("cfb(des)", DECRYPT, sec, NULL, 0,
+                                  speed_template_8);
+               test_acipher_speed("ofb(des)", ENCRYPT, sec, NULL, 0,
+                                  speed_template_8);
+               test_acipher_speed("ofb(des)", DECRYPT, sec, NULL, 0,
+                                  speed_template_8);
                break;
 
        case 503:
@@ -1563,6 +1656,72 @@ static int do_test(int m)
                                   speed_template_32_64);
                break;
 
+       case 504:
+               test_acipher_speed("ecb(twofish)", ENCRYPT, sec, NULL, 0,
+                                  speed_template_16_24_32);
+               test_acipher_speed("ecb(twofish)", DECRYPT, sec, NULL, 0,
+                                  speed_template_16_24_32);
+               test_acipher_speed("cbc(twofish)", ENCRYPT, sec, NULL, 0,
+                                  speed_template_16_24_32);
+               test_acipher_speed("cbc(twofish)", DECRYPT, sec, NULL, 0,
+                                  speed_template_16_24_32);
+               test_acipher_speed("ctr(twofish)", ENCRYPT, sec, NULL, 0,
+                                  speed_template_16_24_32);
+               test_acipher_speed("ctr(twofish)", DECRYPT, sec, NULL, 0,
+                                  speed_template_16_24_32);
+               test_acipher_speed("lrw(twofish)", ENCRYPT, sec, NULL, 0,
+                                  speed_template_32_40_48);
+               test_acipher_speed("lrw(twofish)", DECRYPT, sec, NULL, 0,
+                                  speed_template_32_40_48);
+               test_acipher_speed("xts(twofish)", ENCRYPT, sec, NULL, 0,
+                                  speed_template_32_48_64);
+               test_acipher_speed("xts(twofish)", DECRYPT, sec, NULL, 0,
+                                  speed_template_32_48_64);
+               break;
+
+       case 505:
+               test_acipher_speed("ecb(arc4)", ENCRYPT, sec, NULL, 0,
+                                  speed_template_8);
+               break;
+
+       case 506:
+               test_acipher_speed("ecb(cast5)", ENCRYPT, sec, NULL, 0,
+                                  speed_template_8_16);
+               test_acipher_speed("ecb(cast5)", DECRYPT, sec, NULL, 0,
+                                  speed_template_8_16);
+               test_acipher_speed("cbc(cast5)", ENCRYPT, sec, NULL, 0,
+                                  speed_template_8_16);
+               test_acipher_speed("cbc(cast5)", DECRYPT, sec, NULL, 0,
+                                  speed_template_8_16);
+               test_acipher_speed("ctr(cast5)", ENCRYPT, sec, NULL, 0,
+                                  speed_template_8_16);
+               test_acipher_speed("ctr(cast5)", DECRYPT, sec, NULL, 0,
+                                  speed_template_8_16);
+               break;
+
+       case 507:
+               test_acipher_speed("ecb(cast6)", ENCRYPT, sec, NULL, 0,
+                                  speed_template_16_32);
+               test_acipher_speed("ecb(cast6)", DECRYPT, sec, NULL, 0,
+                                  speed_template_16_32);
+               test_acipher_speed("cbc(cast6)", ENCRYPT, sec, NULL, 0,
+                                  speed_template_16_32);
+               test_acipher_speed("cbc(cast6)", DECRYPT, sec, NULL, 0,
+                                  speed_template_16_32);
+               test_acipher_speed("ctr(cast6)", ENCRYPT, sec, NULL, 0,
+                                  speed_template_16_32);
+               test_acipher_speed("ctr(cast6)", DECRYPT, sec, NULL, 0,
+                                  speed_template_16_32);
+               test_acipher_speed("lrw(cast6)", ENCRYPT, sec, NULL, 0,
+                                  speed_template_32_48);
+               test_acipher_speed("lrw(cast6)", DECRYPT, sec, NULL, 0,
+                                  speed_template_32_48);
+               test_acipher_speed("xts(cast6)", ENCRYPT, sec, NULL, 0,
+                                  speed_template_32_64);
+               test_acipher_speed("xts(cast6)", DECRYPT, sec, NULL, 0,
+                                  speed_template_32_64);
+               break;
+
        case 1000:
                test_available();
                break;