#if 0
DH_METHOD *meth;
#else
- struct engine_st *handle;
+ struct engine_st *engine;
#endif
};
DH_METHOD *DH_set_method(DH *dh, DH_METHOD *meth);
DH *DH_new_method(DH_METHOD *meth);
#else
-int DH_set_method(DH *dh, struct engine_st *h);
-DH *DH_new_method(struct engine_st *handle);
+int DH_set_method(DH *dh, struct engine_st *engine);
+DH *DH_new_method(struct engine_st *engine);
#endif
DH * DH_new(void);
int DH_generate_key(DH *dh)
{
- return ENGINE_get_DH(dh->handle)->generate_key(dh);
+ return ENGINE_get_DH(dh->engine)->generate_key(dh);
}
int DH_compute_key(unsigned char *key, BIGNUM *pub_key, DH *dh)
{
- return ENGINE_get_DH(dh->handle)->compute_key(key, pub_key, dh);
+ return ENGINE_get_DH(dh->engine)->compute_key(key, pub_key, dh);
}
static DH_METHOD dh_ossl = {
}
mont=(BN_MONT_CTX *)dh->method_mont_p;
- if (!ENGINE_get_DH(dh->handle)->bn_mod_exp(dh, pub_key, dh->g,
+ if (!ENGINE_get_DH(dh->engine)->bn_mod_exp(dh, pub_key, dh->g,
priv_key,dh->p,&ctx,mont))
goto err;
}
mont=(BN_MONT_CTX *)dh->method_mont_p;
- if (!ENGINE_get_DH(dh->handle)->bn_mod_exp(dh, tmp, pub_key,
+ if (!ENGINE_get_DH(dh->engine)->bn_mod_exp(dh, tmp, pub_key,
dh->priv_key,dh->p,&ctx,mont))
{
DHerr(DH_F_DH_COMPUTE_KEY,ERR_R_BN_LIB);
return mtmp;
}
#else
-int DH_set_method(DH *dh, ENGINE *h)
+int DH_set_method(DH *dh, ENGINE *engine)
{
ENGINE *mtmp;
DH_METHOD *meth;
- mtmp = dh->handle;
+ mtmp = dh->engine;
meth = ENGINE_get_DH(mtmp);
- if (!ENGINE_init(h))
+ if (!ENGINE_init(engine))
return 0;
if (meth->finish) meth->finish(dh);
- dh->handle = h;
- meth = ENGINE_get_DH(h);
+ dh->engine= engine;
+ meth = ENGINE_get_DH(engine);
if (meth->init) meth->init(dh);
/* SHOULD ERROR CHECK THIS!!! */
ENGINE_finish(mtmp);
#if 0
DH *DH_new_method(DH_METHOD *meth)
#else
-DH *DH_new_method(ENGINE *handle)
+DH *DH_new_method(ENGINE *engine)
#endif
{
DH_METHOD *meth;
DHerr(DH_F_DH_NEW,ERR_R_MALLOC_FAILURE);
return(NULL);
}
- if(handle)
- ret->handle = handle;
+ if(engine)
+ ret->engine = engine;
else
{
- if((ret->handle=ENGINE_get_default_DH()) == NULL)
+ if((ret->engine=ENGINE_get_default_DH()) == NULL)
{
Free(ret);
return NULL;
}
}
- meth = ENGINE_get_DH(ret->handle);
+ meth = ENGINE_get_DH(ret->engine);
ret->pad=0;
ret->version=0;
ret->p=NULL;
CRYPTO_free_ex_data(dh_meth, r, &r->ex_data);
- meth = ENGINE_get_DH(r->handle);
+ meth = ENGINE_get_DH(r->engine);
if(meth->finish) meth->finish(r);
- ENGINE_finish(r->handle);
+ ENGINE_finish(r->engine);
if (r->p != NULL) BN_clear_free(r->p);
if (r->g != NULL) BN_clear_free(r->g);
#if 0
DSA_METHOD *meth;
#else
- struct engine_st *handle;
+ struct engine_st *engine;
#endif
};
#if 0
DSA_METHOD *DSA_set_method(DSA *dsa, DSA_METHOD *);
#else
-int DSA_set_method(DSA *dsa, struct engine_st *);
+int DSA_set_method(DSA *dsa, struct engine_st *engine);
#endif
DSA * DSA_new(void);
#if 0
DSA * DSA_new_method(DSA_METHOD *meth);
#else
-DSA * DSA_new_method(struct engine_st *handle);
+DSA * DSA_new_method(struct engine_st *engine);
#endif
int DSA_size(DSA *);
/* next 4 return -1 on error */
return mtmp;
}
#else
-int DSA_set_method(DSA *dsa, ENGINE *h)
+int DSA_set_method(DSA *dsa, ENGINE *engine)
{
ENGINE *mtmp;
DSA_METHOD *meth;
- mtmp = dsa->handle;
+ mtmp = dsa->engine;
meth = ENGINE_get_DSA(mtmp);
- if (!ENGINE_init(h))
+ if (!ENGINE_init(engine))
return 0;
if (meth->finish) meth->finish(dsa);
- dsa->handle = h;
- meth = ENGINE_get_DSA(h);
+ dsa->engine = engine;
+ meth = ENGINE_get_DSA(engine);
if (meth->init) meth->init(dsa);
/* SHOULD ERROR CHECK THIS!!! */
ENGINE_finish(mtmp);
#if 0
DSA *DSA_new_method(DSA_METHOD *meth)
#else
-DSA *DSA_new_method(ENGINE *handle)
+DSA *DSA_new_method(ENGINE *engine)
#endif
{
DSA_METHOD *meth;
DSAerr(DSA_F_DSA_NEW,ERR_R_MALLOC_FAILURE);
return(NULL);
}
- if(handle)
- ret->handle = handle;
+ if(engine)
+ ret->engine = engine;
else
{
- if((ret->handle=ENGINE_get_default_DSA()) == NULL)
+ if((ret->engine=ENGINE_get_default_DSA()) == NULL)
{
Free(ret);
return NULL;
}
}
- meth = ENGINE_get_DSA(ret->handle);
+ meth = ENGINE_get_DSA(ret->engine);
ret->pad=0;
ret->version=0;
ret->write_params=1;
CRYPTO_free_ex_data(dsa_meth, r, &r->ex_data);
- meth = ENGINE_get_DSA(r->handle);
+ meth = ENGINE_get_DSA(r->engine);
if(meth->finish) meth->finish(r);
- ENGINE_finish(r->handle);
+ ENGINE_finish(r->engine);
if (r->p != NULL) BN_clear_free(r->p);
if (r->q != NULL) BN_clear_free(r->q);
}
/* Compute r = (g^k mod p) mod q */
- if (!ENGINE_get_DSA(dsa->handle)->bn_mod_exp(dsa, r,dsa->g,&k,dsa->p,ctx,
+ if (!ENGINE_get_DSA(dsa->engine)->bn_mod_exp(dsa, r,dsa->g,&k,dsa->p,ctx,
(BN_MONT_CTX *)dsa->method_mont_p)) goto err;
if (!BN_mod(r,r,dsa->q,ctx)) goto err;
if (!BN_mod(&u1,&u1,dsa->q,ctx)) goto err;
#else
{
- if (!ENGINE_get_DSA(dsa->handle)->dsa_mod_exp(dsa, &t1,dsa->g,&u1,dsa->pub_key,&u2,
+ if (!ENGINE_get_DSA(dsa->engine)->dsa_mod_exp(dsa, &t1,dsa->g,&u1,dsa->pub_key,&u2,
dsa->p,ctx,mont)) goto err;
/* BN_copy(&u1,&t1); */
/* let u1 = u1 mod q */
DSA_SIG * DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
{
- return ENGINE_get_DSA(dsa->handle)->dsa_do_sign(dgst, dlen, dsa);
+ return ENGINE_get_DSA(dsa->engine)->dsa_do_sign(dgst, dlen, dsa);
}
int DSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char *sig,
int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
{
- return ENGINE_get_DSA(dsa->handle)->dsa_sign_setup(dsa, ctx_in, kinvp, rp);
+ return ENGINE_get_DSA(dsa->engine)->dsa_sign_setup(dsa, ctx_in, kinvp, rp);
}
int DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig,
DSA *dsa)
{
- return ENGINE_get_DSA(dsa->handle)->dsa_do_verify(dgst, dgst_len, sig, dsa);
+ return ENGINE_get_DSA(dsa->engine)->dsa_do_verify(dgst, dgst_len, sig, dsa);
}
/* data has already been hashed (probably with SHA or SHA-1). */
#if 0
RSA_METHOD *meth;
#else
- struct engine_st *handle;
+ struct engine_st *engine;
#endif
BIGNUM *n;
BIGNUM *e;
#if 0
RSA * RSA_new_method(RSA_METHOD *method);
#else
-RSA * RSA_new_method(struct engine_st *handle);
+RSA * RSA_new_method(struct engine_st *engine);
#endif
int RSA_size(RSA *);
RSA * RSA_generate_key(int bits, unsigned long e,void
#if 0
RSA_METHOD *RSA_set_method(RSA *rsa, RSA_METHOD *meth);
#else
-int RSA_set_method(RSA *rsa, struct engine_st *h);
+int RSA_set_method(RSA *rsa, struct engine_st *engine);
#endif
/* This function needs the memory locking malloc callbacks to be installed */
unsigned char *buf=NULL;
BN_CTX *ctx=NULL;
- meth = ENGINE_get_RSA(rsa->handle);
+ meth = ENGINE_get_RSA(rsa->engine);
BN_init(&f);
BN_init(&ret);
if ((ctx=BN_CTX_new()) == NULL) goto err;
unsigned char *buf=NULL;
BN_CTX *ctx=NULL;
- meth = ENGINE_get_RSA(rsa->handle);
+ meth = ENGINE_get_RSA(rsa->engine);
BN_init(&f);
BN_init(&ret);
unsigned char *buf=NULL;
BN_CTX *ctx=NULL;
- meth = ENGINE_get_RSA(rsa->handle);
+ meth = ENGINE_get_RSA(rsa->engine);
BN_init(&f);
BN_init(&ret);
ctx=BN_CTX_new();
unsigned char *buf=NULL;
BN_CTX *ctx=NULL;
- meth = ENGINE_get_RSA(rsa->handle);
+ meth = ENGINE_get_RSA(rsa->engine);
BN_init(&f);
BN_init(&ret);
ctx=BN_CTX_new();
int ret=0;
BN_CTX *ctx;
- meth = ENGINE_get_RSA(rsa->handle);
+ meth = ENGINE_get_RSA(rsa->engine);
if ((ctx=BN_CTX_new()) == NULL) goto err;
BN_init(&m1);
BN_init(&r1);
RSA_METHOD *RSA_get_method(RSA *rsa)
{
- return ENGINE_get_RSA(rsa->handle);
+ return ENGINE_get_RSA(rsa->engine);
}
#if 0
return mtmp;
}
#else
-int RSA_set_method(RSA *rsa, ENGINE *h)
+int RSA_set_method(RSA *rsa, ENGINE *engine)
{
ENGINE *mtmp;
RSA_METHOD *meth;
- mtmp = rsa->handle;
+ mtmp = rsa->engine;
meth = ENGINE_get_RSA(mtmp);
- if (!ENGINE_init(h))
+ if (!ENGINE_init(engine))
return 0;
if (meth->finish) meth->finish(rsa);
- rsa->handle = h;
- meth = ENGINE_get_RSA(h);
+ rsa->engine = engine;
+ meth = ENGINE_get_RSA(engine);
if (meth->init) meth->init(rsa);
/* SHOULD ERROR CHECK THIS!!! */
ENGINE_finish(mtmp);
#if 0
RSA *RSA_new_method(RSA_METHOD *meth)
#else
-RSA *RSA_new_method(ENGINE *handle)
+RSA *RSA_new_method(ENGINE *engine)
#endif
{
RSA_METHOD *meth;
return(NULL);
}
- if (handle == NULL)
+ if (engine == NULL)
{
- if((ret->handle=ENGINE_get_default_RSA()) == NULL)
+ if((ret->engine=ENGINE_get_default_RSA()) == NULL)
{
Free(ret);
return NULL;
}
}
else
- ret->handle=handle;
- meth = ENGINE_get_RSA(ret->handle);
+ ret->engine=engine;
+ meth = ENGINE_get_RSA(ret->engine);
ret->pad=0;
ret->version=0;
CRYPTO_free_ex_data(rsa_meth,r,&r->ex_data);
- meth = ENGINE_get_RSA(r->handle);
+ meth = ENGINE_get_RSA(r->engine);
if (meth->finish != NULL)
meth->finish(r);
- ENGINE_finish(r->handle);
+ ENGINE_finish(r->engine);
if (r->n != NULL) BN_clear_free(r->n);
if (r->e != NULL) BN_clear_free(r->e);
int RSA_public_encrypt(int flen, unsigned char *from, unsigned char *to,
RSA *rsa, int padding)
{
- return(ENGINE_get_RSA(rsa->handle)->rsa_pub_enc(flen,
+ return(ENGINE_get_RSA(rsa->engine)->rsa_pub_enc(flen,
from, to, rsa, padding));
}
int RSA_private_encrypt(int flen, unsigned char *from, unsigned char *to,
RSA *rsa, int padding)
{
- return(ENGINE_get_RSA(rsa->handle)->rsa_priv_enc(flen,
+ return(ENGINE_get_RSA(rsa->engine)->rsa_priv_enc(flen,
from, to, rsa, padding));
}
int RSA_private_decrypt(int flen, unsigned char *from, unsigned char *to,
RSA *rsa, int padding)
{
- return(ENGINE_get_RSA(rsa->handle)->rsa_priv_dec(flen,
+ return(ENGINE_get_RSA(rsa->engine)->rsa_priv_dec(flen,
from, to, rsa, padding));
}
int RSA_public_decrypt(int flen, unsigned char *from, unsigned char *to,
RSA *rsa, int padding)
{
- return(ENGINE_get_RSA(rsa->handle)->rsa_pub_dec(flen,
+ return(ENGINE_get_RSA(rsa->engine)->rsa_pub_dec(flen,
from, to, rsa, padding));
}
int RSA_flags(RSA *r)
{
- return((r == NULL)?0:ENGINE_get_RSA(r->handle)->flags);
+ return((r == NULL)?0:ENGINE_get_RSA(r->engine)->flags);
}
void RSA_blinding_off(RSA *rsa)
if (!BN_rand(A,BN_num_bits(rsa->n)-1,1,0)) goto err;
if ((Ai=BN_mod_inverse(NULL,A,rsa->n,ctx)) == NULL) goto err;
- if (!ENGINE_get_RSA(rsa->handle)->bn_mod_exp(A,A,
+ if (!ENGINE_get_RSA(rsa->engine)->bn_mod_exp(A,A,
rsa->e,rsa->n,ctx,rsa->_method_mod_n))
goto err;
rsa->blinding=BN_BLINDING_new(A,Ai,rsa->n);
X509_ALGOR algor;
ASN1_OCTET_STRING digest;
if(rsa->flags & RSA_FLAG_SIGN_VER)
- return ENGINE_get_RSA(rsa->handle)->rsa_sign(type,
+ return ENGINE_get_RSA(rsa->engine)->rsa_sign(type,
m, m_len, sigret, siglen, rsa);
/* Special case: SSL signature, just check the length */
if(type == NID_md5_sha1) {
}
if(rsa->flags & RSA_FLAG_SIGN_VER)
- return ENGINE_get_RSA(rsa->handle)->rsa_verify(dtype,
+ return ENGINE_get_RSA(rsa->engine)->rsa_verify(dtype,
m, m_len, sigbuf, siglen, rsa);
s=(unsigned char *)Malloc((unsigned int)siglen);