當前位置: 首頁>>代碼示例>>C++>>正文


C++ ENGINE_finish函數代碼示例

本文整理匯總了C++中ENGINE_finish函數的典型用法代碼示例。如果您正苦於以下問題:C++ ENGINE_finish函數的具體用法?C++ ENGINE_finish怎麽用?C++ ENGINE_finish使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了ENGINE_finish函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: int_engine_module_finish

static void
int_engine_module_finish(CONF_IMODULE *md)
{
	ENGINE *e;

	while ((e = sk_ENGINE_pop(initialized_engines)))
		ENGINE_finish(e);
	sk_ENGINE_free(initialized_engines);
	initialized_engines = NULL;
}
開發者ID:2trill2spill,項目名稱:nextgen,代碼行數:10,代碼來源:eng_cnf.c

示例2: unload_hardware_engine

/* Free memory for the hardware engine */
static void unload_hardware_engine () {
  if (!reng)
    return;

  ENGINE_finish (reng);
  ENGINE_free (reng);
  ENGINE_cleanup ();
  reng = NULL;
  rand_loaded = 0;
}
開發者ID:cjcole,項目名稱:libgolle,代碼行數:11,代碼來源:random.c

示例3: eng_RAND_set_rand_method

int eng_RAND_set_rand_method(const RAND_METHOD *meth, const RAND_METHOD **pmeth)
	{
	if(funct_ref)
		{
		ENGINE_finish(funct_ref);
		funct_ref = NULL;
		}
	*pmeth = meth;
	return 1;
	}
開發者ID:alisw,項目名稱:alice-openssl,代碼行數:10,代碼來源:rand_eng.c

示例4: ossl_engine_finish

/* Document-method: OpenSSL::Engine#finish
 *
 * Releases all internal structural references for this engine.
 *
 * May raise an EngineError if the engine is unavailable
 */
static VALUE
ossl_engine_finish(VALUE self)
{
    ENGINE *e;

    GetEngine(self, e);
    if(!ENGINE_finish(e)) ossl_raise(eEngineError, NULL);

    return Qnil;
}
開發者ID:DashYang,項目名稱:sim,代碼行數:16,代碼來源:ossl_engine.c

示例5: init_gen_str

int init_gen_str(BIO *err, EVP_PKEY_CTX **pctx,
                 const char *algname, ENGINE *e, int do_param)
{
    EVP_PKEY_CTX *ctx = NULL;
    const EVP_PKEY_ASN1_METHOD *ameth;
    ENGINE *tmpeng = NULL;
    int pkey_id;

    if (*pctx) {
        BIO_puts(err, "Algorithm already set!\n");
        return 0;
    }

    ameth = EVP_PKEY_asn1_find_str(&tmpeng, algname, -1);

#ifndef OPENSSL_NO_ENGINE
    if (!ameth && e)
        ameth = ENGINE_get_pkey_asn1_meth_str(e, algname, -1);
#endif

    if (!ameth) {
        BIO_printf(bio_err, "Algorithm %s not found\n", algname);
        return 0;
    }

    ERR_clear_error();

    EVP_PKEY_asn1_get0_info(&pkey_id, NULL, NULL, NULL, NULL, ameth);
#ifndef OPENSSL_NO_ENGINE
    if (tmpeng)
        ENGINE_finish(tmpeng);
#endif
    ctx = EVP_PKEY_CTX_new_id(pkey_id, e);

    if (!ctx)
        goto err;
    if (do_param) {
        if (EVP_PKEY_paramgen_init(ctx) <= 0)
            goto err;
    } else {
        if (EVP_PKEY_keygen_init(ctx) <= 0)
            goto err;
    }

    *pctx = ctx;
    return 1;

 err:
    BIO_printf(err, "Error initializing %s context\n", algname);
    ERR_print_errors(err);
    if (ctx)
        EVP_PKEY_CTX_free(ctx);
    return 0;

}
開發者ID:119120119,項目名稱:node,代碼行數:55,代碼來源:genpkey.c

示例6: pkey_set_type

static int pkey_set_type(EVP_PKEY *pkey, int type, const char *str, int len)
{
    const EVP_PKEY_ASN1_METHOD *ameth;
    ENGINE *e = NULL;
    if (pkey) {
        if (pkey->pkey.ptr)
            EVP_PKEY_free_it(pkey);
        /*
         * If key type matches and a method exists then this lookup has
         * succeeded once so just indicate success.
         */
        if ((type == pkey->save_type) && pkey->ameth)
            return 1;
#ifndef OPENSSL_NO_ENGINE
        /* If we have an ENGINE release it */
        if (pkey->engine) {
            ENGINE_finish(pkey->engine);
            pkey->engine = NULL;
        }
#endif
    }
    if (str)
        ameth = EVP_PKEY_asn1_find_str(&e, str, len);
    else
        ameth = EVP_PKEY_asn1_find(&e, type);
#ifndef OPENSSL_NO_ENGINE
    if (!pkey && e)
        ENGINE_finish(e);
#endif
    if (!ameth) {
        EVPerr(EVP_F_PKEY_SET_TYPE, EVP_R_UNSUPPORTED_ALGORITHM);
        return 0;
    }
    if (pkey) {
        pkey->ameth = ameth;
        pkey->engine = e;

        pkey->type = pkey->ameth->pkey_id;
        pkey->save_type = type;
    }
    return 1;
}
開發者ID:Voxer,項目名稱:openssl,代碼行數:42,代碼來源:p_lib.c

示例7: ASN1err

EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
                         long length)
{
    EVP_PKEY *ret;
    const unsigned char *p = *pp;

    if ((a == NULL) || (*a == NULL)) {
        if ((ret = EVP_PKEY_new()) == NULL) {
            ASN1err(ASN1_F_D2I_PRIVATEKEY, ERR_R_EVP_LIB);
            return (NULL);
        }
    } else {
        ret = *a;
#ifndef OPENSSL_NO_ENGINE
        if (ret->engine) {
            ENGINE_finish(ret->engine);
            ret->engine = NULL;
        }
#endif
    }

    if (!EVP_PKEY_set_type(ret, type)) {
        ASN1err(ASN1_F_D2I_PRIVATEKEY, ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE);
        goto err;
    }

    if (!ret->ameth->old_priv_decode ||
        !ret->ameth->old_priv_decode(ret, &p, length)) {
        if (ret->ameth->priv_decode) {
            EVP_PKEY *tmp;
            PKCS8_PRIV_KEY_INFO *p8 = NULL;
            p8 = d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, length);
            if (!p8)
                goto err;
            tmp = EVP_PKCS82PKEY(p8);
            PKCS8_PRIV_KEY_INFO_free(p8);
            if (tmp == NULL)
                goto err;
            EVP_PKEY_free(ret);
            ret = tmp;
        } else {
            ASN1err(ASN1_F_D2I_PRIVATEKEY, ERR_R_ASN1_LIB);
            goto err;
        }
    }
    *pp = p;
    if (a != NULL)
        (*a) = ret;
    return (ret);
 err:
    if ((ret != NULL) && ((a == NULL) || (*a != ret)))
        EVP_PKEY_free(ret);
    return (NULL);
}
開發者ID:PerfectlySoft,項目名稱:Perfect-OpenSSL,代碼行數:54,代碼來源:d2i_.c

示例8: crypto_cleanup

/**
 * @brief Clean encryption / decryption context.
 * @note After cleanup, a context is free to be reused if necessary.
 * @param f The context to use.
 * @return Returns APR_ENOTIMPL if not supported.
 */
static apr_status_t crypto_cleanup(apr_crypto_t *f)
{

    if (f->config->engine) {
        ENGINE_finish(f->config->engine);
        ENGINE_free(f->config->engine);
        f->config->engine = NULL;
    }
    return APR_SUCCESS;

}
開發者ID:ATCP,項目名稱:mtcp,代碼行數:17,代碼來源:apr_crypto_openssl.c

示例9: RAND_set_rand_method

int RAND_set_rand_method(const RAND_METHOD *meth)
{
#ifndef OPENSSL_NO_ENGINE
    if (funct_ref) {
        ENGINE_finish(funct_ref);
        funct_ref = NULL;
    }
#endif
    default_RAND_meth = meth;
    return 1;
}
開發者ID:GarikRC,項目名稱:openssl,代碼行數:11,代碼來源:rand_lib.c

示例10: EVP_PKEY_free_it

static void EVP_PKEY_free_it(EVP_PKEY *x)
{
    /* internal function; x is never NULL */
    if (x->ameth && x->ameth->pkey_free) {
        x->ameth->pkey_free(x);
        x->pkey.ptr = NULL;
    }
#ifndef OPENSSL_NO_ENGINE
    ENGINE_finish(x->engine);
    x->engine = NULL;
#endif
}
開發者ID:G-P-S,項目名稱:openssl,代碼行數:12,代碼來源:p_lib.c

示例11: EVP_PKEY_free_it

static void EVP_PKEY_free_it(EVP_PKEY *x)
	{
	if (x->ameth && x->ameth->pkey_free)
		x->ameth->pkey_free(x);
#ifndef OPENSSL_NO_ENGINE
	if (x->engine)
		{
		ENGINE_finish(x->engine);
		x->engine = NULL;
		}
#endif
	}
開發者ID:Sorcha,項目名稱:NETMF-LPC,代碼行數:12,代碼來源:p_lib.cpp

示例12: DH_set_method

int
DH_set_method(DH *dh, const DH_METHOD *method)
{
    (*dh->meth->finish)(dh);
    if (dh->engine) {
	ENGINE_finish(dh->engine);
	dh->engine = NULL;
    }
    dh->meth = method;
    (*dh->meth->init)(dh);
    return 1;
}
開發者ID:Henauxg,項目名稱:minix,代碼行數:12,代碼來源:dh.c

示例13: ecdh_data_free

void ecdh_data_free(void *data)
{
    ECDH_DATA *r = (ECDH_DATA *)data;

#ifndef OPENSSL_NO_ENGINE
    if (r->engine)
        ENGINE_finish(r->engine);
#endif

    CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDH, r, &r->ex_data);
    OPENSSL_clear_free((void *)r, sizeof(ECDH_DATA));
}
開發者ID:aeijdenberg,項目名稱:openssl,代碼行數:12,代碼來源:ech_lib.c

示例14: RAND_set_rand_method

int
RAND_set_rand_method(const RAND_METHOD *meth)
{
    const RAND_METHOD *old = selected_meth;
    selected_meth = meth;
    if (old)
	(*old->cleanup)();
    if (selected_engine) {
	ENGINE_finish(selected_engine);
	selected_engine = NULL;
    }
    return 1;
}
開發者ID:elric1,項目名稱:heimdal,代碼行數:13,代碼來源:rand.c

示例15: EVP_PKEY_CTX_free

void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx)
{
    if (ctx == NULL)
        return;
    if (ctx->pmeth && ctx->pmeth->cleanup)
        ctx->pmeth->cleanup(ctx);
    EVP_PKEY_free(ctx->pkey);
    EVP_PKEY_free(ctx->peerkey);
#ifndef OPENSSL_NO_ENGINE
    ENGINE_finish(ctx->engine);
#endif
    OPENSSL_free(ctx);
}
開發者ID:zsdev2015,項目名稱:GmSSL,代碼行數:13,代碼來源:pmeth_lib.c


注:本文中的ENGINE_finish函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。