diff options
Diffstat (limited to 'lib/libssl/src/demos/maurice/example1.c')
| -rw-r--r-- | lib/libssl/src/demos/maurice/example1.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/libssl/src/demos/maurice/example1.c b/lib/libssl/src/demos/maurice/example1.c index 0e70523a336..1ef82999006 100644 --- a/lib/libssl/src/demos/maurice/example1.c +++ b/lib/libssl/src/demos/maurice/example1.c @@ -72,7 +72,7 @@ void main_encrypt(void) pubKey[0] = ReadPublicKey(PUBFILE); - if(!pubKey) + if(!pubKey[0]) { fprintf(stderr,"Error: can't load public key"); exit(1); @@ -126,11 +126,11 @@ void main_encrypt(void) void main_decrypt(void) { - char buf[512]; + char buf[520]; char ebuf[512]; unsigned int buflen; EVP_CIPHER_CTX ectx; - unsigned char iv[8]; + unsigned char iv[EVP_MAX_IV_LENGTH]; unsigned char *encryptKey; unsigned int ekeylen; EVP_PKEY *privateKey; @@ -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); } |
