示例#1
0
void
ENGINE_load_builtin_engines(void)
{
    ENGINE *engine;
    int ret;

    engine = ENGINE_new();
    if (engine == NULL)
        return;

    ENGINE_set_id(engine, "builtin");
    ENGINE_set_name(engine,
                    "Heimdal crypto builtin engine version " PACKAGE_VERSION);
#ifdef HAVE_CDSA
    ENGINE_set_DH(engine, DH_cdsa_method());
    ENGINE_set_RSA(engine, RSA_cdsa_method());
#elif defined(HEIM_HC_SF)
    ENGINE_set_RSA(engine, RSA_sf_method());
    ENGINE_set_DH(engine, DH_sf_method());
#elif defined(HEIM_HC_LTM)
    ENGINE_set_RSA(engine, RSA_ltm_method());
    ENGINE_set_DH(engine, DH_ltm_method());
#else
    ENGINE_set_RSA(engine, RSA_tfm_method());
    ENGINE_set_DH(engine, DH_tfm_method());
#endif

    ret = add_engine(engine);
    if (ret != 1)
        ENGINE_finish(engine);

#ifdef USE_HCRYPTO_TFM
    /*
     * TFM
     */

    engine = ENGINE_new();
    if (engine == NULL)
        return;

    ENGINE_set_id(engine, "tfm");
    ENGINE_set_name(engine,
                    "Heimdal crypto tfm engine version " PACKAGE_VERSION);
    ENGINE_set_RSA(engine, RSA_tfm_method());
    ENGINE_set_DH(engine, DH_tfm_method());

    ret = add_engine(engine);
    if (ret != 1)
        ENGINE_finish(engine);
#endif /* USE_HCRYPTO_TFM */

#ifdef USE_HCRYPTO_LTM
    /*
     * ltm
     */

    engine = ENGINE_new();
    if (engine == NULL)
        return;

    ENGINE_set_id(engine, "ltm");
    ENGINE_set_name(engine,
                    "Heimdal crypto ltm engine version " PACKAGE_VERSION);
    ENGINE_set_RSA(engine, RSA_ltm_method());
    ENGINE_set_DH(engine, DH_ltm_method());

    ret = add_engine(engine);
    if (ret != 1)
        ENGINE_finish(engine);
#endif

#ifdef HAVE_GMP
    /*
     * gmp
     */

    engine = ENGINE_new();
    if (engine == NULL)
        return;

    ENGINE_set_id(engine, "gmp");
    ENGINE_set_name(engine,
                    "Heimdal crypto gmp engine version " PACKAGE_VERSION);
    ENGINE_set_RSA(engine, RSA_gmp_method());

    ret = add_engine(engine);
    if (ret != 1)
        ENGINE_finish(engine);
#endif
}
示例#2
0
void
ENGINE_load_builtin_engines(void)
{
	ENGINE *engine;
	int ret;

	engine = ENGINE_new();
	if (engine == NULL) {
		return;
	}

	ENGINE_set_id(engine, "builtin");
	ENGINE_set_name(engine,
	    "cryptoshims builtin engine version " PACKAGE_VERSION);

/*
 *  XXX <radr://problem/107832242> and <rda://problem/8174874> are
 *  blocking the use of CommonCrypto's RSA code for OpenSSH.
 *
 *  XXX <rdar://problem/10488503> is blocking the use of
 *  CommonCrypto's (non-existing) DSA.
 *
 *  XXX <rdar://problem/10771223> and <rdar://problem/10771188> are
 *  blocking the use of CommonCrypto's DH code.
 */
#if !defined(PR_10783242_FIXED) || !defined(PR_8174774_FIXED) || !defined(PR_10488503_FIXED) || !defined(PR_10771223_FIXED) || !defined(PR_10771188_FIXED)
	ENGINE_set_DH(engine, DH_eay_method());
	ENGINE_set_DSA(engine, DSA_eay_method());
	ENGINE_set_RSA(engine, RSA_eay_method());
#elif defined(HAVE_COMMONCRYPTO_COMMONRSACRYPTOR_H) && defined(HAVE_COMMONCRYPTO_COMMONDH_H) && defined(HAVE_COMMONCRYPTO_COMMONDSACRYPTOR_H)
	ENGINE_set_DH(engine, DH_eay_method());
	ENGINE_set_DSA(engine, DSA_eay_method());
	ENGINE_set_RSA(engine, RSA_cc_method());
#elif HAVE_CDSA
	ENGINE_set_DH(engine, DH_cdsa_method());
	ENGINE_set_DSA(engine, DSA_null_method());
	ENGINE_set_RSA(engine, RSA_cdsa_method());
#elif defined(__APPLE_TARGET_EMBEDDED__)
	ENGINE_set_DH(engine, DH_null_method());
	ENGINE_set_DSA(engine, DSA_null_method());
	ENGINE_set_RSA(engine, RSA_null_method());
#elif defined(HEIM_HC_SF)
	ENGINE_set_RSA(engine, RSA_ltm_method());
	ENGINE_set_DH(engine, DH_sf_method());
	ENGINE_set_DSA(engine, DSA_null_method());
#elif defined(HEIM_HC_LTM)
	ENGINE_set_RSA(engine, RSA_ltm_method());
	ENGINE_set_DH(engine, DH_ltm_method());
	ENGINE_set_DSA(engine, DSA_null_method());
#else
	ENGINE_set_RSA(engine, RSA_tfm_method());
	ENGINE_set_DH(engine, DH_tfm_method());
	ENGINE_set_DSA(engine, DSA_null_method());
#endif

	ret = add_engine(engine);
	if (ret != 1) {
		ENGINE_finish(engine);
	}

#if !defined(PR_10783242_FIXED) || !defined(PR_8174774_FIXED) || !defined(PR_1048850_FIXED) || !defined(PR_10771223_FIXED) || !defined(PR_10771188_FIXED)

	/*
	 * EAY
	 */
	engine = ENGINE_new();
	if (engine == NULL) {
		return;
	}

	ENGINE_set_id(engine, "eay");
	ENGINE_set_name(engine,
	    "ossl eay engine version " PACKAGE_VERSION);
	ENGINE_set_RSA(engine, RSA_eay_method());
	ENGINE_set_DH(engine, DH_eay_method());
	ENGINE_set_DSA(engine, DSA_eay_method());

	ret = add_engine(engine);
	if (ret != 1) {
		ENGINE_finish(engine);
	}
#endif

#if defined(HAVE_COMMONCRYPTO_COMMONRSACRYPTOR_H) && defined(HAVE_COMMONCRYPTO_COMMONDH_H) && defined(HAVE_COMMONCRYPTO_COMMONDSACRYPTOR_H)

	/*
	 * CC
	 */
	engine = ENGINE_new();
	if (engine == NULL) {
		return;
	}

	ENGINE_set_id(engine, "cc");
	ENGINE_set_name(engine,
	    "ossl cc engine version " PACKAGE_VERSION);
	ENGINE_set_RSA(engine, RSA_cc_method());
	ENGINE_set_DH(engine, DH_cc_method());
	ENGINE_set_DSA(engine, DSA_eay_method());

	ret = add_engine(engine);
	if (ret != 1) {
		ENGINE_finish(engine);
	}
#endif  /* COMMONCRYPTO */

#ifdef USE_HCRYPTO_TFM

	/*
	 * TFM
	 */

	engine = ENGINE_new();
	if (engine == NULL) {
		return;
	}

	ENGINE_set_id(engine, "tfm");
	ENGINE_set_name(engine,
	    "ossl tfm engine version " PACKAGE_VERSION);
	ENGINE_set_RSA(engine, RSA_tfm_method());
	ENGINE_set_DH(engine, DH_tfm_method());

	ret = add_engine(engine);
	if (ret != 1) {
		ENGINE_finish(engine);
	}
#endif  /* USE_HCRYPTO_TFM */

#ifdef USE_HCRYPTO_LTM

	/*
	 * ltm
	 */

	engine = ENGINE_new();
	if (engine == NULL) {
		return;
	}

	ENGINE_set_id(engine, "ltm");
	ENGINE_set_name(engine,
	    "ossl ltm engine version " PACKAGE_VERSION);
	ENGINE_set_RSA(engine, RSA_ltm_method());
	ENGINE_set_DH(engine, DH_ltm_method());

	ret = add_engine(engine);
	if (ret != 1) {
		ENGINE_finish(engine);
	}
#endif

#ifdef HAVE_GMP

	/*
	 * gmp
	 */

	engine = ENGINE_new();
	if (engine == NULL) {
		return;
	}

	ENGINE_set_id(engine, "gmp");
	ENGINE_set_name(engine,
	    "ossl gmp engine version " PACKAGE_VERSION);
	ENGINE_set_RSA(engine, RSA_gmp_method());

	ret = add_engine(engine);
	if (ret != 1) {
		ENGINE_finish(engine);
	}
#endif
}