void ENGINE_register_all_EC() { ENGINE *e; for (e = ENGINE_get_first(); e; e = ENGINE_get_next(e)) ENGINE_register_EC(e); }
static void resume_engine(void *ctx,int mem) { ENGINE *e=(ENGINE *)ctx; if(mem&0x01)ENGINE_register_RSA(e); if(mem&0x02)ENGINE_register_DSA(e); #if OPENSSL_VERSION_NUMBER >= 0x1010000fL if(mem&0x04)ENGINE_register_EC(e); #else if(mem&0x04)ENGINE_register_ECDH(e); if(mem&0x08)ENGINE_register_ECDSA(e); #endif if(mem&0x10)ENGINE_register_DH(e); if(mem&0x20)ENGINE_register_RAND(e); }
ERL_NIF_TERM engine_register_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) {/* (Engine, EngineMethod) */ #ifdef HAS_ENGINE_SUPPORT struct engine_ctx *ctx; unsigned int method; // Get Engine ASSERT(argc == 2); if (!enif_get_resource(env, argv[0], engine_ctx_rtype, (void**)&ctx)) goto bad_arg; if (!enif_get_uint(env, argv[1], &method)) goto bad_arg; switch(method) { #ifdef ENGINE_METHOD_RSA case ENGINE_METHOD_RSA: if (!ENGINE_register_RSA(ctx->engine)) goto failed; break; #endif #ifdef ENGINE_METHOD_DSA case ENGINE_METHOD_DSA: if (!ENGINE_register_DSA(ctx->engine)) goto failed; break; #endif #ifdef ENGINE_METHOD_DH case ENGINE_METHOD_DH: if (!ENGINE_register_DH(ctx->engine)) goto failed; break; #endif #ifdef ENGINE_METHOD_RAND case ENGINE_METHOD_RAND: if (!ENGINE_register_RAND(ctx->engine)) goto failed; break; #endif #ifdef ENGINE_METHOD_ECDH case ENGINE_METHOD_ECDH: if (!ENGINE_register_ECDH(ctx->engine)) goto failed; break; #endif #ifdef ENGINE_METHOD_ECDSA case ENGINE_METHOD_ECDSA: if (!ENGINE_register_ECDSA(ctx->engine)) goto failed; break; #endif #ifdef ENGINE_METHOD_STORE case ENGINE_METHOD_STORE: if (!ENGINE_register_STORE(ctx->engine)) goto failed; break; #endif #ifdef ENGINE_METHOD_CIPHERS case ENGINE_METHOD_CIPHERS: if (!ENGINE_register_ciphers(ctx->engine)) goto failed; break; #endif #ifdef ENGINE_METHOD_DIGESTS case ENGINE_METHOD_DIGESTS: if (!ENGINE_register_digests(ctx->engine)) goto failed; break; #endif #ifdef ENGINE_METHOD_PKEY_METHS case ENGINE_METHOD_PKEY_METHS: if (!ENGINE_register_pkey_meths(ctx->engine)) goto failed; break; #endif #ifdef ENGINE_METHOD_PKEY_ASN1_METHS case ENGINE_METHOD_PKEY_ASN1_METHS: if (!ENGINE_register_pkey_asn1_meths(ctx->engine)) goto failed; break; #endif #ifdef ENGINE_METHOD_EC case ENGINE_METHOD_EC: if (!ENGINE_register_EC(ctx->engine)) goto failed; break; #endif default: return ERROR_Atom(env, "engine_method_not_supported"); } return atom_ok; bad_arg: return enif_make_badarg(env); failed: return ERROR_Atom(env, "register_engine_failed"); #else return atom_notsup; #endif }