clear ctx->num in EVP_CipherInit_ex
Submitted by: Emilia Kasper
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 */
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));