int Camellia_Ekeygen(int keyBitLength, const u8 *rawKey, KEY_TABLE_TYPE k)
{
    register u32 s0, s1, s2, s3;
    k[0] = s0 = GETU32(rawKey);
    k[1] = s1 = GETU32(rawKey + 4);
    k[2] = s2 = GETU32(rawKey + 8);
    k[3] = s3 = GETU32(rawKey + 12);
    if (keyBitLength != 128) {
        k[8] = s0 = GETU32(rawKey + 16);
        k[9] = s1 = GETU32(rawKey + 20);
        if (keyBitLength == 192) {
            k[10] = s2 = ~s0;
            k[11] = s3 = ~s1;
        } else {
            k[10] = s2 = GETU32(rawKey + 24);
            k[11] = s3 = GETU32(rawKey + 28);
        }
        s0 ^= k[0], s1 ^= k[1], s2 ^= k[2], s3 ^= k[3];
    }
    Camellia_Feistel(s0, s1, s2, s3, SIGMA + 0);
    Camellia_Feistel(s2, s3, s0, s1, SIGMA + 2);
    s0 ^= k[0], s1 ^= k[1], s2 ^= k[2], s3 ^= k[3];
    Camellia_Feistel(s0, s1, s2, s3, SIGMA + 4);
    Camellia_Feistel(s2, s3, s0, s1, SIGMA + 6);
    if (keyBitLength == 128) {
        k[4] = s0, k[5] = s1, k[6] = s2, k[7] = s3;
        RotLeft128(s0, s1, s2, s3, 15);
        k[12] = s0, k[13] = s1, k[14] = s2, k[15] = s3;
        RotLeft128(s0, s1, s2, s3, 15);
        k[16] = s0, k[17] = s1, k[18] = s2, k[19] = s3;
        RotLeft128(s0, s1, s2, s3, 15);
        k[24] = s0, k[25] = s1;
        RotLeft128(s0, s1, s2, s3, 15);
        k[28] = s0, k[29] = s1, k[30] = s2, k[31] = s3;
        RotLeft128(s1, s2, s3, s0, 2);
        k[40] = s1, k[41] = s2, k[42] = s3, k[43] = s0;
        RotLeft128(s1, s2, s3, s0, 17);
        k[48] = s1, k[49] = s2, k[50] = s3, k[51] = s0;
        s0 = k[0], s1 = k[1], s2 = k[2], s3 = k[3];
        RotLeft128(s0, s1, s2, s3, 15);
        k[8] = s0, k[9] = s1, k[10] = s2, k[11] = s3;
        RotLeft128(s0, s1, s2, s3, 30);
        k[20] = s0, k[21] = s1, k[22] = s2, k[23] = s3;
        RotLeft128(s0, s1, s2, s3, 15);
        k[26] = s2, k[27] = s3;
        RotLeft128(s0, s1, s2, s3, 17);
        k[32] = s0, k[33] = s1, k[34] = s2, k[35] = s3;
        RotLeft128(s0, s1, s2, s3, 17);
        k[36] = s0, k[37] = s1, k[38] = s2, k[39] = s3;
        RotLeft128(s0, s1, s2, s3, 17);
        k[44] = s0, k[45] = s1, k[46] = s2, k[47] = s3;
        return 3;
    } else {
        k[12] = s0, k[13] = s1, k[14] = s2, k[15] = s3;
        s0 ^= k[8], s1 ^= k[9], s2 ^= k[10], s3 ^= k[11];
        Camellia_Feistel(s0, s1, s2, s3, (SIGMA + 8));
        Camellia_Feistel(s2, s3, s0, s1, (SIGMA + 10));
        k[4] = s0, k[5] = s1, k[6] = s2, k[7] = s3;
        RotLeft128(s0, s1, s2, s3, 30);
        k[20] = s0, k[21] = s1, k[22] = s2, k[23] = s3;
        RotLeft128(s0, s1, s2, s3, 30);
        k[40] = s0, k[41] = s1, k[42] = s2, k[43] = s3;
        RotLeft128(s1, s2, s3, s0, 19);
        k[64] = s1, k[65] = s2, k[66] = s3, k[67] = s0;
        s0 = k[8], s1 = k[9], s2 = k[10], s3 = k[11];
        RotLeft128(s0, s1, s2, s3, 15);
        k[8] = s0, k[9] = s1, k[10] = s2, k[11] = s3;
        RotLeft128(s0, s1, s2, s3, 15);
        k[16] = s0, k[17] = s1, k[18] = s2, k[19] = s3;
        RotLeft128(s0, s1, s2, s3, 30);
        k[36] = s0, k[37] = s1, k[38] = s2, k[39] = s3;
        RotLeft128(s1, s2, s3, s0, 2);
        k[52] = s1, k[53] = s2, k[54] = s3, k[55] = s0;
        s0 = k[12], s1 = k[13], s2 = k[14], s3 = k[15];
        RotLeft128(s0, s1, s2, s3, 15);
        k[12] = s0, k[13] = s1, k[14] = s2, k[15] = s3;
        RotLeft128(s0, s1, s2, s3, 30);
        k[28] = s0, k[29] = s1, k[30] = s2, k[31] = s3;
        k[48] = s1, k[49] = s2, k[50] = s3, k[51] = s0;
        RotLeft128(s1, s2, s3, s0, 17);
        k[56] = s1, k[57] = s2, k[58] = s3, k[59] = s0;
        s0 = k[0], s1 = k[1], s2 = k[2], s3 = k[3];
        RotLeft128(s1, s2, s3, s0, 13);
        k[24] = s1, k[25] = s2, k[26] = s3, k[27] = s0;
        RotLeft128(s1, s2, s3, s0, 15);
        k[32] = s1, k[33] = s2, k[34] = s3, k[35] = s0;
        RotLeft128(s1, s2, s3, s0, 17);
        k[44] = s1, k[45] = s2, k[46] = s3, k[47] = s0;
        RotLeft128(s2, s3, s0, s1, 2);
        k[60] = s2, k[61] = s3, k[62] = s0, k[63] = s1;
        return 4;
    }
}
['int speed_main(int argc, char **argv)\n{\n    char *prog;\n    const EVP_CIPHER *evp_cipher = NULL;\n    const EVP_MD *evp_md = NULL;\n    double d = 0.0;\n    OPTION_CHOICE o;\n    int decrypt = 0, multiblock = 0, doit[ALGOR_NUM], pr_header = 0;\n    int dsa_doit[DSA_NUM], rsa_doit[RSA_NUM];\n    int ret = 1, i, j, k, misalign = MAX_MISALIGNMENT + 1;\n    long c[ALGOR_NUM][SIZE_NUM], count = 0, save_count = 0;\n    unsigned char *buf_malloc = NULL, *buf2_malloc = NULL;\n    unsigned char *buf = NULL, *buf2 = NULL;\n    unsigned char md[EVP_MAX_MD_SIZE];\n#ifndef NO_FORK\n    int multi = 0;\n#endif\n#if !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_DSA)\n    long rsa_count;\n#endif\n#ifndef OPENSSL_NO_MD2\n    unsigned char md2[MD2_DIGEST_LENGTH];\n#endif\n#ifndef OPENSSL_NO_MDC2\n    unsigned char mdc2[MDC2_DIGEST_LENGTH];\n#endif\n#ifndef OPENSSL_NO_MD4\n    unsigned char md4[MD4_DIGEST_LENGTH];\n#endif\n#ifndef OPENSSL_NO_MD5\n    unsigned char md5[MD5_DIGEST_LENGTH];\n    unsigned char hmac[MD5_DIGEST_LENGTH];\n#endif\n    unsigned char sha[SHA_DIGEST_LENGTH];\n    unsigned char sha256[SHA256_DIGEST_LENGTH];\n    unsigned char sha512[SHA512_DIGEST_LENGTH];\n#ifndef OPENSSL_NO_WHIRLPOOL\n    unsigned char whirlpool[WHIRLPOOL_DIGEST_LENGTH];\n#endif\n#ifndef OPENSSL_NO_RMD160\n    unsigned char rmd160[RIPEMD160_DIGEST_LENGTH];\n#endif\n#ifndef OPENSSL_NO_RC4\n    RC4_KEY rc4_ks;\n#endif\n#ifndef OPENSSL_NO_RC5\n    RC5_32_KEY rc5_ks;\n#endif\n#ifndef OPENSSL_NO_RC2\n    RC2_KEY rc2_ks;\n#endif\n#ifndef OPENSSL_NO_IDEA\n    IDEA_KEY_SCHEDULE idea_ks;\n#endif\n#ifndef OPENSSL_NO_SEED\n    SEED_KEY_SCHEDULE seed_ks;\n#endif\n#ifndef OPENSSL_NO_BF\n    BF_KEY bf_ks;\n#endif\n#ifndef OPENSSL_NO_CAST\n    CAST_KEY cast_ks;\n#endif\n    static const unsigned char key16[16] = {\n        0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,\n        0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12\n    };\n#ifndef OPENSSL_NO_AES\n    static const unsigned char key24[24] = {\n        0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,\n        0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12,\n        0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34\n    };\n    static const unsigned char key32[32] = {\n        0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,\n        0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12,\n        0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34,\n        0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x56\n    };\n#endif\n#ifndef OPENSSL_NO_CAMELLIA\n    static const unsigned char ckey24[24] = {\n        0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,\n        0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12,\n        0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34\n    };\n    static const unsigned char ckey32[32] = {\n        0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,\n        0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12,\n        0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34,\n        0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x56\n    };\n    CAMELLIA_KEY camellia_ks1, camellia_ks2, camellia_ks3;\n#endif\n#ifndef OPENSSL_NO_AES\n# define MAX_BLOCK_SIZE 128\n#else\n# define MAX_BLOCK_SIZE 64\n#endif\n    unsigned char DES_iv[8];\n    unsigned char iv[2 * MAX_BLOCK_SIZE / 8];\n#ifndef OPENSSL_NO_DES\n    static DES_cblock key = {\n        0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0\n    };\n    static DES_cblock key2 = {\n        0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12\n    };\n    static DES_cblock key3 = {\n        0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34\n    };\n    DES_key_schedule sch;\n    DES_key_schedule sch2;\n    DES_key_schedule sch3;\n#endif\n#ifndef OPENSSL_NO_AES\n    AES_KEY aes_ks1, aes_ks2, aes_ks3;\n#endif\n#ifndef OPENSSL_NO_RSA\n    unsigned rsa_num;\n    RSA *rsa_key[RSA_NUM];\n    long rsa_c[RSA_NUM][2];\n    static unsigned int rsa_bits[RSA_NUM] = {\n        512, 1024, 2048, 3072, 4096, 7680, 15360\n    };\n    static unsigned char *rsa_data[RSA_NUM] = {\n        test512, test1024, test2048, test3072, test4096, test7680, test15360\n    };\n    static int rsa_data_length[RSA_NUM] = {\n        sizeof(test512), sizeof(test1024),\n        sizeof(test2048), sizeof(test3072),\n        sizeof(test4096), sizeof(test7680),\n        sizeof(test15360)\n    };\n#endif\n#ifndef OPENSSL_NO_DSA\n    DSA *dsa_key[DSA_NUM];\n    long dsa_c[DSA_NUM][2];\n    static unsigned int dsa_bits[DSA_NUM] = { 512, 1024, 2048 };\n#endif\n#ifndef OPENSSL_NO_EC\n    static unsigned int test_curves[EC_NUM] = {\n        NID_secp160r1, NID_X9_62_prime192v1, NID_secp224r1,\n        NID_X9_62_prime256v1, NID_secp384r1, NID_secp521r1,\n        NID_sect163k1, NID_sect233k1, NID_sect283k1,\n        NID_sect409k1, NID_sect571k1, NID_sect163r2,\n        NID_sect233r1, NID_sect283r1, NID_sect409r1,\n        NID_sect571r1\n    };\n    static const char *test_curves_names[EC_NUM] = {\n        "secp160r1", "nistp192", "nistp224",\n        "nistp256", "nistp384", "nistp521",\n        "nistk163", "nistk233", "nistk283",\n        "nistk409", "nistk571", "nistb163",\n        "nistb233", "nistb283", "nistb409",\n        "nistb571"\n    };\n    static int test_curves_bits[EC_NUM] = {\n        160, 192, 224,\n        256, 384, 521,\n        163, 233, 283,\n        409, 571, 163,\n        233, 283, 409,\n        571\n    };\n#endif\n#ifndef OPENSSL_NO_EC\n    unsigned char ecdsasig[256];\n    unsigned int ecdsasiglen;\n    EC_KEY *ecdsa[EC_NUM];\n    long ecdsa_c[EC_NUM][2];\n    int ecdsa_doit[EC_NUM];\n    EC_KEY *ecdh_a[EC_NUM], *ecdh_b[EC_NUM];\n    unsigned char secret_a[MAX_ECDH_SIZE], secret_b[MAX_ECDH_SIZE];\n    int secret_size_a, secret_size_b;\n    int ecdh_checks = 0;\n    int secret_idx = 0;\n    long ecdh_c[EC_NUM][2];\n    int ecdh_doit[EC_NUM];\n#endif\n    memset(results, 0, sizeof(results));\n#ifndef OPENSSL_NO_DSA\n    memset(dsa_key, 0, sizeof(dsa_key));\n#endif\n#ifndef OPENSSL_NO_EC\n    for (i = 0; i < EC_NUM; i++)\n        ecdsa[i] = NULL;\n    for (i = 0; i < EC_NUM; i++)\n        ecdh_a[i] = ecdh_b[i] = NULL;\n#endif\n#ifndef OPENSSL_NO_RSA\n    memset(rsa_key, 0, sizeof(rsa_key));\n    for (i = 0; i < RSA_NUM; i++)\n        rsa_key[i] = NULL;\n#endif\n    memset(c, 0, sizeof(c));\n    memset(DES_iv, 0, sizeof(DES_iv));\n    memset(iv, 0, sizeof(iv));\n    for (i = 0; i < ALGOR_NUM; i++)\n        doit[i] = 0;\n    for (i = 0; i < RSA_NUM; i++)\n        rsa_doit[i] = 0;\n    for (i = 0; i < DSA_NUM; i++)\n        dsa_doit[i] = 0;\n#ifndef OPENSSL_NO_EC\n    for (i = 0; i < EC_NUM; i++)\n        ecdsa_doit[i] = 0;\n    for (i = 0; i < EC_NUM; i++)\n        ecdh_doit[i] = 0;\n#endif\n    buf = buf_malloc = app_malloc((int)BUFSIZE + misalign, "input buffer");\n    buf2 = buf2_malloc = app_malloc((int)BUFSIZE + misalign, "output buffer");\n    misalign = 0;\n    prog = opt_init(argc, argv, speed_options);\n    while ((o = opt_next()) != OPT_EOF) {\n        switch (o) {\n        case OPT_EOF:\n        case OPT_ERR:\n opterr:\n            BIO_printf(bio_err, "%s: Use -help for summary.\\n", prog);\n            goto end;\n        case OPT_HELP:\n            opt_help(speed_options);\n            ret = 0;\n            goto end;\n        case OPT_ELAPSED:\n            usertime = 0;\n            break;\n        case OPT_EVP:\n            evp_cipher = EVP_get_cipherbyname(opt_arg());\n            if (evp_cipher == NULL)\n                evp_md = EVP_get_digestbyname(opt_arg());\n            if (evp_cipher == NULL && evp_md == NULL) {\n                BIO_printf(bio_err,\n                           "%s: %s  an unknown cipher or digest\\n",\n                           prog, opt_arg());\n                goto end;\n            }\n            doit[D_EVP] = 1;\n            break;\n        case OPT_DECRYPT:\n            decrypt = 1;\n            break;\n        case OPT_ENGINE:\n            (void)setup_engine(opt_arg(), 0);\n            break;\n        case OPT_MULTI:\n#ifndef NO_FORK\n            multi = atoi(opt_arg());\n#endif\n            break;\n        case OPT_MISALIGN:\n            if (!opt_int(opt_arg(), &misalign))\n                goto end;\n            if (misalign > MISALIGN) {\n                BIO_printf(bio_err,\n                           "%s: Maximum offset is %d\\n", prog, MISALIGN);\n                goto opterr;\n            }\n            buf = buf_malloc + misalign;\n            buf2 = buf2_malloc + misalign;\n            break;\n        case OPT_MR:\n            mr = 1;\n            break;\n        case OPT_MB:\n            multiblock = 1;\n            break;\n        }\n    }\n    argc = opt_num_rest();\n    argv = opt_rest();\n    for ( ; *argv; argv++) {\n        if (found(*argv, doit_choices, &i)) {\n            doit[i] = 1;\n            continue;\n        }\n#ifndef OPENSSL_NO_DES\n        if (strcmp(*argv, "des") == 0) {\n            doit[D_CBC_DES] = doit[D_EDE3_DES] = 1;\n            continue;\n        }\n#endif\n        if (strcmp(*argv, "sha") == 0) {\n            doit[D_SHA1] = doit[D_SHA256] = doit[D_SHA512] = 1;\n            continue;\n        }\n#ifndef OPENSSL_NO_RSA\n# ifndef RSA_NULL\n        if (strcmp(*argv, "openssl") == 0) {\n            RSA_set_default_method(RSA_PKCS1_SSLeay());\n            continue;\n        }\n# endif\n        if (strcmp(*argv, "rsa") == 0) {\n            rsa_doit[R_RSA_512] = rsa_doit[R_RSA_1024] =\n                rsa_doit[R_RSA_2048] = rsa_doit[R_RSA_3072] =\n                rsa_doit[R_RSA_4096] = rsa_doit[R_RSA_7680] =\n                rsa_doit[R_RSA_15360] = 1;\n            continue;\n        }\n        if (found(*argv, rsa_choices, &i)) {\n            rsa_doit[i] = 1;\n            continue;\n        }\n#endif\n#ifndef OPENSSL_NO_DSA\n        if (strcmp(*argv, "dsa") == 0) {\n            dsa_doit[R_DSA_512] = dsa_doit[R_DSA_1024] =\n                dsa_doit[R_DSA_2048] = 1;\n            continue;\n        }\n        if (found(*argv, dsa_choices, &i)) {\n            dsa_doit[i] = 2;\n            continue;\n        }\n#endif\n#ifndef OPENSSL_NO_AES\n        if (strcmp(*argv, "aes") == 0) {\n            doit[D_CBC_128_AES] = doit[D_CBC_192_AES] =\n                doit[D_CBC_256_AES] = 1;\n            continue;\n        }\n#endif\n#ifndef OPENSSL_NO_CAMELLIA\n        if (strcmp(*argv, "camellia") == 0) {\n            doit[D_CBC_128_CML] = doit[D_CBC_192_CML] =\n                doit[D_CBC_256_CML] = 1;\n            continue;\n        }\n#endif\n#ifndef OPENSSL_NO_EC\n        if (strcmp(*argv, "ecdsa") == 0) {\n            for (i = 0; i < EC_NUM; i++)\n                ecdsa_doit[i] = 1;\n            continue;\n        }\n        if (found(*argv, ecdsa_choices, &i)) {\n            ecdsa_doit[i] = 2;\n            continue;\n        }\n        if (strcmp(*argv, "ecdh") == 0) {\n            for (i = 0; i < EC_NUM; i++)\n                ecdh_doit[i] = 1;\n            continue;\n        }\n        if (found(*argv, ecdh_choices, &i)) {\n            ecdh_doit[i] = 2;\n            continue;\n        }\n#endif\n        BIO_printf(bio_err, "%s: Unknown algorithm %s\\n", prog, *argv);\n        goto end;\n    }\n#ifndef NO_FORK\n    if (multi && do_multi(multi))\n        goto show_res;\n#endif\n    if ((argc == 0) && !doit[D_EVP]) {\n        for (i = 0; i < ALGOR_NUM; i++)\n            if (i != D_EVP)\n                doit[i] = 1;\n        for (i = 0; i < RSA_NUM; i++)\n            rsa_doit[i] = 1;\n        for (i = 0; i < DSA_NUM; i++)\n            dsa_doit[i] = 1;\n#ifndef OPENSSL_NO_EC\n        for (i = 0; i < EC_NUM; i++)\n            ecdsa_doit[i] = 1;\n        for (i = 0; i < EC_NUM; i++)\n            ecdh_doit[i] = 1;\n#endif\n    }\n    for (i = 0; i < ALGOR_NUM; i++)\n        if (doit[i])\n            pr_header++;\n    if (usertime == 0 && !mr)\n        BIO_printf(bio_err,\n                   "You have chosen to measure elapsed time "\n                   "instead of user CPU time.\\n");\n#ifndef OPENSSL_NO_RSA\n    for (i = 0; i < RSA_NUM; i++) {\n        const unsigned char *p;\n        p = rsa_data[i];\n        rsa_key[i] = d2i_RSAPrivateKey(NULL, &p, rsa_data_length[i]);\n        if (rsa_key[i] == NULL) {\n            BIO_printf(bio_err, "internal error loading RSA key number %d\\n",\n                       i);\n            goto end;\n        }\n    }\n#endif\n#ifndef OPENSSL_NO_DSA\n    dsa_key[0] = get_dsa512();\n    dsa_key[1] = get_dsa1024();\n    dsa_key[2] = get_dsa2048();\n#endif\n#ifndef OPENSSL_NO_DES\n    DES_set_key_unchecked(&key, &sch);\n    DES_set_key_unchecked(&key2, &sch2);\n    DES_set_key_unchecked(&key3, &sch3);\n#endif\n#ifndef OPENSSL_NO_AES\n    AES_set_encrypt_key(key16, 128, &aes_ks1);\n    AES_set_encrypt_key(key24, 192, &aes_ks2);\n    AES_set_encrypt_key(key32, 256, &aes_ks3);\n#endif\n#ifndef OPENSSL_NO_CAMELLIA\n    Camellia_set_key(key16, 128, &camellia_ks1);\n    Camellia_set_key(ckey24, 192, &camellia_ks2);\n    Camellia_set_key(ckey32, 256, &camellia_ks3);\n#endif\n#ifndef OPENSSL_NO_IDEA\n    idea_set_encrypt_key(key16, &idea_ks);\n#endif\n#ifndef OPENSSL_NO_SEED\n    SEED_set_key(key16, &seed_ks);\n#endif\n#ifndef OPENSSL_NO_RC4\n    RC4_set_key(&rc4_ks, 16, key16);\n#endif\n#ifndef OPENSSL_NO_RC2\n    RC2_set_key(&rc2_ks, 16, key16, 128);\n#endif\n#ifndef OPENSSL_NO_RC5\n    RC5_32_set_key(&rc5_ks, 16, key16, 12);\n#endif\n#ifndef OPENSSL_NO_BF\n    BF_set_key(&bf_ks, 16, key16);\n#endif\n#ifndef OPENSSL_NO_CAST\n    CAST_set_key(&cast_ks, 16, key16);\n#endif\n#ifndef OPENSSL_NO_RSA\n    memset(rsa_c, 0, sizeof(rsa_c));\n#endif\n#ifndef SIGALRM\n# ifndef OPENSSL_NO_DES\n    BIO_printf(bio_err, "First we calculate the approximate speed ...\\n");\n    count = 10;\n    do {\n        long it;\n        count *= 2;\n        Time_F(START);\n        for (it = count; it; it--)\n            DES_ecb_encrypt((DES_cblock *)buf,\n                            (DES_cblock *)buf, &sch, DES_ENCRYPT);\n        d = Time_F(STOP);\n    } while (d < 3);\n    save_count = count;\n    c[D_MD2][0] = count / 10;\n    c[D_MDC2][0] = count / 10;\n    c[D_MD4][0] = count;\n    c[D_MD5][0] = count;\n    c[D_HMAC][0] = count;\n    c[D_SHA1][0] = count;\n    c[D_RMD160][0] = count;\n    c[D_RC4][0] = count * 5;\n    c[D_CBC_DES][0] = count;\n    c[D_EDE3_DES][0] = count / 3;\n    c[D_CBC_IDEA][0] = count;\n    c[D_CBC_SEED][0] = count;\n    c[D_CBC_RC2][0] = count;\n    c[D_CBC_RC5][0] = count;\n    c[D_CBC_BF][0] = count;\n    c[D_CBC_CAST][0] = count;\n    c[D_CBC_128_AES][0] = count;\n    c[D_CBC_192_AES][0] = count;\n    c[D_CBC_256_AES][0] = count;\n    c[D_CBC_128_CML][0] = count;\n    c[D_CBC_192_CML][0] = count;\n    c[D_CBC_256_CML][0] = count;\n    c[D_SHA256][0] = count;\n    c[D_SHA512][0] = count;\n    c[D_WHIRLPOOL][0] = count;\n    c[D_IGE_128_AES][0] = count;\n    c[D_IGE_192_AES][0] = count;\n    c[D_IGE_256_AES][0] = count;\n    c[D_GHASH][0] = count;\n    for (i = 1; i < SIZE_NUM; i++) {\n        long l0, l1;\n        l0 = (long)lengths[0];\n        l1 = (long)lengths[i];\n        c[D_MD2][i] = c[D_MD2][0] * 4 * l0 / l1;\n        c[D_MDC2][i] = c[D_MDC2][0] * 4 * l0 / l1;\n        c[D_MD4][i] = c[D_MD4][0] * 4 * l0 / l1;\n        c[D_MD5][i] = c[D_MD5][0] * 4 * l0 / l1;\n        c[D_HMAC][i] = c[D_HMAC][0] * 4 * l0 / l1;\n        c[D_SHA1][i] = c[D_SHA1][0] * 4 * l0 / l1;\n        c[D_RMD160][i] = c[D_RMD160][0] * 4 * l0 / l1;\n        c[D_SHA256][i] = c[D_SHA256][0] * 4 * l0 / l1;\n        c[D_SHA512][i] = c[D_SHA512][0] * 4 * l0 / l1;\n        c[D_WHIRLPOOL][i] = c[D_WHIRLPOOL][0] * 4 * l0 / l1;\n        l0 = (long)lengths[i - 1];\n        c[D_RC4][i] = c[D_RC4][i - 1] * l0 / l1;\n        c[D_CBC_DES][i] = c[D_CBC_DES][i - 1] * l0 / l1;\n        c[D_EDE3_DES][i] = c[D_EDE3_DES][i - 1] * l0 / l1;\n        c[D_CBC_IDEA][i] = c[D_CBC_IDEA][i - 1] * l0 / l1;\n        c[D_CBC_SEED][i] = c[D_CBC_SEED][i - 1] * l0 / l1;\n        c[D_CBC_RC2][i] = c[D_CBC_RC2][i - 1] * l0 / l1;\n        c[D_CBC_RC5][i] = c[D_CBC_RC5][i - 1] * l0 / l1;\n        c[D_CBC_BF][i] = c[D_CBC_BF][i - 1] * l0 / l1;\n        c[D_CBC_CAST][i] = c[D_CBC_CAST][i - 1] * l0 / l1;\n        c[D_CBC_128_AES][i] = c[D_CBC_128_AES][i - 1] * l0 / l1;\n        c[D_CBC_192_AES][i] = c[D_CBC_192_AES][i - 1] * l0 / l1;\n        c[D_CBC_256_AES][i] = c[D_CBC_256_AES][i - 1] * l0 / l1;\n        c[D_CBC_128_CML][i] = c[D_CBC_128_CML][i - 1] * l0 / l1;\n        c[D_CBC_192_CML][i] = c[D_CBC_192_CML][i - 1] * l0 / l1;\n        c[D_CBC_256_CML][i] = c[D_CBC_256_CML][i - 1] * l0 / l1;\n        c[D_IGE_128_AES][i] = c[D_IGE_128_AES][i - 1] * l0 / l1;\n        c[D_IGE_192_AES][i] = c[D_IGE_192_AES][i - 1] * l0 / l1;\n        c[D_IGE_256_AES][i] = c[D_IGE_256_AES][i - 1] * l0 / l1;\n    }\n#  ifndef OPENSSL_NO_RSA\n    rsa_c[R_RSA_512][0] = count / 2000;\n    rsa_c[R_RSA_512][1] = count / 400;\n    for (i = 1; i < RSA_NUM; i++) {\n        rsa_c[i][0] = rsa_c[i - 1][0] / 8;\n        rsa_c[i][1] = rsa_c[i - 1][1] / 4;\n        if ((rsa_doit[i] <= 1) && (rsa_c[i][0] == 0))\n            rsa_doit[i] = 0;\n        else {\n            if (rsa_c[i][0] == 0) {\n                rsa_c[i][0] = 1;\n                rsa_c[i][1] = 20;\n            }\n        }\n    }\n#  endif\n#  ifndef OPENSSL_NO_DSA\n    dsa_c[R_DSA_512][0] = count / 1000;\n    dsa_c[R_DSA_512][1] = count / 1000 / 2;\n    for (i = 1; i < DSA_NUM; i++) {\n        dsa_c[i][0] = dsa_c[i - 1][0] / 4;\n        dsa_c[i][1] = dsa_c[i - 1][1] / 4;\n        if ((dsa_doit[i] <= 1) && (dsa_c[i][0] == 0))\n            dsa_doit[i] = 0;\n        else {\n            if (dsa_c[i] == 0) {\n                dsa_c[i][0] = 1;\n                dsa_c[i][1] = 1;\n            }\n        }\n    }\n#  endif\n#  ifndef OPENSSL_NO_EC\n    ecdsa_c[R_EC_P160][0] = count / 1000;\n    ecdsa_c[R_EC_P160][1] = count / 1000 / 2;\n    for (i = R_EC_P192; i <= R_EC_P521; i++) {\n        ecdsa_c[i][0] = ecdsa_c[i - 1][0] / 2;\n        ecdsa_c[i][1] = ecdsa_c[i - 1][1] / 2;\n        if ((ecdsa_doit[i] <= 1) && (ecdsa_c[i][0] == 0))\n            ecdsa_doit[i] = 0;\n        else {\n            if (ecdsa_c[i] == 0) {\n                ecdsa_c[i][0] = 1;\n                ecdsa_c[i][1] = 1;\n            }\n        }\n    }\n    ecdsa_c[R_EC_K163][0] = count / 1000;\n    ecdsa_c[R_EC_K163][1] = count / 1000 / 2;\n    for (i = R_EC_K233; i <= R_EC_K571; i++) {\n        ecdsa_c[i][0] = ecdsa_c[i - 1][0] / 2;\n        ecdsa_c[i][1] = ecdsa_c[i - 1][1] / 2;\n        if ((ecdsa_doit[i] <= 1) && (ecdsa_c[i][0] == 0))\n            ecdsa_doit[i] = 0;\n        else {\n            if (ecdsa_c[i] == 0) {\n                ecdsa_c[i][0] = 1;\n                ecdsa_c[i][1] = 1;\n            }\n        }\n    }\n    ecdsa_c[R_EC_B163][0] = count / 1000;\n    ecdsa_c[R_EC_B163][1] = count / 1000 / 2;\n    for (i = R_EC_B233; i <= R_EC_B571; i++) {\n        ecdsa_c[i][0] = ecdsa_c[i - 1][0] / 2;\n        ecdsa_c[i][1] = ecdsa_c[i - 1][1] / 2;\n        if ((ecdsa_doit[i] <= 1) && (ecdsa_c[i][0] == 0))\n            ecdsa_doit[i] = 0;\n        else {\n            if (ecdsa_c[i] == 0) {\n                ecdsa_c[i][0] = 1;\n                ecdsa_c[i][1] = 1;\n            }\n        }\n    }\n    ecdh_c[R_EC_P160][0] = count / 1000;\n    ecdh_c[R_EC_P160][1] = count / 1000;\n    for (i = R_EC_P192; i <= R_EC_P521; i++) {\n        ecdh_c[i][0] = ecdh_c[i - 1][0] / 2;\n        ecdh_c[i][1] = ecdh_c[i - 1][1] / 2;\n        if ((ecdh_doit[i] <= 1) && (ecdh_c[i][0] == 0))\n            ecdh_doit[i] = 0;\n        else {\n            if (ecdh_c[i] == 0) {\n                ecdh_c[i][0] = 1;\n                ecdh_c[i][1] = 1;\n            }\n        }\n    }\n    ecdh_c[R_EC_K163][0] = count / 1000;\n    ecdh_c[R_EC_K163][1] = count / 1000;\n    for (i = R_EC_K233; i <= R_EC_K571; i++) {\n        ecdh_c[i][0] = ecdh_c[i - 1][0] / 2;\n        ecdh_c[i][1] = ecdh_c[i - 1][1] / 2;\n        if ((ecdh_doit[i] <= 1) && (ecdh_c[i][0] == 0))\n            ecdh_doit[i] = 0;\n        else {\n            if (ecdh_c[i] == 0) {\n                ecdh_c[i][0] = 1;\n                ecdh_c[i][1] = 1;\n            }\n        }\n    }\n    ecdh_c[R_EC_B163][0] = count / 1000;\n    ecdh_c[R_EC_B163][1] = count / 1000;\n    for (i = R_EC_B233; i <= R_EC_B571; i++) {\n        ecdh_c[i][0] = ecdh_c[i - 1][0] / 2;\n        ecdh_c[i][1] = ecdh_c[i - 1][1] / 2;\n        if ((ecdh_doit[i] <= 1) && (ecdh_c[i][0] == 0))\n            ecdh_doit[i] = 0;\n        else {\n            if (ecdh_c[i] == 0) {\n                ecdh_c[i][0] = 1;\n                ecdh_c[i][1] = 1;\n            }\n        }\n    }\n#  endif\n#  define COND(d) (count < (d))\n#  define COUNT(d) (d)\n# else\n#  error "You cannot disable DES on systems without SIGALRM."\n# endif\n#else\n# define COND(c) (run && count<0x7fffffff)\n# define COUNT(d) (count)\n# ifndef _WIN32\n    signal(SIGALRM, sig_done);\n# endif\n#endif\n#ifndef OPENSSL_NO_MD2\n    if (doit[D_MD2]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_MD2], c[D_MD2][j], lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_MD2][j]); count++)\n                EVP_Digest(buf, (unsigned long)lengths[j], &(md2[0]), NULL,\n                           EVP_md2(), NULL);\n            d = Time_F(STOP);\n            print_result(D_MD2, j, count, d);\n        }\n    }\n#endif\n#ifndef OPENSSL_NO_MDC2\n    if (doit[D_MDC2]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_MDC2], c[D_MDC2][j], lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_MDC2][j]); count++)\n                EVP_Digest(buf, (unsigned long)lengths[j], &(mdc2[0]), NULL,\n                           EVP_mdc2(), NULL);\n            d = Time_F(STOP);\n            print_result(D_MDC2, j, count, d);\n        }\n    }\n#endif\n#ifndef OPENSSL_NO_MD4\n    if (doit[D_MD4]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_MD4], c[D_MD4][j], lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_MD4][j]); count++)\n                EVP_Digest(&(buf[0]), (unsigned long)lengths[j], &(md4[0]),\n                           NULL, EVP_md4(), NULL);\n            d = Time_F(STOP);\n            print_result(D_MD4, j, count, d);\n        }\n    }\n#endif\n#ifndef OPENSSL_NO_MD5\n    if (doit[D_MD5]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_MD5], c[D_MD5][j], lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_MD5][j]); count++)\n                MD5(buf, lengths[j], md5);\n            d = Time_F(STOP);\n            print_result(D_MD5, j, count, d);\n        }\n    }\n#endif\n#if !defined(OPENSSL_NO_MD5)\n    if (doit[D_HMAC]) {\n        HMAC_CTX hctx;\n        HMAC_CTX_init(&hctx);\n        HMAC_Init_ex(&hctx, (unsigned char *)"This is a key...",\n                     16, EVP_md5(), NULL);\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_HMAC], c[D_HMAC][j], lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_HMAC][j]); count++) {\n                HMAC_Init_ex(&hctx, NULL, 0, NULL, NULL);\n                HMAC_Update(&hctx, buf, lengths[j]);\n                HMAC_Final(&hctx, &(hmac[0]), NULL);\n            }\n            d = Time_F(STOP);\n            print_result(D_HMAC, j, count, d);\n        }\n        HMAC_CTX_cleanup(&hctx);\n    }\n#endif\n    if (doit[D_SHA1]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_SHA1], c[D_SHA1][j], lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_SHA1][j]); count++)\n                SHA1(buf, lengths[j], sha);\n            d = Time_F(STOP);\n            print_result(D_SHA1, j, count, d);\n        }\n    }\n    if (doit[D_SHA256]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_SHA256], c[D_SHA256][j], lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_SHA256][j]); count++)\n                SHA256(buf, lengths[j], sha256);\n            d = Time_F(STOP);\n            print_result(D_SHA256, j, count, d);\n        }\n    }\n    if (doit[D_SHA512]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_SHA512], c[D_SHA512][j], lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_SHA512][j]); count++)\n                SHA512(buf, lengths[j], sha512);\n            d = Time_F(STOP);\n            print_result(D_SHA512, j, count, d);\n        }\n    }\n#ifndef OPENSSL_NO_WHIRLPOOL\n    if (doit[D_WHIRLPOOL]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_WHIRLPOOL], c[D_WHIRLPOOL][j], lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_WHIRLPOOL][j]); count++)\n                WHIRLPOOL(buf, lengths[j], whirlpool);\n            d = Time_F(STOP);\n            print_result(D_WHIRLPOOL, j, count, d);\n        }\n    }\n#endif\n#ifndef OPENSSL_NO_RMD160\n    if (doit[D_RMD160]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_RMD160], c[D_RMD160][j], lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_RMD160][j]); count++)\n                EVP_Digest(buf, (unsigned long)lengths[j], &(rmd160[0]), NULL,\n                           EVP_ripemd160(), NULL);\n            d = Time_F(STOP);\n            print_result(D_RMD160, j, count, d);\n        }\n    }\n#endif\n#ifndef OPENSSL_NO_RC4\n    if (doit[D_RC4]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_RC4], c[D_RC4][j], lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_RC4][j]); count++)\n                RC4(&rc4_ks, (unsigned int)lengths[j], buf, buf);\n            d = Time_F(STOP);\n            print_result(D_RC4, j, count, d);\n        }\n    }\n#endif\n#ifndef OPENSSL_NO_DES\n    if (doit[D_CBC_DES]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_CBC_DES], c[D_CBC_DES][j], lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_CBC_DES][j]); count++)\n                DES_ncbc_encrypt(buf, buf, lengths[j], &sch,\n                                 &DES_iv, DES_ENCRYPT);\n            d = Time_F(STOP);\n            print_result(D_CBC_DES, j, count, d);\n        }\n    }\n    if (doit[D_EDE3_DES]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_EDE3_DES], c[D_EDE3_DES][j], lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_EDE3_DES][j]); count++)\n                DES_ede3_cbc_encrypt(buf, buf, lengths[j],\n                                     &sch, &sch2, &sch3,\n                                     &DES_iv, DES_ENCRYPT);\n            d = Time_F(STOP);\n            print_result(D_EDE3_DES, j, count, d);\n        }\n    }\n#endif\n#ifndef OPENSSL_NO_AES\n    if (doit[D_CBC_128_AES]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_CBC_128_AES], c[D_CBC_128_AES][j],\n                          lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_CBC_128_AES][j]); count++)\n                AES_cbc_encrypt(buf, buf,\n                                (unsigned long)lengths[j], &aes_ks1,\n                                iv, AES_ENCRYPT);\n            d = Time_F(STOP);\n            print_result(D_CBC_128_AES, j, count, d);\n        }\n    }\n    if (doit[D_CBC_192_AES]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_CBC_192_AES], c[D_CBC_192_AES][j],\n                          lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_CBC_192_AES][j]); count++)\n                AES_cbc_encrypt(buf, buf,\n                                (unsigned long)lengths[j], &aes_ks2,\n                                iv, AES_ENCRYPT);\n            d = Time_F(STOP);\n            print_result(D_CBC_192_AES, j, count, d);\n        }\n    }\n    if (doit[D_CBC_256_AES]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_CBC_256_AES], c[D_CBC_256_AES][j],\n                          lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_CBC_256_AES][j]); count++)\n                AES_cbc_encrypt(buf, buf,\n                                (unsigned long)lengths[j], &aes_ks3,\n                                iv, AES_ENCRYPT);\n            d = Time_F(STOP);\n            print_result(D_CBC_256_AES, j, count, d);\n        }\n    }\n    if (doit[D_IGE_128_AES]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_IGE_128_AES], c[D_IGE_128_AES][j],\n                          lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_IGE_128_AES][j]); count++)\n                AES_ige_encrypt(buf, buf2,\n                                (unsigned long)lengths[j], &aes_ks1,\n                                iv, AES_ENCRYPT);\n            d = Time_F(STOP);\n            print_result(D_IGE_128_AES, j, count, d);\n        }\n    }\n    if (doit[D_IGE_192_AES]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_IGE_192_AES], c[D_IGE_192_AES][j],\n                          lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_IGE_192_AES][j]); count++)\n                AES_ige_encrypt(buf, buf2,\n                                (unsigned long)lengths[j], &aes_ks2,\n                                iv, AES_ENCRYPT);\n            d = Time_F(STOP);\n            print_result(D_IGE_192_AES, j, count, d);\n        }\n    }\n    if (doit[D_IGE_256_AES]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_IGE_256_AES], c[D_IGE_256_AES][j],\n                          lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_IGE_256_AES][j]); count++)\n                AES_ige_encrypt(buf, buf2,\n                                (unsigned long)lengths[j], &aes_ks3,\n                                iv, AES_ENCRYPT);\n            d = Time_F(STOP);\n            print_result(D_IGE_256_AES, j, count, d);\n        }\n    }\n    if (doit[D_GHASH]) {\n        GCM128_CONTEXT *ctx =\n            CRYPTO_gcm128_new(&aes_ks1, (block128_f) AES_encrypt);\n        CRYPTO_gcm128_setiv(ctx, (unsigned char *)"0123456789ab", 12);\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_GHASH], c[D_GHASH][j], lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_GHASH][j]); count++)\n                CRYPTO_gcm128_aad(ctx, buf, lengths[j]);\n            d = Time_F(STOP);\n            print_result(D_GHASH, j, count, d);\n        }\n        CRYPTO_gcm128_release(ctx);\n    }\n#endif\n#ifndef OPENSSL_NO_CAMELLIA\n    if (doit[D_CBC_128_CML]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_CBC_128_CML], c[D_CBC_128_CML][j],\n                          lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_CBC_128_CML][j]); count++)\n                Camellia_cbc_encrypt(buf, buf,\n                                     (unsigned long)lengths[j], &camellia_ks1,\n                                     iv, CAMELLIA_ENCRYPT);\n            d = Time_F(STOP);\n            print_result(D_CBC_128_CML, j, count, d);\n        }\n    }\n    if (doit[D_CBC_192_CML]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_CBC_192_CML], c[D_CBC_192_CML][j],\n                          lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_CBC_192_CML][j]); count++)\n                Camellia_cbc_encrypt(buf, buf,\n                                     (unsigned long)lengths[j], &camellia_ks2,\n                                     iv, CAMELLIA_ENCRYPT);\n            d = Time_F(STOP);\n            print_result(D_CBC_192_CML, j, count, d);\n        }\n    }\n    if (doit[D_CBC_256_CML]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_CBC_256_CML], c[D_CBC_256_CML][j],\n                          lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_CBC_256_CML][j]); count++)\n                Camellia_cbc_encrypt(buf, buf,\n                                     (unsigned long)lengths[j], &camellia_ks3,\n                                     iv, CAMELLIA_ENCRYPT);\n            d = Time_F(STOP);\n            print_result(D_CBC_256_CML, j, count, d);\n        }\n    }\n#endif\n#ifndef OPENSSL_NO_IDEA\n    if (doit[D_CBC_IDEA]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_CBC_IDEA], c[D_CBC_IDEA][j], lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_CBC_IDEA][j]); count++)\n                idea_cbc_encrypt(buf, buf,\n                                 (unsigned long)lengths[j], &idea_ks,\n                                 iv, IDEA_ENCRYPT);\n            d = Time_F(STOP);\n            print_result(D_CBC_IDEA, j, count, d);\n        }\n    }\n#endif\n#ifndef OPENSSL_NO_SEED\n    if (doit[D_CBC_SEED]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_CBC_SEED], c[D_CBC_SEED][j], lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_CBC_SEED][j]); count++)\n                SEED_cbc_encrypt(buf, buf,\n                                 (unsigned long)lengths[j], &seed_ks, iv, 1);\n            d = Time_F(STOP);\n            print_result(D_CBC_SEED, j, count, d);\n        }\n    }\n#endif\n#ifndef OPENSSL_NO_RC2\n    if (doit[D_CBC_RC2]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_CBC_RC2], c[D_CBC_RC2][j], lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_CBC_RC2][j]); count++)\n                RC2_cbc_encrypt(buf, buf,\n                                (unsigned long)lengths[j], &rc2_ks,\n                                iv, RC2_ENCRYPT);\n            d = Time_F(STOP);\n            print_result(D_CBC_RC2, j, count, d);\n        }\n    }\n#endif\n#ifndef OPENSSL_NO_RC5\n    if (doit[D_CBC_RC5]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_CBC_RC5], c[D_CBC_RC5][j], lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_CBC_RC5][j]); count++)\n                RC5_32_cbc_encrypt(buf, buf,\n                                   (unsigned long)lengths[j], &rc5_ks,\n                                   iv, RC5_ENCRYPT);\n            d = Time_F(STOP);\n            print_result(D_CBC_RC5, j, count, d);\n        }\n    }\n#endif\n#ifndef OPENSSL_NO_BF\n    if (doit[D_CBC_BF]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_CBC_BF], c[D_CBC_BF][j], lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_CBC_BF][j]); count++)\n                BF_cbc_encrypt(buf, buf,\n                               (unsigned long)lengths[j], &bf_ks,\n                               iv, BF_ENCRYPT);\n            d = Time_F(STOP);\n            print_result(D_CBC_BF, j, count, d);\n        }\n    }\n#endif\n#ifndef OPENSSL_NO_CAST\n    if (doit[D_CBC_CAST]) {\n        for (j = 0; j < SIZE_NUM; j++) {\n            print_message(names[D_CBC_CAST], c[D_CBC_CAST][j], lengths[j]);\n            Time_F(START);\n            for (count = 0, run = 1; COND(c[D_CBC_CAST][j]); count++)\n                CAST_cbc_encrypt(buf, buf,\n                                 (unsigned long)lengths[j], &cast_ks,\n                                 iv, CAST_ENCRYPT);\n            d = Time_F(STOP);\n            print_result(D_CBC_CAST, j, count, d);\n        }\n    }\n#endif\n    if (doit[D_EVP]) {\n#ifdef EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK\n        if (multiblock && evp_cipher) {\n            if (!\n                (EVP_CIPHER_flags(evp_cipher) &\n                 EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK)) {\n                BIO_printf(bio_err, "%s is not multi-block capable\\n",\n                        OBJ_nid2ln(evp_cipher->nid));\n                goto end;\n            }\n            multiblock_speed(evp_cipher);\n            ret = 0;\n            goto end;\n        }\n#endif\n        for (j = 0; j < SIZE_NUM; j++) {\n            if (evp_cipher) {\n                EVP_CIPHER_CTX ctx;\n                int outl;\n                names[D_EVP] = OBJ_nid2ln(evp_cipher->nid);\n                print_message(names[D_EVP], save_count, lengths[j]);\n                EVP_CIPHER_CTX_init(&ctx);\n                if (decrypt)\n                    EVP_DecryptInit_ex(&ctx, evp_cipher, NULL, key16, iv);\n                else\n                    EVP_EncryptInit_ex(&ctx, evp_cipher, NULL, key16, iv);\n                EVP_CIPHER_CTX_set_padding(&ctx, 0);\n                Time_F(START);\n                if (decrypt)\n                    for (count = 0, run = 1;\n                         COND(save_count * 4 * lengths[0] / lengths[j]);\n                         count++)\n                        EVP_DecryptUpdate(&ctx, buf, &outl, buf, lengths[j]);\n                else\n                    for (count = 0, run = 1;\n                         COND(save_count * 4 * lengths[0] / lengths[j]);\n                         count++)\n                        EVP_EncryptUpdate(&ctx, buf, &outl, buf, lengths[j]);\n                if (decrypt)\n                    EVP_DecryptFinal_ex(&ctx, buf, &outl);\n                else\n                    EVP_EncryptFinal_ex(&ctx, buf, &outl);\n                d = Time_F(STOP);\n                EVP_CIPHER_CTX_cleanup(&ctx);\n            }\n            if (evp_md) {\n                names[D_EVP] = OBJ_nid2ln(evp_md->type);\n                print_message(names[D_EVP], save_count, lengths[j]);\n                Time_F(START);\n                for (count = 0, run = 1;\n                     COND(save_count * 4 * lengths[0] / lengths[j]); count++)\n                    EVP_Digest(buf, lengths[j], &(md[0]), NULL, evp_md, NULL);\n                d = Time_F(STOP);\n            }\n            print_result(D_EVP, j, count, d);\n        }\n    }\n    RAND_bytes(buf, 36);\n#ifndef OPENSSL_NO_RSA\n    for (j = 0; j < RSA_NUM; j++) {\n        int st;\n        if (!rsa_doit[j])\n            continue;\n        st = RSA_sign(NID_md5_sha1, buf, 36, buf2, &rsa_num, rsa_key[j]);\n        if (st == 0) {\n            BIO_printf(bio_err,\n                       "RSA sign failure.  No RSA sign will be done.\\n");\n            ERR_print_errors(bio_err);\n            rsa_count = 1;\n        } else {\n            pkey_print_message("private", "rsa",\n                               rsa_c[j][0], rsa_bits[j], RSA_SECONDS);\n            Time_F(START);\n            for (count = 0, run = 1; COND(rsa_c[j][0]); count++) {\n                st = RSA_sign(NID_md5_sha1, buf, 36, buf2,\n                              &rsa_num, rsa_key[j]);\n                if (st == 0) {\n                    BIO_printf(bio_err, "RSA sign failure\\n");\n                    ERR_print_errors(bio_err);\n                    count = 1;\n                    break;\n                }\n            }\n            d = Time_F(STOP);\n            BIO_printf(bio_err,\n                       mr ? "+R1:%ld:%d:%.2f\\n"\n                       : "%ld %d bit private RSA\'s in %.2fs\\n",\n                       count, rsa_bits[j], d);\n            rsa_results[j][0] = d / (double)count;\n            rsa_count = count;\n        }\n        st = RSA_verify(NID_md5_sha1, buf, 36, buf2, rsa_num, rsa_key[j]);\n        if (st <= 0) {\n            BIO_printf(bio_err,\n                       "RSA verify failure.  No RSA verify will be done.\\n");\n            ERR_print_errors(bio_err);\n            rsa_doit[j] = 0;\n        } else {\n            pkey_print_message("public", "rsa",\n                               rsa_c[j][1], rsa_bits[j], RSA_SECONDS);\n            Time_F(START);\n            for (count = 0, run = 1; COND(rsa_c[j][1]); count++) {\n                st = RSA_verify(NID_md5_sha1, buf, 36, buf2,\n                                rsa_num, rsa_key[j]);\n                if (st <= 0) {\n                    BIO_printf(bio_err, "RSA verify failure\\n");\n                    ERR_print_errors(bio_err);\n                    count = 1;\n                    break;\n                }\n            }\n            d = Time_F(STOP);\n            BIO_printf(bio_err,\n                       mr ? "+R2:%ld:%d:%.2f\\n"\n                       : "%ld %d bit public RSA\'s in %.2fs\\n",\n                       count, rsa_bits[j], d);\n            rsa_results[j][1] = d / (double)count;\n        }\n        if (rsa_count <= 1) {\n            for (j++; j < RSA_NUM; j++)\n                rsa_doit[j] = 0;\n        }\n    }\n#endif\n    RAND_bytes(buf, 20);\n#ifndef OPENSSL_NO_DSA\n    if (RAND_status() != 1) {\n        RAND_seed(rnd_seed, sizeof rnd_seed);\n        rnd_fake = 1;\n    }\n    for (j = 0; j < DSA_NUM; j++) {\n        unsigned int kk;\n        int st;\n        if (!dsa_doit[j])\n            continue;\n        st = DSA_sign(EVP_PKEY_DSA, buf, 20, buf2, &kk, dsa_key[j]);\n        if (st == 0) {\n            BIO_printf(bio_err,\n                       "DSA sign failure.  No DSA sign will be done.\\n");\n            ERR_print_errors(bio_err);\n            rsa_count = 1;\n        } else {\n            pkey_print_message("sign", "dsa",\n                               dsa_c[j][0], dsa_bits[j], DSA_SECONDS);\n            Time_F(START);\n            for (count = 0, run = 1; COND(dsa_c[j][0]); count++) {\n                st = DSA_sign(EVP_PKEY_DSA, buf, 20, buf2, &kk, dsa_key[j]);\n                if (st == 0) {\n                    BIO_printf(bio_err, "DSA sign failure\\n");\n                    ERR_print_errors(bio_err);\n                    count = 1;\n                    break;\n                }\n            }\n            d = Time_F(STOP);\n            BIO_printf(bio_err,\n                       mr ? "+R3:%ld:%d:%.2f\\n"\n                       : "%ld %d bit DSA signs in %.2fs\\n",\n                       count, dsa_bits[j], d);\n            dsa_results[j][0] = d / (double)count;\n            rsa_count = count;\n        }\n        st = DSA_verify(EVP_PKEY_DSA, buf, 20, buf2, kk, dsa_key[j]);\n        if (st <= 0) {\n            BIO_printf(bio_err,\n                       "DSA verify failure.  No DSA verify will be done.\\n");\n            ERR_print_errors(bio_err);\n            dsa_doit[j] = 0;\n        } else {\n            pkey_print_message("verify", "dsa",\n                               dsa_c[j][1], dsa_bits[j], DSA_SECONDS);\n            Time_F(START);\n            for (count = 0, run = 1; COND(dsa_c[j][1]); count++) {\n                st = DSA_verify(EVP_PKEY_DSA, buf, 20, buf2, kk, dsa_key[j]);\n                if (st <= 0) {\n                    BIO_printf(bio_err, "DSA verify failure\\n");\n                    ERR_print_errors(bio_err);\n                    count = 1;\n                    break;\n                }\n            }\n            d = Time_F(STOP);\n            BIO_printf(bio_err,\n                       mr ? "+R4:%ld:%d:%.2f\\n"\n                       : "%ld %d bit DSA verify in %.2fs\\n",\n                       count, dsa_bits[j], d);\n            dsa_results[j][1] = d / (double)count;\n        }\n        if (rsa_count <= 1) {\n            for (j++; j < DSA_NUM; j++)\n                dsa_doit[j] = 0;\n        }\n    }\n    if (rnd_fake)\n        RAND_cleanup();\n#endif\n#ifndef OPENSSL_NO_EC\n    if (RAND_status() != 1) {\n        RAND_seed(rnd_seed, sizeof rnd_seed);\n        rnd_fake = 1;\n    }\n    for (j = 0; j < EC_NUM; j++) {\n        int st;\n        if (!ecdsa_doit[j])\n            continue;\n        ecdsa[j] = EC_KEY_new_by_curve_name(test_curves[j]);\n        if (ecdsa[j] == NULL) {\n            BIO_printf(bio_err, "ECDSA failure.\\n");\n            ERR_print_errors(bio_err);\n            rsa_count = 1;\n        } else {\n            EC_KEY_precompute_mult(ecdsa[j], NULL);\n            EC_KEY_generate_key(ecdsa[j]);\n            st = ECDSA_sign(0, buf, 20, ecdsasig, &ecdsasiglen, ecdsa[j]);\n            if (st == 0) {\n                BIO_printf(bio_err,\n                           "ECDSA sign failure.  No ECDSA sign will be done.\\n");\n                ERR_print_errors(bio_err);\n                rsa_count = 1;\n            } else {\n                pkey_print_message("sign", "ecdsa",\n                                   ecdsa_c[j][0],\n                                   test_curves_bits[j], ECDSA_SECONDS);\n                Time_F(START);\n                for (count = 0, run = 1; COND(ecdsa_c[j][0]); count++) {\n                    st = ECDSA_sign(0, buf, 20,\n                                    ecdsasig, &ecdsasiglen, ecdsa[j]);\n                    if (st == 0) {\n                        BIO_printf(bio_err, "ECDSA sign failure\\n");\n                        ERR_print_errors(bio_err);\n                        count = 1;\n                        break;\n                    }\n                }\n                d = Time_F(STOP);\n                BIO_printf(bio_err,\n                           mr ? "+R5:%ld:%d:%.2f\\n" :\n                           "%ld %d bit ECDSA signs in %.2fs \\n",\n                           count, test_curves_bits[j], d);\n                ecdsa_results[j][0] = d / (double)count;\n                rsa_count = count;\n            }\n            st = ECDSA_verify(0, buf, 20, ecdsasig, ecdsasiglen, ecdsa[j]);\n            if (st != 1) {\n                BIO_printf(bio_err,\n                           "ECDSA verify failure.  No ECDSA verify will be done.\\n");\n                ERR_print_errors(bio_err);\n                ecdsa_doit[j] = 0;\n            } else {\n                pkey_print_message("verify", "ecdsa",\n                                   ecdsa_c[j][1],\n                                   test_curves_bits[j], ECDSA_SECONDS);\n                Time_F(START);\n                for (count = 0, run = 1; COND(ecdsa_c[j][1]); count++) {\n                    st = ECDSA_verify(0, buf, 20, ecdsasig, ecdsasiglen,\n                                      ecdsa[j]);\n                    if (st != 1) {\n                        BIO_printf(bio_err, "ECDSA verify failure\\n");\n                        ERR_print_errors(bio_err);\n                        count = 1;\n                        break;\n                    }\n                }\n                d = Time_F(STOP);\n                BIO_printf(bio_err,\n                           mr ? "+R6:%ld:%d:%.2f\\n"\n                           : "%ld %d bit ECDSA verify in %.2fs\\n",\n                           count, test_curves_bits[j], d);\n                ecdsa_results[j][1] = d / (double)count;\n            }\n            if (rsa_count <= 1) {\n                for (j++; j < EC_NUM; j++)\n                    ecdsa_doit[j] = 0;\n            }\n        }\n    }\n    if (rnd_fake)\n        RAND_cleanup();\n#endif\n#ifndef OPENSSL_NO_EC\n    if (RAND_status() != 1) {\n        RAND_seed(rnd_seed, sizeof rnd_seed);\n        rnd_fake = 1;\n    }\n    for (j = 0; j < EC_NUM; j++) {\n        if (!ecdh_doit[j])\n            continue;\n        ecdh_a[j] = EC_KEY_new_by_curve_name(test_curves[j]);\n        ecdh_b[j] = EC_KEY_new_by_curve_name(test_curves[j]);\n        if ((ecdh_a[j] == NULL) || (ecdh_b[j] == NULL)) {\n            BIO_printf(bio_err, "ECDH failure.\\n");\n            ERR_print_errors(bio_err);\n            rsa_count = 1;\n        } else {\n            if (!EC_KEY_generate_key(ecdh_a[j]) ||\n                !EC_KEY_generate_key(ecdh_b[j])) {\n                BIO_printf(bio_err, "ECDH key generation failure.\\n");\n                ERR_print_errors(bio_err);\n                rsa_count = 1;\n            } else {\n                int field_size, outlen;\n                void *(*kdf) (const void *in, size_t inlen, void *out,\n                              size_t *xoutlen);\n                field_size =\n                    EC_GROUP_get_degree(EC_KEY_get0_group(ecdh_a[j]));\n                if (field_size <= 24 * 8) {\n                    outlen = KDF1_SHA1_len;\n                    kdf = KDF1_SHA1;\n                } else {\n                    outlen = (field_size + 7) / 8;\n                    kdf = NULL;\n                }\n                secret_size_a =\n                    ECDH_compute_key(secret_a, outlen,\n                                     EC_KEY_get0_public_key(ecdh_b[j]),\n                                     ecdh_a[j], kdf);\n                secret_size_b =\n                    ECDH_compute_key(secret_b, outlen,\n                                     EC_KEY_get0_public_key(ecdh_a[j]),\n                                     ecdh_b[j], kdf);\n                if (secret_size_a != secret_size_b)\n                    ecdh_checks = 0;\n                else\n                    ecdh_checks = 1;\n                for (secret_idx = 0; (secret_idx < secret_size_a)\n                     && (ecdh_checks == 1); secret_idx++) {\n                    if (secret_a[secret_idx] != secret_b[secret_idx])\n                        ecdh_checks = 0;\n                }\n                if (ecdh_checks == 0) {\n                    BIO_printf(bio_err, "ECDH computations don\'t match.\\n");\n                    ERR_print_errors(bio_err);\n                    rsa_count = 1;\n                }\n                pkey_print_message("", "ecdh",\n                                   ecdh_c[j][0],\n                                   test_curves_bits[j], ECDH_SECONDS);\n                Time_F(START);\n                for (count = 0, run = 1; COND(ecdh_c[j][0]); count++) {\n                    ECDH_compute_key(secret_a, outlen,\n                                     EC_KEY_get0_public_key(ecdh_b[j]),\n                                     ecdh_a[j], kdf);\n                }\n                d = Time_F(STOP);\n                BIO_printf(bio_err,\n                           mr ? "+R7:%ld:%d:%.2f\\n" :\n                           "%ld %d-bit ECDH ops in %.2fs\\n", count,\n                           test_curves_bits[j], d);\n                ecdh_results[j][0] = d / (double)count;\n                rsa_count = count;\n            }\n        }\n        if (rsa_count <= 1) {\n            for (j++; j < EC_NUM; j++)\n                ecdh_doit[j] = 0;\n        }\n    }\n    if (rnd_fake)\n        RAND_cleanup();\n#endif\n#ifndef NO_FORK\n show_res:\n#endif\n    if (!mr) {\n        printf("%s\\n", SSLeay_version(SSLEAY_VERSION));\n        printf("%s\\n", SSLeay_version(SSLEAY_BUILT_ON));\n        printf("options:");\n        printf("%s ", BN_options());\n#ifndef OPENSSL_NO_MD2\n        printf("%s ", MD2_options());\n#endif\n#ifndef OPENSSL_NO_RC4\n        printf("%s ", RC4_options());\n#endif\n#ifndef OPENSSL_NO_DES\n        printf("%s ", DES_options());\n#endif\n#ifndef OPENSSL_NO_AES\n        printf("%s ", AES_options());\n#endif\n#ifndef OPENSSL_NO_IDEA\n        printf("%s ", idea_options());\n#endif\n#ifndef OPENSSL_NO_BF\n        printf("%s ", BF_options());\n#endif\n        printf("\\n%s\\n", SSLeay_version(SSLEAY_CFLAGS));\n    }\n    if (pr_header) {\n        if (mr)\n            printf("+H");\n        else {\n            printf\n                ("The \'numbers\' are in 1000s of bytes per second processed.\\n");\n            printf("type        ");\n        }\n        for (j = 0; j < SIZE_NUM; j++)\n            printf(mr ? ":%d" : "%7d bytes", lengths[j]);\n        printf("\\n");\n    }\n    for (k = 0; k < ALGOR_NUM; k++) {\n        if (!doit[k])\n            continue;\n        if (mr)\n            printf("+F:%d:%s", k, names[k]);\n        else\n            printf("%-13s", names[k]);\n        for (j = 0; j < SIZE_NUM; j++) {\n            if (results[k][j] > 10000 && !mr)\n                printf(" %11.2fk", results[k][j] / 1e3);\n            else\n                printf(mr ? ":%.2f" : " %11.2f ", results[k][j]);\n        }\n        printf("\\n");\n    }\n#ifndef OPENSSL_NO_RSA\n    j = 1;\n    for (k = 0; k < RSA_NUM; k++) {\n        if (!rsa_doit[k])\n            continue;\n        if (j && !mr) {\n            printf("%18ssign    verify    sign/s verify/s\\n", " ");\n            j = 0;\n        }\n        if (mr)\n            printf("+F2:%u:%u:%f:%f\\n",\n                   k, rsa_bits[k], rsa_results[k][0], rsa_results[k][1]);\n        else\n            printf("rsa %4u bits %8.6fs %8.6fs %8.1f %8.1f\\n",\n                   rsa_bits[k], rsa_results[k][0], rsa_results[k][1],\n                   1.0 / rsa_results[k][0], 1.0 / rsa_results[k][1]);\n    }\n#endif\n#ifndef OPENSSL_NO_DSA\n    j = 1;\n    for (k = 0; k < DSA_NUM; k++) {\n        if (!dsa_doit[k])\n            continue;\n        if (j && !mr) {\n            printf("%18ssign    verify    sign/s verify/s\\n", " ");\n            j = 0;\n        }\n        if (mr)\n            printf("+F3:%u:%u:%f:%f\\n",\n                   k, dsa_bits[k], dsa_results[k][0], dsa_results[k][1]);\n        else\n            printf("dsa %4u bits %8.6fs %8.6fs %8.1f %8.1f\\n",\n                   dsa_bits[k], dsa_results[k][0], dsa_results[k][1],\n                   1.0 / dsa_results[k][0], 1.0 / dsa_results[k][1]);\n    }\n#endif\n#ifndef OPENSSL_NO_EC\n    j = 1;\n    for (k = 0; k < EC_NUM; k++) {\n        if (!ecdsa_doit[k])\n            continue;\n        if (j && !mr) {\n            printf("%30ssign    verify    sign/s verify/s\\n", " ");\n            j = 0;\n        }\n        if (mr)\n            printf("+F4:%u:%u:%f:%f\\n",\n                   k, test_curves_bits[k],\n                   ecdsa_results[k][0], ecdsa_results[k][1]);\n        else\n            printf("%4u bit ecdsa (%s) %8.4fs %8.4fs %8.1f %8.1f\\n",\n                   test_curves_bits[k],\n                   test_curves_names[k],\n                   ecdsa_results[k][0], ecdsa_results[k][1],\n                   1.0 / ecdsa_results[k][0], 1.0 / ecdsa_results[k][1]);\n    }\n#endif\n#ifndef OPENSSL_NO_EC\n    j = 1;\n    for (k = 0; k < EC_NUM; k++) {\n        if (!ecdh_doit[k])\n            continue;\n        if (j && !mr) {\n            printf("%30sop      op/s\\n", " ");\n            j = 0;\n        }\n        if (mr)\n            printf("+F5:%u:%u:%f:%f\\n",\n                   k, test_curves_bits[k],\n                   ecdh_results[k][0], 1.0 / ecdh_results[k][0]);\n        else\n            printf("%4u bit ecdh (%s) %8.4fs %8.1f\\n",\n                   test_curves_bits[k],\n                   test_curves_names[k],\n                   ecdh_results[k][0], 1.0 / ecdh_results[k][0]);\n    }\n#endif\n    ret = 0;\n end:\n    ERR_print_errors(bio_err);\n    OPENSSL_free(buf_malloc);\n    OPENSSL_free(buf2_malloc);\n#ifndef OPENSSL_NO_RSA\n    for (i = 0; i < RSA_NUM; i++)\n        RSA_free(rsa_key[i]);\n#endif\n#ifndef OPENSSL_NO_DSA\n    for (i = 0; i < DSA_NUM; i++)\n        DSA_free(dsa_key[i]);\n#endif\n#ifndef OPENSSL_NO_EC\n    for (i = 0; i < EC_NUM; i++) {\n        EC_KEY_free(ecdsa[i]);\n        EC_KEY_free(ecdh_a[i]);\n        EC_KEY_free(ecdh_b[i]);\n    }\n#endif\n    return (ret);\n}', 'int Camellia_set_key(const unsigned char *userKey, const int bits,\n                     CAMELLIA_KEY *key)\n{\n    if (!userKey || !key)\n        return -1;\n    if (bits != 128 && bits != 192 && bits != 256)\n        return -2;\n    key->grand_rounds = Camellia_Ekeygen(bits, userKey, key->u.rd_key);\n    return 0;\n}', 'int Camellia_Ekeygen(int keyBitLength, const u8 *rawKey, KEY_TABLE_TYPE k)\n{\n    register u32 s0, s1, s2, s3;\n    k[0] = s0 = GETU32(rawKey);\n    k[1] = s1 = GETU32(rawKey + 4);\n    k[2] = s2 = GETU32(rawKey + 8);\n    k[3] = s3 = GETU32(rawKey + 12);\n    if (keyBitLength != 128) {\n        k[8] = s0 = GETU32(rawKey + 16);\n        k[9] = s1 = GETU32(rawKey + 20);\n        if (keyBitLength == 192) {\n            k[10] = s2 = ~s0;\n            k[11] = s3 = ~s1;\n        } else {\n            k[10] = s2 = GETU32(rawKey + 24);\n            k[11] = s3 = GETU32(rawKey + 28);\n        }\n        s0 ^= k[0], s1 ^= k[1], s2 ^= k[2], s3 ^= k[3];\n    }\n    Camellia_Feistel(s0, s1, s2, s3, SIGMA + 0);\n    Camellia_Feistel(s2, s3, s0, s1, SIGMA + 2);\n    s0 ^= k[0], s1 ^= k[1], s2 ^= k[2], s3 ^= k[3];\n    Camellia_Feistel(s0, s1, s2, s3, SIGMA + 4);\n    Camellia_Feistel(s2, s3, s0, s1, SIGMA + 6);\n    if (keyBitLength == 128) {\n        k[4] = s0, k[5] = s1, k[6] = s2, k[7] = s3;\n        RotLeft128(s0, s1, s2, s3, 15);\n        k[12] = s0, k[13] = s1, k[14] = s2, k[15] = s3;\n        RotLeft128(s0, s1, s2, s3, 15);\n        k[16] = s0, k[17] = s1, k[18] = s2, k[19] = s3;\n        RotLeft128(s0, s1, s2, s3, 15);\n        k[24] = s0, k[25] = s1;\n        RotLeft128(s0, s1, s2, s3, 15);\n        k[28] = s0, k[29] = s1, k[30] = s2, k[31] = s3;\n        RotLeft128(s1, s2, s3, s0, 2);\n        k[40] = s1, k[41] = s2, k[42] = s3, k[43] = s0;\n        RotLeft128(s1, s2, s3, s0, 17);\n        k[48] = s1, k[49] = s2, k[50] = s3, k[51] = s0;\n        s0 = k[0], s1 = k[1], s2 = k[2], s3 = k[3];\n        RotLeft128(s0, s1, s2, s3, 15);\n        k[8] = s0, k[9] = s1, k[10] = s2, k[11] = s3;\n        RotLeft128(s0, s1, s2, s3, 30);\n        k[20] = s0, k[21] = s1, k[22] = s2, k[23] = s3;\n        RotLeft128(s0, s1, s2, s3, 15);\n        k[26] = s2, k[27] = s3;\n        RotLeft128(s0, s1, s2, s3, 17);\n        k[32] = s0, k[33] = s1, k[34] = s2, k[35] = s3;\n        RotLeft128(s0, s1, s2, s3, 17);\n        k[36] = s0, k[37] = s1, k[38] = s2, k[39] = s3;\n        RotLeft128(s0, s1, s2, s3, 17);\n        k[44] = s0, k[45] = s1, k[46] = s2, k[47] = s3;\n        return 3;\n    } else {\n        k[12] = s0, k[13] = s1, k[14] = s2, k[15] = s3;\n        s0 ^= k[8], s1 ^= k[9], s2 ^= k[10], s3 ^= k[11];\n        Camellia_Feistel(s0, s1, s2, s3, (SIGMA + 8));\n        Camellia_Feistel(s2, s3, s0, s1, (SIGMA + 10));\n        k[4] = s0, k[5] = s1, k[6] = s2, k[7] = s3;\n        RotLeft128(s0, s1, s2, s3, 30);\n        k[20] = s0, k[21] = s1, k[22] = s2, k[23] = s3;\n        RotLeft128(s0, s1, s2, s3, 30);\n        k[40] = s0, k[41] = s1, k[42] = s2, k[43] = s3;\n        RotLeft128(s1, s2, s3, s0, 19);\n        k[64] = s1, k[65] = s2, k[66] = s3, k[67] = s0;\n        s0 = k[8], s1 = k[9], s2 = k[10], s3 = k[11];\n        RotLeft128(s0, s1, s2, s3, 15);\n        k[8] = s0, k[9] = s1, k[10] = s2, k[11] = s3;\n        RotLeft128(s0, s1, s2, s3, 15);\n        k[16] = s0, k[17] = s1, k[18] = s2, k[19] = s3;\n        RotLeft128(s0, s1, s2, s3, 30);\n        k[36] = s0, k[37] = s1, k[38] = s2, k[39] = s3;\n        RotLeft128(s1, s2, s3, s0, 2);\n        k[52] = s1, k[53] = s2, k[54] = s3, k[55] = s0;\n        s0 = k[12], s1 = k[13], s2 = k[14], s3 = k[15];\n        RotLeft128(s0, s1, s2, s3, 15);\n        k[12] = s0, k[13] = s1, k[14] = s2, k[15] = s3;\n        RotLeft128(s0, s1, s2, s3, 30);\n        k[28] = s0, k[29] = s1, k[30] = s2, k[31] = s3;\n        k[48] = s1, k[49] = s2, k[50] = s3, k[51] = s0;\n        RotLeft128(s1, s2, s3, s0, 17);\n        k[56] = s1, k[57] = s2, k[58] = s3, k[59] = s0;\n        s0 = k[0], s1 = k[1], s2 = k[2], s3 = k[3];\n        RotLeft128(s1, s2, s3, s0, 13);\n        k[24] = s1, k[25] = s2, k[26] = s3, k[27] = s0;\n        RotLeft128(s1, s2, s3, s0, 15);\n        k[32] = s1, k[33] = s2, k[34] = s3, k[35] = s0;\n        RotLeft128(s1, s2, s3, s0, 17);\n        k[44] = s1, k[45] = s2, k[46] = s3, k[47] = s0;\n        RotLeft128(s2, s3, s0, s1, 2);\n        k[60] = s2, k[61] = s3, k[62] = s0, k[63] = s1;\n        return 4;\n    }\n}']