示例#1
0
static int bind_helper(ENGINE *e)
{
    fprintf(stderr, "arrive at bind_helper\n");
	if(!ENGINE_set_id(e, engine_hwdev_id) ||
	   !ENGINE_set_name(e, engine_hwdev_name) ||
	   !ENGINE_set_ECDH(e, &ecdh_meth) ||
	   !ENGINE_set_destroy_function(e, hwdev_destroy) ||
	   !ENGINE_set_init_function(e, hwdev_init) ||
	   !ENGINE_set_finish_function(e, hwdev_finish) ||
	   !ENGINE_set_ctrl_function(e, hwdev_ctrl) ||
	   !ENGINE_set_load_privkey_function(e, hwdev_load_privkey) ||
	   !ENGINE_set_load_pubkey_function(e, hwdev_load_pubkey) ||
	   !ENGINE_set_cmd_defns(e, hwdev_cmd_defns))
		return 0;

	return 1;
}
示例#2
0
/* This internal function is used by ENGINE_tpm() and possibly by the
 * "dynamic" ENGINE support too */
static int bind_helper(ENGINE * e)
{
	if (!ENGINE_set_id(e, engine_tpm_id) ||
	    !ENGINE_set_name(e, engine_tpm_name) ||
#ifndef OPENSSL_NO_RSA
	    !ENGINE_set_RSA(e, &tpm_rsa) ||
#endif
	    !ENGINE_set_RAND(e, &tpm_rand) ||
	    !ENGINE_set_destroy_function(e, tpm_engine_destroy) ||
	    !ENGINE_set_init_function(e, tpm_engine_init) ||
	    !ENGINE_set_finish_function(e, tpm_engine_finish) ||
	    !ENGINE_set_ctrl_function(e, tpm_engine_ctrl) ||
	    !ENGINE_set_load_pubkey_function(e, tpm_engine_load_key) ||
	    !ENGINE_set_load_privkey_function(e, tpm_engine_load_key) ||
	    !ENGINE_set_cmd_defns(e, tpm_cmd_defns))
		return 0;

	/* Ensure the tpm error handling is set up */
	ERR_load_TPM_strings();
	return 1;
}
示例#3
0
/* ---------------------*/
static int bind_helper(ENGINE *e)
{
    if (!ENGINE_set_id(e, engine_4758_cca_id) ||
        !ENGINE_set_name(e, engine_4758_cca_name) ||
#  ifndef OPENSSL_NO_RSA
        !ENGINE_set_RSA(e, &ibm_4758_cca_rsa) ||
#  endif
        !ENGINE_set_RAND(e, &ibm_4758_cca_rand) ||
        !ENGINE_set_destroy_function(e, ibm_4758_cca_destroy) ||
        !ENGINE_set_init_function(e, ibm_4758_cca_init) ||
        !ENGINE_set_finish_function(e, ibm_4758_cca_finish) ||
        !ENGINE_set_ctrl_function(e, ibm_4758_cca_ctrl) ||
#  ifndef OPENSSL_NO_RSA
        !ENGINE_set_load_privkey_function(e, ibm_4758_load_privkey) ||
        !ENGINE_set_load_pubkey_function(e, ibm_4758_load_pubkey) ||
#  endif
        !ENGINE_set_cmd_defns(e, cca4758_cmd_defns))
        return 0;
    /* Ensure the error handling is set up */
    ERR_load_CCA4758_strings();
    return 1;
}
示例#4
0
/*
 * This internal function is used by ENGINE_skf() and possibly by the
 * "dynamic" ENGINE support too
 */
