From 05690cd479ec4ed9646afbc764f0dcb264b861e8 Mon Sep 17 00:00:00 2001 From: Mouse Date: Tue, 27 Jun 2017 18:32:32 -0400 Subject: [PATCH] Fix compiler warnings --- gost12sum.c | 4 ++-- gost_ameth.c | 8 ++++---- gost_ec_keyx.c | 1 - gost_grasshopper_cipher.c | 1 - 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/gost12sum.c b/gost12sum.c index d6a50ed..f59bc05 100644 --- a/gost12sum.c +++ b/gost12sum.c @@ -216,7 +216,7 @@ int hash_stream(gost_hash_ctx * ctx, int fd, char *sum) unsigned char buffer[BUF_SIZE]; unsigned char reverted_buffer[BUF_SIZE]; ssize_t bytes; - int i, j, k; + start_hash12(ctx); while ((bytes = read(fd, buffer, BUF_SIZE)) > 0) { hash12_block(ctx, reverted_buffer, bytes); @@ -225,7 +225,7 @@ int hash_stream(gost_hash_ctx * ctx, int fd, char *sum) return 0; } finish_hash12(ctx, buffer); - for (i = 0; i < (hashsize / 8); i++) { + for (size_t i = 0; i < (hashsize / 8); i++) { sprintf(sum + 2 * i, "%02x", buffer[i]); } return 1; diff --git a/gost_ameth.c b/gost_ameth.c index b2333a4..005fbf7 100644 --- a/gost_ameth.c +++ b/gost_ameth.c @@ -641,11 +641,11 @@ static int pub_decode_gost_ec(EVP_PKEY *pk, X509_PUBKEY *pub) const unsigned char *pubkey_buf = NULL; unsigned char *databuf; ASN1_OBJECT *palgobj = NULL; - int pub_len, i, j; + int pub_len; EC_POINT *pub_key; BIGNUM *X, *Y; ASN1_OCTET_STRING *octet = NULL; - int len; + size_t len; const EC_GROUP *group; if (!X509_PUBKEY_get0_param(&palgobj, &pubkey_buf, &pub_len, &palg, pub)) @@ -698,8 +698,8 @@ static int pub_encode_gost_ec(X509_PUBKEY *pub, const EVP_PKEY *pk) ASN1_OBJECT *algobj = NULL; ASN1_OCTET_STRING *octet = NULL; void *pval = NULL; - unsigned char *buf = NULL, *databuf = NULL, *sptr; - int i, j, data_len, ret = -1; + unsigned char *buf = NULL, *databuf = NULL; + int data_len, ret = -1; const EC_POINT *pub_key; BIGNUM *X = NULL, *Y = NULL, *order = NULL; const EC_KEY *ec = EVP_PKEY_get0((EVP_PKEY *)pk); diff --git a/gost_ec_keyx.c b/gost_ec_keyx.c index 0684676..30d8e58 100644 --- a/gost_ec_keyx.c +++ b/gost_ec_keyx.c @@ -26,7 +26,6 @@ static int VKO_compute_key(unsigned char *shared_key, size_t shared_key_size, BIGNUM *UKM = NULL, *p = NULL, *order = NULL, *X = NULL, *Y = NULL; const BIGNUM *key = EC_KEY_get0_private_key(priv_key); EC_POINT *pnt = EC_POINT_new(EC_KEY_get0_group(priv_key)); - int i; BN_CTX *ctx = BN_CTX_new(); EVP_MD_CTX *mdctx = NULL; const EVP_MD *md = NULL; diff --git a/gost_grasshopper_cipher.c b/gost_grasshopper_cipher.c index b33fe53..23ba575 100644 --- a/gost_grasshopper_cipher.c +++ b/gost_grasshopper_cipher.c @@ -526,7 +526,6 @@ int gost_grasshopper_cipher_cleanup(EVP_CIPHER_CTX* ctx) { int gost_grasshopper_set_asn1_parameters(EVP_CIPHER_CTX* ctx, ASN1_TYPE* params) { int len = 0; unsigned char* buf = NULL; - unsigned char* p = NULL; ASN1_OCTET_STRING* os = NULL; os = ASN1_OCTET_STRING_new(); -- 2.39.2