add more generate

This commit is contained in:
Love Hornquist Astrand
2010-06-01 15:07:07 -07:00
parent 8bb2de2e3f
commit 661ce3d1a4

View File

@@ -56,6 +56,23 @@ struct hc_engine {
const RAND_METHOD *rand; const RAND_METHOD *rand;
}; };
ENGINE *
ENGINE_new(void)
{
ENGINE *engine;
engine = calloc(1, sizeof(*engine));
engine->references = 1;
return engine;
}
int
ENGINE_free(ENGINE *engine)
{
}
int int
ENGINE_finish(ENGINE *engine) ENGINE_finish(ENGINE *engine)
{ {
@@ -195,10 +212,8 @@ add_engine(ENGINE *engine)
ENGINE **d, *dup; ENGINE **d, *dup;
dup = ENGINE_by_id(engine->id); dup = ENGINE_by_id(engine->id);
if (dup) { if (dup)
ENGINE_finish(dup);
return 0; return 0;
}
d = realloc(engines, (num_engines + 1) * sizeof(*engines)); d = realloc(engines, (num_engines + 1) * sizeof(*engines));
if (d == NULL) if (d == NULL)
@@ -215,7 +230,7 @@ ENGINE_load_builtin_engines(void)
ENGINE *engine; ENGINE *engine;
int ret; int ret;
engine = calloc(1, sizeof(*engine)); engine = ENGINE_new();
if (engine == NULL) if (engine == NULL)
return; return;
@@ -228,6 +243,43 @@ ENGINE_load_builtin_engines(void)
ret = add_engine(engine); ret = add_engine(engine);
if (ret != 1) if (ret != 1)
ENGINE_finish(engine); ENGINE_finish(engine);
/*
* 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);
/*
* imath
*/
engine = ENGINE_new();
if (engine == NULL)
return;
ENGINE_set_id(engine, "imath");
ENGINE_set_name(engine,
"Heimdal crypto imath engine version " PACKAGE_VERSION);
ENGINE_set_RSA(engine, RSA_imath_method());
ENGINE_set_DH(engine, DH_imath_method());
ret = add_engine(engine);
if (ret != 1)
ENGINE_finish(engine);
} }
ENGINE * ENGINE *