static int bind_helper(ENGINE *e)
{
#  ifndef OPENSSL_NO_RSA
    const RSA_METHOD *meth1;
#  endif
    if (!ENGINE_set_id(e, engine_hwskf_id) ||
        !ENGINE_set_name(e, engine_hwskf_name) ||
        
        !ENGINE_set_destroy_function(e, hwskf_destroy) ||
        !ENGINE_set_init_function(e, hwskf_init) ||
        !ENGINE_set_finish_function(e, hwskf_finish) ||
        !ENGINE_set_ctrl_function(e, hwskf_ctrl) ||
        !ENGINE_set_load_privkey_function(e, hwskf_load_privkey) ||
        !ENGINE_set_load_pubkey_function(e, hwskf_load_pubkey) ||
        !ENGINE_set_cmd_defns(e, hwskf_cmd_defns))
        return 0;

#  ifndef OPENSSL_NO_RSA
    /*
     * We know that the "PKCS1_SSLeay()" functions hook properly to the
     * cswift-specific mod_exp and mod_exp_crt so we use those functions. NB:
     * We don't use ENGINE_openssl() or anything "more generic" because
     * something like the RSAref code may not hook properly, and if you own
     * one of these cards then you have the right to do RSA operations on it
     * anyway!
     */
     /*
    meth1 = RSA_PKCS1_SSLeay();
    hwskf_rsa.rsa_pub_enc = meth1->rsa_pub_enc;
    hwskf_rsa.rsa_pub_dec = meth1->rsa_pub_dec;
    hwskf_rsa.rsa_priv_enc = meth1->rsa_priv_enc;
    hwskf_rsa.rsa_priv_dec = meth1->rsa_priv_dec;
    */
#  endif

    /* Ensure the hwcrhk error handling is set up */
    //ERR_load_HWSKF_strings();
    return 1;
}
示例#5
0
文件: HCSP.c 项目: alepharchives/ULib
static int bind_HCSP(ENGINE* e)
{
   if (!ENGINE_set_id(e, engine_HCSP_id)
    || !ENGINE_set_name(e, engine_HCSP_name)
    || !ENGINE_set_RSA(e, &HCSP_rsa)
    || !ENGINE_set_destroy_function(e, HCSP_destroy)
    || !ENGINE_set_init_function(e, HCSP_init)
    || !ENGINE_set_finish_function(e, HCSP_finish)
    || !ENGINE_set_load_pubkey_function(e, HCSP_load_key)
    || !ENGINE_set_load_privkey_function(e, HCSP_load_key)
#ifdef FILE_CONFIG
    || !ENGINE_set_ctrl_function(e, HCSP_ctrl)
    || !ENGINE_set_cmd_defns(e, HCSP_cmd_defns)
#endif
   ) return 0;

   /* Ensure the rsaref error handling is set up */

#ifndef OPENSSL_NO_ERR
   ERR_load_HCSP_strings();
#endif

   return 1;
}
示例#6
0
/* As this is only ever called once, there's no need for locking
 * (indeed - the lock will already be held by our caller!!!) */
static int bind_sureware(ENGINE *e)
{
#ifndef OPENSSL_NO_RSA
    const RSA_METHOD *meth1;
#endif
#ifndef OPENSSL_NO_DSA
    const DSA_METHOD *meth2;
#endif
#ifndef OPENSSL_NO_DH
    const DH_METHOD *meth3;
#endif

    if(!ENGINE_set_id(e, engine_sureware_id) ||
            !ENGINE_set_name(e, engine_sureware_name) ||
#ifndef OPENSSL_NO_RSA
            !ENGINE_set_RSA(e, &surewarehk_rsa) ||
#endif
#ifndef OPENSSL_NO_DSA
            !ENGINE_set_DSA(e, &surewarehk_dsa) ||
#endif
#ifndef OPENSSL_NO_DH
            !ENGINE_set_DH(e, &surewarehk_dh) ||
#endif
            !ENGINE_set_RAND(e, &surewarehk_rand) ||
            !ENGINE_set_destroy_function(e, surewarehk_destroy) ||
            !ENGINE_set_init_function(e, surewarehk_init) ||
            !ENGINE_set_finish_function(e, surewarehk_finish) ||
            !ENGINE_set_ctrl_function(e, (ENGINE_CTRL_FUNC_PTR)surewarehk_ctrl) ||
            !ENGINE_set_load_privkey_function(e, surewarehk_load_privkey) ||
            !ENGINE_set_load_pubkey_function(e, surewarehk_load_pubkey))
        return 0;

#ifndef OPENSSL_NO_RSA
    /* We know that the "PKCS1_SSLeay()" functions hook properly
     * to the cswift-specific mod_exp and mod_exp_crt so we use
     * those functions. NB: We don't use ENGINE_openssl() or
     * anything "more generic" because something like the RSAref
     * code may not hook properly, and if you own one of these
     * cards then you have the right to do RSA operations on it
     * anyway! */
    meth1 = RSA_PKCS1_SSLeay();
    if (meth1)
    {
        surewarehk_rsa.rsa_pub_enc = meth1->rsa_pub_enc;
        surewarehk_rsa.rsa_pub_dec = meth1->rsa_pub_dec;
    }
#endif

#ifndef OPENSSL_NO_DSA
    /* Use the DSA_OpenSSL() method and just hook the mod_exp-ish
     * bits. */
    meth2 = DSA_OpenSSL();
    if (meth2)
    {
        surewarehk_dsa.dsa_do_verify = meth2->dsa_do_verify;
    }
#endif

#ifndef OPENSSL_NO_DH
    /* Much the same for Diffie-Hellman */
    meth3 = DH_OpenSSL();
    if (meth3)
    {
        surewarehk_dh.generate_key = meth3->generate_key;
        surewarehk_dh.compute_key = meth3->compute_key;
    }
#endif

    /* Ensure the sureware error handling is set up */
    ERR_load_SUREWARE_strings();
    return 1;
}
示例#7
0
文件: e_chil.c 项目: 1234-/openssl
/*
 * This internal function is used by ENGINE_chil() and possibly by the
 * "dynamic" ENGINE support too
 */
