Dead code removal #if 0 engines
Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
		@@ -1250,91 +1250,6 @@ int main(int argc, char *argv[])
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * Internal function test on GostR3411_94_TestParamSet
 | 
			
		||||
     */
 | 
			
		||||
# if 0 && defined(OPENSSL_NO_DYNAMIC_ENGINE)
 | 
			
		||||
    {
 | 
			
		||||
        gost_ctx ctx;
 | 
			
		||||
 | 
			
		||||
        for (t = 0; t < sizeof(tcs) / sizeof(tcs[0]); t++) {
 | 
			
		||||
            const gost_subst_block *pSubst = NULL;
 | 
			
		||||
 | 
			
		||||
            if (1024 < tcs[t].ullLen) {
 | 
			
		||||
                /* Key meshing check by engine tests */
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
            memset(bTest, 0xc3, sizeof(bTest));
 | 
			
		||||
            if (0 == strcmp(tcs[t].szParamSet,
 | 
			
		||||
                            "id-GostR3410-94-TestParamSet")) {
 | 
			
		||||
                pSubst = &GostR3411_94_TestParamSet;
 | 
			
		||||
            } else if (0 == strcmp(tcs[t].szParamSet,
 | 
			
		||||
                                   "id-Gost28147-89-CryptoPro-A-ParamSet")) {
 | 
			
		||||
                pSubst = &Gost28147_CryptoProParamSetA;
 | 
			
		||||
            } else if (0 == strcmp(tcs[t].szParamSet,
 | 
			
		||||
                                   "id-Gost28147-89-CryptoPro-B-ParamSet")) {
 | 
			
		||||
                pSubst = &Gost28147_CryptoProParamSetB;
 | 
			
		||||
            } else if (0 == strcmp(tcs[t].szParamSet,
 | 
			
		||||
                                   "id-Gost28147-89-CryptoPro-C-ParamSet")) {
 | 
			
		||||
                pSubst = &Gost28147_CryptoProParamSetC;
 | 
			
		||||
            } else if (0 == strcmp(tcs[t].szParamSet,
 | 
			
		||||
                                   "id-Gost28147-89-CryptoPro-D-ParamSet")) {
 | 
			
		||||
                pSubst = &Gost28147_CryptoProParamSetD;
 | 
			
		||||
            }
 | 
			
		||||
            gost_init(&ctx, pSubst);
 | 
			
		||||
            gost_key(&ctx, tcs[t].bRawKey);
 | 
			
		||||
            switch (tcs[t].gMode) {
 | 
			
		||||
            case G89_ECB:
 | 
			
		||||
                gost_enc(&ctx, tcs[t].bIn, bTest,
 | 
			
		||||
                         (int)((tcs[t].ullLen + G89_BLOCK_LEN - 1) /
 | 
			
		||||
                               G89_BLOCK_LEN));
 | 
			
		||||
                l = (size_t)tcs[t].ullLen;
 | 
			
		||||
                break;
 | 
			
		||||
            case G89_CFB:
 | 
			
		||||
                gost_enc_cfb(&ctx, tcs[t].bIV, tcs[t].bIn,
 | 
			
		||||
                             bTest,
 | 
			
		||||
                             (int)((tcs[t].ullLen + G89_BLOCK_LEN - 1) /
 | 
			
		||||
                                   G89_BLOCK_LEN));
 | 
			
		||||
                l = (size_t)tcs[t].ullLen;
 | 
			
		||||
                break;
 | 
			
		||||
            case G89_CNT:
 | 
			
		||||
                /*
 | 
			
		||||
                 * GOST 28147-89 cipher CNT mode check by engine tests
 | 
			
		||||
                 */
 | 
			
		||||
                continue;
 | 
			
		||||
            case G89_IMIT:
 | 
			
		||||
                gost_mac(&ctx, 32, tcs[t].bIn,
 | 
			
		||||
                         (unsigned int)tcs[t].ullLen, bTest);
 | 
			
		||||
                gost_mac_iv(&ctx, 32, tcs[t].bIV, tcs[t].bIn,
 | 
			
		||||
                            (unsigned int)tcs[t].ullLen, bTest1);
 | 
			
		||||
                if (0 != memcmp(bTest, bTest1, 4)) {
 | 
			
		||||
                    fflush(NULL);
 | 
			
		||||
                    fprintf(stderr, "\nInternal test t=%d len=" FMT64
 | 
			
		||||
                            " failed (gost_mac_iv).\n", t, tcs[t].ullLen);
 | 
			
		||||
                    if (!ignore) {
 | 
			
		||||
                        return 2;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                l = 4;
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
            gost_destroy(&ctx);
 | 
			
		||||
 | 
			
		||||
            if (0 != memcmp(tcs[t].bOut, bTest, l)) {
 | 
			
		||||
                fflush(NULL);
 | 
			
		||||
                fprintf(stderr, "\nInternal test t=%d len=" FMT64
 | 
			
		||||
                        " failed.\n", t, tcs[t].ullLen);
 | 
			
		||||
                if (!ignore) {
 | 
			
		||||
                    return 3;
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                printf(",");
 | 
			
		||||
                fflush(NULL);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
# endif
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * ccgost engine test on GostR3411_94_CryptoProParamSet
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -748,11 +748,7 @@ static int cswift_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa,
 | 
			
		||||
#   ifdef RSA_NULL
 | 
			
		||||
        def_rsa_method = RSA_null_method();
 | 
			
		||||
#   else
 | 
			
		||||
#    if 0
 | 
			
		||||
        def_rsa_method = RSA_PKCS1_RSAref();
 | 
			
		||||
#    else
 | 
			
		||||
        def_rsa_method = RSA_PKCS1_SSLeay();
 | 
			
		||||
#    endif
 | 
			
		||||
#   endif
 | 
			
		||||
        if (def_rsa_method)
 | 
			
		||||
            return def_rsa_method->rsa_mod_exp(r0, I, rsa, ctx);
 | 
			
		||||
@@ -777,11 +773,7 @@ static int cswift_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
 | 
			
		||||
#   ifdef RSA_NULL
 | 
			
		||||
        def_rsa_method = RSA_null_method();
 | 
			
		||||
#   else
 | 
			
		||||
#    if 0
 | 
			
		||||
        def_rsa_method = RSA_PKCS1_RSAref();
 | 
			
		||||
#    else
 | 
			
		||||
        def_rsa_method = RSA_PKCS1_SSLeay();
 | 
			
		||||
#    endif
 | 
			
		||||
#   endif
 | 
			
		||||
        if (def_rsa_method)
 | 
			
		||||
            return def_rsa_method->bn_mod_exp(r, a, p, m, ctx, m_ctx);
 | 
			
		||||
 
 | 
			
		||||
@@ -117,12 +117,6 @@ static int e_gmp_rsa_finish(RSA *r);
 | 
			
		||||
/* The definitions for control commands specific to this engine */
 | 
			
		||||
/* #define E_GMP_CMD_SO_PATH            ENGINE_CMD_BASE */
 | 
			
		||||
static const ENGINE_CMD_DEFN e_gmp_cmd_defns[] = {
 | 
			
		||||
#  if 0
 | 
			
		||||
    {E_GMP_CMD_SO_PATH,
 | 
			
		||||
     "SO_PATH",
 | 
			
		||||
     "Specifies the path to the 'e_gmp' shared library",
 | 
			
		||||
     ENGINE_CMD_FLAG_STRING},
 | 
			
		||||
#  endif
 | 
			
		||||
    {0, NULL, NULL, 0}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -247,10 +241,6 @@ static int e_gmp_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void))
 | 
			
		||||
    int to_return = 1;
 | 
			
		||||
 | 
			
		||||
    switch (cmd) {
 | 
			
		||||
#  if 0
 | 
			
		||||
    case E_GMP_CMD_SO_PATH:
 | 
			
		||||
        /* ... */
 | 
			
		||||
#  endif
 | 
			
		||||
        /* The command isn't understood by this engine */
 | 
			
		||||
    default:
 | 
			
		||||
        GMPerr(GMP_F_E_GMP_CTRL, GMP_R_CTRL_COMMAND_NOT_IMPLEMENTED);
 | 
			
		||||
 
 | 
			
		||||
@@ -111,10 +111,6 @@ static EVP_PKEY *surewarehk_load_pubkey(ENGINE *e, const char *key_id,
 | 
			
		||||
                                        void *callback_data);
 | 
			
		||||
static void surewarehk_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad,
 | 
			
		||||
                               int idx, long argl, void *argp);
 | 
			
		||||
#  if 0
 | 
			
		||||
static void surewarehk_dh_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad,
 | 
			
		||||
                                  int idx, long argl, void *argp);
 | 
			
		||||
#  endif
 | 
			
		||||
 | 
			
		||||
#  ifndef OPENSSL_NO_RSA
 | 
			
		||||
/* This function is aliased to mod_exp (with the mont stuff dropped). */
 | 
			
		||||
@@ -881,23 +877,6 @@ static void surewarehk_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad,
 | 
			
		||||
        p_surewarehk_Free((char *)item, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#  if 0
 | 
			
		||||
/* not currently used (bug?) */
 | 
			
		||||
/*
 | 
			
		||||
 * This cleans up an DH KM key (destroys the key into hardware), called when
 | 
			
		||||
 * ex_data is freed
 | 
			
		||||
 */
 | 
			
		||||
static void surewarehk_dh_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad,
 | 
			
		||||
                                  int idx, long argl, void *argp)
 | 
			
		||||
{
 | 
			
		||||
    if (!p_surewarehk_Free) {
 | 
			
		||||
        SUREWAREerr(SUREWARE_F_SUREWAREHK_DH_EX_FREE,
 | 
			
		||||
                    ENGINE_R_NOT_INITIALISED);
 | 
			
		||||
    } else
 | 
			
		||||
        p_surewarehk_Free((char *)item, 1);
 | 
			
		||||
}
 | 
			
		||||
#  endif
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * return number of decrypted bytes
 | 
			
		||||
 */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user