summaryrefslogtreecommitdiffstats
path: root/crypto/evp
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2017-12-08 15:08:43 -0500
committerRich Salz <rsalz@openssl.org>2017-12-08 15:08:43 -0500
commitc6738fd208c143939b6bb7f7ac2061c0f5ff3272 (patch)
treea270d65f499b082d936057e1201acf76c98f570a /crypto/evp
parenta1daedd88445397a4aebf22ba63e92c3f1977870 (diff)
Standardize syntax around sizeof(foo)
Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4875)
Diffstat (limited to 'crypto/evp')
-rw-r--r--crypto/evp/digest.c8
-rw-r--r--crypto/evp/evp_enc.c10
-rw-r--r--crypto/evp/evp_pbe.c4
-rwxr-xr-xcrypto/evp/evp_test.c2
-rw-r--r--crypto/evp/openbsd_hw.c6
-rw-r--r--crypto/evp/p5_crpt2.c2
6 files changed, 16 insertions, 16 deletions
diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c
index 4db179629d..d4274c5729 100644
--- a/crypto/evp/digest.c
+++ b/crypto/evp/digest.c
@@ -124,12 +124,12 @@
void EVP_MD_CTX_init(EVP_MD_CTX *ctx)
{
- memset(ctx, '\0', sizeof *ctx);
+ memset(ctx, '\0', sizeof(*ctx));
}
EVP_MD_CTX *EVP_MD_CTX_create(void)
{
- EVP_MD_CTX *ctx = OPENSSL_malloc(sizeof *ctx);
+ EVP_MD_CTX *ctx = OPENSSL_malloc(sizeof(*ctx));
if (ctx)
EVP_MD_CTX_init(ctx);
@@ -316,7 +316,7 @@ int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in)
} else
tmp_buf = NULL;
EVP_MD_CTX_cleanup(out);
- memcpy(out, in, sizeof *out);
+ memcpy(out, in, sizeof(*out));
if (in->md_data && out->digest->ctx_size) {
if (tmp_buf)
@@ -402,7 +402,7 @@ int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx)
#ifdef OPENSSL_FIPS
FIPS_md_ctx_cleanup(ctx);
#endif
- memset(ctx, '\0', sizeof *ctx);
+ memset(ctx, '\0', sizeof(*ctx));
return 1;
}
diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c
index be577bac76..0c740d1679 100644
--- a/crypto/evp/evp_enc.c
+++ b/crypto/evp/evp_enc.c
@@ -85,7 +85,7 @@ void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx)
EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)
{
- EVP_CIPHER_CTX *ctx = OPENSSL_malloc(sizeof *ctx);
+ EVP_CIPHER_CTX *ctx = OPENSSL_malloc(sizeof(*ctx));
if (ctx)
EVP_CIPHER_CTX_init(ctx);
return ctx;
@@ -402,7 +402,7 @@ int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
}
b = ctx->cipher->block_size;
- OPENSSL_assert(b <= sizeof ctx->buf);
+ OPENSSL_assert(b <= sizeof(ctx->buf));
if (b == 1) {
*outl = 0;
return 1;
@@ -454,7 +454,7 @@ int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
return EVP_EncryptUpdate(ctx, out, outl, in, inl);
b = ctx->cipher->block_size;
- OPENSSL_assert(b <= sizeof ctx->final);
+ OPENSSL_assert(b <= sizeof(ctx->final));
if (ctx->final_used) {
memcpy(out, ctx->final, b);
@@ -520,7 +520,7 @@ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
EVPerr(EVP_F_EVP_DECRYPTFINAL_EX, EVP_R_WRONG_FINAL_BLOCK_LENGTH);
return (0);
}
- OPENSSL_assert(b <= sizeof ctx->final);
+ OPENSSL_assert(b <= sizeof(ctx->final));
/*
* The following assumes that the ciphertext has been authenticated.
@@ -651,7 +651,7 @@ int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in)
#endif
EVP_CIPHER_CTX_cleanup(out);
- memcpy(out, in, sizeof *out);
+ memcpy(out, in, sizeof(*out));
if (in->cipher_data && in->cipher->ctx_size) {
out->cipher_data = OPENSSL_malloc(in->cipher->ctx_size);
diff --git a/crypto/evp/evp_pbe.c b/crypto/evp/evp_pbe.c
index 7934c95fad..5d2f04bf9e 100644
--- a/crypto/evp/evp_pbe.c
+++ b/crypto/evp/evp_pbe.c
@@ -161,9 +161,9 @@ int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
char obj_tmp[80];
EVPerr(EVP_F_EVP_PBE_CIPHERINIT, EVP_R_UNKNOWN_PBE_ALGORITHM);
if (!pbe_obj)
- BUF_strlcpy(obj_tmp, "NULL", sizeof obj_tmp);
+ BUF_strlcpy(obj_tmp, "NULL", sizeof(obj_tmp));
else
- i2t_ASN1_OBJECT(obj_tmp, sizeof obj_tmp, pbe_obj);
+ i2t_ASN1_OBJECT(obj_tmp, sizeof(obj_tmp), pbe_obj);
ERR_add_error_data(2, "TYPE=", obj_tmp);
return 0;
}
diff --git a/crypto/evp/evp_test.c b/crypto/evp/evp_test.c
index 98796427bf..97a2083027 100755
--- a/crypto/evp/evp_test.c
+++ b/crypto/evp/evp_test.c
@@ -506,7 +506,7 @@ int main(int argc, char **argv)
int an = 0;
int tn = 0;
- if (!fgets((char *)line, sizeof line, f))
+ if (!fgets((char *)line, sizeof(line), f))
break;
if (line[0] == '#' || line[0] == '\n')
continue;
diff --git a/crypto/evp/openbsd_hw.c b/crypto/evp/openbsd_hw.c
index 07decf2674..24a358e543 100644
--- a/crypto/evp/openbsd_hw.c
+++ b/crypto/evp/openbsd_hw.c
@@ -111,7 +111,7 @@ static int dev_crypto_init(session_op *ses)
close(cryptodev_fd);
}
assert(ses);
- memset(ses, '\0', sizeof *ses);
+ memset(ses, '\0', sizeof(*ses));
return 1;
}
@@ -164,7 +164,7 @@ static int dev_crypto_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
assert(CDATA(ctx));
assert(!dev_failed);
- memset(&cryp, '\0', sizeof cryp);
+ memset(&cryp, '\0', sizeof(cryp));
cryp.ses = CDATA(ctx)->ses;
cryp.op = ctx->encrypt ? COP_ENCRYPT : COP_DECRYPT;
cryp.flags = 0;
@@ -329,7 +329,7 @@ static int do_digest(int ses, unsigned char *md, const void *data, int len)
return 1;
}
- memset(&cryp, '\0', sizeof cryp);
+ memset(&cryp, '\0', sizeof(cryp));
cryp.ses = ses;
cryp.op = COP_ENCRYPT; /* required to do the MAC rather than check
* it */
diff --git a/crypto/evp/p5_crpt2.c b/crypto/evp/p5_crpt2.c
index f2ae1e5790..46fefa9ad5 100644
--- a/crypto/evp/p5_crpt2.c
+++ b/crypto/evp/p5_crpt2.c
@@ -262,7 +262,7 @@ int PKCS5_v2_PBKDF2_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass,
goto err;
}
keylen = EVP_CIPHER_CTX_key_length(ctx);
- OPENSSL_assert(keylen <= sizeof key);
+ OPENSSL_assert(keylen <= sizeof(key));
/* Decode parameter */