X-Git-Url: http://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=gost_crypt.c;h=da78e396fd941acc40034f426e7cbd5f79ee3601;hb=8c81c6fde1485fc27f88b4ffbcd8217a294c2215;hp=f60dd0629c763239ef2e49cf113a9977ec094b7f;hpb=2dd3a2f2e9a6286fab4dd80f7f127ce8289bc77e;p=openssl-gost%2Fengine.git diff --git a/gost_crypt.c b/gost_crypt.c index f60dd06..da78e39 100644 --- a/gost_crypt.c +++ b/gost_crypt.c @@ -649,7 +649,7 @@ static void ctr64_inc(unsigned char *counter) static inline void apply_acpkm_magma(struct ossl_gost_cipher_ctx * ctx, unsigned int *num) { - if (!ctx->key_meshing || (*num < ctx->key_meshing)) + if (!ctx->key_meshing || (*num < (unsigned int)ctx->key_meshing)) return; acpkm_magma_key_meshing(&ctx->cctx); *num &= MAGMA_BLOCK_MASK; @@ -767,7 +767,7 @@ static int gost_cipher_do_cfb(EVP_CIPHER_CTX *ctx, unsigned char *out, } } - for (; i + 8 < inl; i += 8, in_ptr += 8, out_ptr += 8) { + for (; (inl - i) >= 8; i += 8, in_ptr += 8, out_ptr += 8) { /* * block cipher current iv */ @@ -828,7 +828,7 @@ static int gost_cipher_do_cnt(EVP_CIPHER_CTX *ctx, unsigned char *out, } } - for (; i + 8 < inl; i += 8, in_ptr += 8, out_ptr += 8) { + for (; (inl - i) >= 8; i += 8, in_ptr += 8, out_ptr += 8) { /* * block cipher current iv */