From 581f1c84940d77451c2592e9fa470893f6c3c3eb Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Wed, 17 Oct 2001 00:37:12 +0000 Subject: Modify EVP cipher behaviour in a similar way to digests to retain compatibility. --- demos/maurice/example1.c | 4 +--- demos/maurice/example3.c | 6 ++++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'demos/maurice') diff --git a/demos/maurice/example1.c b/demos/maurice/example1.c index 4890b69ce5..da2c6d31c5 100644 --- a/demos/maurice/example1.c +++ b/demos/maurice/example1.c @@ -126,7 +126,7 @@ void main_encrypt(void) void main_decrypt(void) { - char buf[512]; + char buf[520]; char ebuf[512]; unsigned int buflen; EVP_CIPHER_CTX ectx; @@ -164,7 +164,6 @@ void main_decrypt(void) read(STDIN, encryptKey, ekeylen); read(STDIN, iv, sizeof(iv)); - EVP_OpenInit(&ectx, EVP_des_ede3_cbc(), encryptKey, @@ -185,7 +184,6 @@ void main_decrypt(void) } EVP_OpenUpdate(&ectx, buf, &buflen, ebuf, readlen); - write(STDOUT, buf, buflen); } diff --git a/demos/maurice/example3.c b/demos/maurice/example3.c index c8462a47c3..03d8a20f62 100644 --- a/demos/maurice/example3.c +++ b/demos/maurice/example3.c @@ -57,7 +57,8 @@ void do_cipher(char *pw, int operation) EVP_BytesToKey(ALG, EVP_md5(), "salu", pw, strlen(pw), 1, key, iv); - EVP_CipherInit(&ectx, ALG, key, iv, operation); + EVP_CIPHER_CTX_init(&ectx); + EVP_CipherInit_ex(&ectx, ALG, NULL, key, iv, operation); while(1) { @@ -79,7 +80,8 @@ void do_cipher(char *pw, int operation) write(STDOUT, ebuf, ebuflen); } - EVP_CipherFinal(&ectx, ebuf, &ebuflen); + EVP_CipherFinal_ex(&ectx, ebuf, &ebuflen); + EVP_CIPHER_CTX_cleanup(&ectx); write(STDOUT, ebuf, ebuflen); } -- cgit v1.2.3