summaryrefslogtreecommitdiffstats
path: root/crypto/engine
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2015-05-04 18:00:15 -0400
committerRich Salz <rsalz@openssl.org>2015-05-05 22:18:59 -0400
commit16f8d4ebf0fd4847fa83d9c61f4150273cb4f533 (patch)
tree3c30094cad38433c24008c30efe3d93cf38d8ae9 /crypto/engine
parent12048657a91b12e499d03ec9ff406b42aba67366 (diff)
memset, memcpy, sizeof consistency fixes
Just as with the OPENSSL_malloc calls, consistently use sizeof(*ptr) for memset and memcpy. Remove needless casts for those functions. For memset, replace alternative forms of zero with 0. Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/engine')
-rw-r--r--crypto/engine/eng_cryptodev.c14
-rw-r--r--crypto/engine/eng_dyn.c2
-rw-r--r--crypto/engine/eng_lib.c2
3 files changed, 9 insertions, 9 deletions
diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c
index d801ae8f1c..49a398964b 100644
--- a/crypto/engine/eng_cryptodev.c
+++ b/crypto/engine/eng_cryptodev.c
@@ -478,7 +478,7 @@ cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
return (0);
}
- memset(sess, 0, sizeof(struct session_op));
+ memset(sess, 0, sizeof(*sess));
if ((state->d_fd = get_dev_crypto()) < 0)
return (0);
@@ -770,7 +770,7 @@ static int cryptodev_digest_init(EVP_MD_CTX *ctx)
return (0);
}
- memset(state, 0, sizeof(struct dev_crypto_state));
+ memset(state, 0, sizeof(*state));
if ((state->d_fd = get_dev_crypto()) < 0) {
printf("cryptodev_digest_init: Can't get Dev \n");
@@ -1115,7 +1115,7 @@ cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
return (ret);
}
- memset(&kop, 0, sizeof kop);
+ memset(&kop, 0, sizeof(kop));
kop.crk_op = CRK_MOD_EXP;
/* inputs: a^p % m */
@@ -1166,7 +1166,7 @@ cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
return (0);
}
- memset(&kop, 0, sizeof kop);
+ memset(&kop, 0, sizeof(kop));
kop.crk_op = CRK_MOD_EXP_CRT;
/* inputs: rsa->p rsa->q I rsa->dmp1 rsa->dmq1 rsa->iqmp */
if (bn2crparam(rsa->p, &kop.crk_param[0]))
@@ -1269,7 +1269,7 @@ static DSA_SIG *cryptodev_dsa_do_sign(const unsigned char *dgst, int dlen,
goto err;
}
- memset(&kop, 0, sizeof kop);
+ memset(&kop, 0, sizeof(kop));
kop.crk_op = CRK_DSA_SIGN;
/* inputs: dgst dsa->p dsa->q dsa->g dsa->priv_key */
@@ -1309,7 +1309,7 @@ cryptodev_dsa_verify(const unsigned char *dgst, int dlen,
struct crypt_kop kop;
int dsaret = 1;
- memset(&kop, 0, sizeof kop);
+ memset(&kop, 0, sizeof(kop));
kop.crk_op = CRK_DSA_VERIFY;
/* inputs: dgst dsa->p dsa->q dsa->g dsa->pub_key sig->r sig->s */
@@ -1382,7 +1382,7 @@ cryptodev_dh_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
keylen = BN_num_bits(dh->p);
- memset(&kop, 0, sizeof kop);
+ memset(&kop, 0, sizeof(kop));
kop.crk_op = CRK_DH_COMPUTE_KEY;
/* inputs: dh->priv_key pub_key dh->p key */
diff --git a/crypto/engine/eng_dyn.c b/crypto/engine/eng_dyn.c
index ed1c220525..06a7018351 100644
--- a/crypto/engine/eng_dyn.c
+++ b/crypto/engine/eng_dyn.c
@@ -208,7 +208,7 @@ static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx)
ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX, ERR_R_MALLOC_FAILURE);
return 0;
}
- memset(c, 0, sizeof(dynamic_data_ctx));
+ memset(c, 0, sizeof(*c));
c->dynamic_dso = NULL;
c->v_check = NULL;
c->bind_engine = NULL;
diff --git a/crypto/engine/eng_lib.c b/crypto/engine/eng_lib.c
index 3bf06bb52b..c477c7efc5 100644
--- a/crypto/engine/eng_lib.c
+++ b/crypto/engine/eng_lib.c
@@ -71,7 +71,7 @@ ENGINE *ENGINE_new(void)
ENGINEerr(ENGINE_F_ENGINE_NEW, ERR_R_MALLOC_FAILURE);
return NULL;
}
- memset(ret, 0, sizeof(ENGINE));
+ memset(ret, 0, sizeof(*ret));
ret->struct_ref = 1;
engine_ref_debug(ret, 0, 1)
CRYPTO_new_ex_data(CRYPTO_EX_INDEX_ENGINE, ret, &ret->ex_data);