summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2011-10-13 13:42:29 +0000
committerBodo Möller <bodo@openssl.org>2011-10-13 13:42:29 +0000
commit93ff4c69f726ea10282d7167752e9be6cf1bda0a (patch)
tree1beba23c7d54df7b57e8d0be4f3c26574b66fea1 /crypto
parent79571bb1cad47143b6783ed1436412ae0ea9c938 (diff)
Make CTR mode behaviour consistent with other modes:
clear ctx->num in EVP_CipherInit_ex Submitted by: Emilia Kasper
Diffstat (limited to 'crypto')
-rw-r--r--crypto/evp/evp.h2
-rw-r--r--crypto/evp/evp_enc.c1
2 files changed, 2 insertions, 1 deletions
diff --git a/crypto/evp/evp.h b/crypto/evp/evp.h
index 49d2240883..0d1b20a7d3 100644
--- a/crypto/evp/evp.h
+++ b/crypto/evp/evp.h
@@ -419,7 +419,7 @@ struct evp_cipher_ctx_st
unsigned char oiv[EVP_MAX_IV_LENGTH]; /* original iv */
unsigned char iv[EVP_MAX_IV_LENGTH]; /* working iv */
unsigned char buf[EVP_MAX_BLOCK_LENGTH];/* saved partial block */
- int num; /* used by cfb/ofb mode */
+ int num; /* used by cfb/ofb/ctr mode */
void *app_data; /* application stuff */
int key_len; /* May change for variable length cipher */
diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c
index a816eb76b1..8828327d92 100644
--- a/crypto/evp/evp_enc.c
+++ b/crypto/evp/evp_enc.c
@@ -232,6 +232,7 @@ skip_to_init:
break;
case EVP_CIPH_CTR_MODE:
+ ctx->num = 0;
/* Don't reuse IV for CTR mode */
if(iv)
memcpy(ctx->iv, iv, EVP_CIPHER_CTX_iv_length(ctx));