static int bind_helper(ENGINE *e)
{
#  ifndef OPENSSL_NO_RSA
    const RSA_METHOD *meth1;
#  endif
#  ifndef OPENSSL_NO_DH
    const DH_METHOD *meth2;
#  endif

    chil_lock = CRYPTO_THREAD_lock_new();
    if (chil_lock == NULL) {
        HWCRHKerr(HWCRHK_F_BIND_HELPER, ERR_R_MALLOC_FAILURE);
        return 0;
    }

    if (!ENGINE_set_id(e, engine_hwcrhk_id) ||
        !ENGINE_set_name(e, engine_hwcrhk_name) ||
#  ifndef OPENSSL_NO_RSA
        !ENGINE_set_RSA(e, &hwcrhk_rsa) ||
#  endif
#  ifndef OPENSSL_NO_DH
        !ENGINE_set_DH(e, &hwcrhk_dh) ||
#  endif
        !ENGINE_set_RAND(e, &hwcrhk_rand) ||
        !ENGINE_set_destroy_function(e, hwcrhk_destroy) ||
        !ENGINE_set_init_function(e, hwcrhk_init) ||
        !ENGINE_set_finish_function(e, hwcrhk_finish) ||
        !ENGINE_set_ctrl_function(e, hwcrhk_ctrl) ||
        !ENGINE_set_load_privkey_function(e, hwcrhk_load_privkey) ||
        !ENGINE_set_load_pubkey_function(e, hwcrhk_load_pubkey) ||
        !ENGINE_set_cmd_defns(e, hwcrhk_cmd_defns))
        return 0;

#  ifndef OPENSSL_NO_RSA
    /*
     * We know that the "PKCS1_OpenSSL()" functions hook properly to the
     * cswift-specific mod_exp and mod_exp_crt so we use those functions. NB:
     * We don't use ENGINE_openssl() or anything "more generic" because
     * something like the RSAref code may not hook properly, and if you own
     * one of these cards then you have the right to do RSA operations on it
     * anyway!
     */
    meth1 = RSA_PKCS1_OpenSSL();
    hwcrhk_rsa.rsa_pub_enc = meth1->rsa_pub_enc;
    hwcrhk_rsa.rsa_pub_dec = meth1->rsa_pub_dec;
    hwcrhk_rsa.rsa_priv_enc = meth1->rsa_priv_enc;
    hwcrhk_rsa.rsa_priv_dec = meth1->rsa_priv_dec;
#  endif

#  ifndef OPENSSL_NO_DH
    /* Much the same for Diffie-Hellman */
    meth2 = DH_OpenSSL();
    hwcrhk_dh.generate_key = meth2->generate_key;
    hwcrhk_dh.compute_key = meth2->compute_key;
#  endif

    /* Ensure the hwcrhk error handling is set up */
    ERR_load_HWCRHK_strings();

    return 1;
}