diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2000-05-27 12:38:43 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2000-05-27 12:38:43 +0000 |
commit | be06a9348d83187071270a29aabfe10cc3904f85 (patch) | |
tree | bd19112dbfbaa0b19bd83b1a94e85ad6a794fcdb /crypto/evp | |
parent | 7f0606016cbbec917b1fe094b84b062e87abe7da (diff) |
Second phase of EVP cipher overhaul.
Change functions like EVP_EncryptUpdate() so they now return a
value. These normally have software only implementations
which cannot fail so this was acceptable. However ciphers
can be implemented in hardware and these could return errors.
Diffstat (limited to 'crypto/evp')
33 files changed, 250 insertions, 181 deletions
diff --git a/crypto/evp/e_cbc_3d.c b/crypto/evp/e_cbc_3d.c index a458921583..7ee7851c55 100644 --- a/crypto/evp/e_cbc_3d.c +++ b/crypto/evp/e_cbc_3d.c @@ -62,11 +62,11 @@ #include <openssl/evp.h> #include <openssl/objects.h> -static void des_cbc_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int des_cbc_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); -static void des_cbc_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int des_cbc_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); -static void des_cbc_ede_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int des_cbc_ede_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); static EVP_CIPHER d_cbc_ede_cipher2= { @@ -108,7 +108,7 @@ EVP_CIPHER *EVP_des_ede3_cbc(void) return(&d_cbc_ede_cipher3); } -static void des_cbc_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int des_cbc_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv, int enc) { des_cblock *deskey = (des_cblock *)key; @@ -125,9 +125,10 @@ static void des_cbc_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, (char *)ctx->c.des_ede.ks1, sizeof(ctx->c.des_ede.ks1)); } + return 1; } -static void des_cbc_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int des_cbc_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv, int enc) { des_cblock *deskey = (des_cblock *)key; @@ -142,14 +143,16 @@ static void des_cbc_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, des_set_key_unchecked(&deskey[1],ctx->c.des_ede.ks2); des_set_key_unchecked(&deskey[2],ctx->c.des_ede.ks3); } + return 1; } -static void des_cbc_ede_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int des_cbc_ede_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl) { des_ede3_cbc_encrypt(in,out,inl, ctx->c.des_ede.ks1, ctx->c.des_ede.ks2,ctx->c.des_ede.ks3, (des_cblock *) &(ctx->iv[0]), ctx->encrypt); + return 1; } #endif diff --git a/crypto/evp/e_cbc_bf.c b/crypto/evp/e_cbc_bf.c index 489e63041d..feda9e7e02 100644 --- a/crypto/evp/e_cbc_bf.c +++ b/crypto/evp/e_cbc_bf.c @@ -62,9 +62,9 @@ #include <openssl/evp.h> #include <openssl/objects.h> -static void bf_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int bf_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); -static void bf_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int bf_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); static EVP_CIPHER bfish_cbc_cipher= { @@ -86,7 +86,7 @@ EVP_CIPHER *EVP_bf_cbc(void) return(&bfish_cbc_cipher); } -static void bf_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int bf_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv, int enc) { if (iv != NULL) @@ -94,15 +94,17 @@ static void bf_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); if (key != NULL) BF_set_key(&(ctx->c.bf_ks),EVP_CIPHER_CTX_key_length(ctx),key); + return 1; } -static void bf_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int bf_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl) { BF_cbc_encrypt( in,out,(long)inl, &(ctx->c.bf_ks),&(ctx->iv[0]), ctx->encrypt); + return 1; } #endif diff --git a/crypto/evp/e_cbc_c.c b/crypto/evp/e_cbc_c.c index 4e8fda9e64..d910f67cc5 100644 --- a/crypto/evp/e_cbc_c.c +++ b/crypto/evp/e_cbc_c.c @@ -63,9 +63,9 @@ #include <openssl/evp.h> #include <openssl/objects.h> -static void cast_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int cast_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); -static void cast_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int cast_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); static EVP_CIPHER cast5_cbc_cipher= { @@ -87,7 +87,7 @@ EVP_CIPHER *EVP_cast5_cbc(void) return(&cast5_cbc_cipher); } -static void cast_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int cast_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv, int enc) { if (iv != NULL) @@ -95,15 +95,17 @@ static void cast_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); if (key != NULL) CAST_set_key(&(ctx->c.cast_ks),EVP_CIPHER_CTX_key_length(ctx),key); + return 1; } -static void cast_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int cast_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl) { CAST_cbc_encrypt( in,out,(long)inl, &(ctx->c.cast_ks),&(ctx->iv[0]), ctx->encrypt); + return 1; } #endif diff --git a/crypto/evp/e_cbc_d.c b/crypto/evp/e_cbc_d.c index ae9d25aca1..817d354358 100644 --- a/crypto/evp/e_cbc_d.c +++ b/crypto/evp/e_cbc_d.c @@ -62,9 +62,9 @@ #include <openssl/evp.h> #include <openssl/objects.h> -static void des_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int des_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); -static void des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); static EVP_CIPHER d_cbc_cipher= { @@ -86,7 +86,7 @@ EVP_CIPHER *EVP_des_cbc(void) return(&d_cbc_cipher); } -static void des_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int des_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv, int enc) { des_cblock *deskey = (des_cblock *)key; @@ -96,13 +96,15 @@ static void des_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); if (deskey != NULL) des_set_key_unchecked(deskey,ctx->c.des_ks); + return 1; } -static void des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl) { des_ncbc_encrypt(in,out,inl,ctx->c.des_ks, (des_cblock *)&(ctx->iv[0]), ctx->encrypt); + return 1; } #endif diff --git a/crypto/evp/e_cbc_i.c b/crypto/evp/e_cbc_i.c index b74f280614..56869b577b 100644 --- a/crypto/evp/e_cbc_i.c +++ b/crypto/evp/e_cbc_i.c @@ -63,9 +63,9 @@ #include <openssl/evp.h> #include <openssl/objects.h> -static void idea_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int idea_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); -static void idea_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int idea_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); static EVP_CIPHER i_cbc_cipher= { @@ -87,7 +87,7 @@ EVP_CIPHER *EVP_idea_cbc(void) return(&i_cbc_cipher); } -static void idea_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int idea_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv, int enc) { if (iv != NULL) @@ -107,15 +107,17 @@ static void idea_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, sizeof(IDEA_KEY_SCHEDULE)); } } + return 1; } -static void idea_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int idea_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl) { idea_cbc_encrypt( in,out,(long)inl, &(ctx->c.idea_ks),&(ctx->iv[0]), ctx->encrypt); + return 1; } #endif diff --git a/crypto/evp/e_cbc_r2.c b/crypto/evp/e_cbc_r2.c index dc94b4fe1f..5e91c9d21e 100644 --- a/crypto/evp/e_cbc_r2.c +++ b/crypto/evp/e_cbc_r2.c @@ -63,9 +63,9 @@ #include <openssl/evp.h> #include <openssl/objects.h> -static void rc2_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int rc2_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); -static void rc2_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int rc2_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); static int rc2_meth_to_magic(const EVP_CIPHER *e); static EVP_CIPHER *rc2_magic_to_meth(int i); @@ -136,7 +136,7 @@ EVP_CIPHER *EVP_rc2_40_cbc(void) return(&r2_40_cbc_cipher); } -static void rc2_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int rc2_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv, int enc) { if (iv != NULL) @@ -145,15 +145,17 @@ static void rc2_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, if (key != NULL) RC2_set_key(&(ctx->c.rc2_ks),EVP_CIPHER_CTX_key_length(ctx), key,EVP_CIPHER_key_length(ctx->cipher)*8); + return 1; } -static void rc2_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int rc2_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl) { RC2_cbc_encrypt( in,out,(long)inl, &(ctx->c.rc2_ks),&(ctx->iv[0]), ctx->encrypt); + return 1; } static int rc2_meth_to_magic(const EVP_CIPHER *e) diff --git a/crypto/evp/e_cbc_r5.c b/crypto/evp/e_cbc_r5.c index 4e71f46d02..1639a08cdd 100644 --- a/crypto/evp/e_cbc_r5.c +++ b/crypto/evp/e_cbc_r5.c @@ -63,9 +63,9 @@ #include <openssl/evp.h> #include <openssl/objects.h> -static void r_32_12_16_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int r_32_12_16_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); -static void r_32_12_16_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int r_32_12_16_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); static EVP_CIPHER rc5_32_12_16_cbc_cipher= { @@ -87,7 +87,7 @@ EVP_CIPHER *EVP_rc5_32_12_16_cbc(void) return(&rc5_32_12_16_cbc_cipher); } -static void r_32_12_16_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int r_32_12_16_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv, int enc) { if (iv != NULL) @@ -96,15 +96,17 @@ static void r_32_12_16_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, if (key != NULL) RC5_32_set_key(&(ctx->c.rc5_ks),EVP_RC5_32_12_16_KEY_SIZE, key,RC5_12_ROUNDS); + return 1; } -static void r_32_12_16_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int r_32_12_16_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl) { RC5_32_cbc_encrypt( in,out,(long)inl, &(ctx->c.rc5_ks),&(ctx->iv[0]), ctx->encrypt); + return 1; } #endif diff --git a/crypto/evp/e_cfb_3d.c b/crypto/evp/e_cfb_3d.c index 73b989b3b6..b07d90a036 100644 --- a/crypto/evp/e_cfb_3d.c +++ b/crypto/evp/e_cfb_3d.c @@ -62,11 +62,11 @@ #include <openssl/evp.h> #include <openssl/objects.h> -static void des_ede_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int des_ede_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); -static void des_ede3_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int des_ede3_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); -static void des_ede_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int des_ede_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); static EVP_CIPHER d_ede_cfb_cipher2= { @@ -108,7 +108,7 @@ EVP_CIPHER *EVP_des_ede3_cfb(void) return(&d_ede3_cfb_cipher3); } -static void des_ede_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int des_ede_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv, int enc) { des_cblock *deskey = (des_cblock *)key; @@ -126,9 +126,10 @@ static void des_ede_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, (char *)ctx->c.des_ede.ks1, sizeof(ctx->c.des_ede.ks1)); } + return 1; } -static void des_ede3_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int des_ede3_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv, int enc) { des_cblock *deskey = (des_cblock *)key; @@ -144,9 +145,10 @@ static void des_ede3_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, des_set_key_unchecked(&deskey[1],ctx->c.des_ede.ks2); des_set_key_unchecked(&deskey[2],ctx->c.des_ede.ks3); } + return 1; } -static void des_ede_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int des_ede_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl) { des_ede3_cfb64_encrypt(in,out,(long)inl, @@ -155,5 +157,6 @@ static void des_ede_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, ctx->c.des_ede.ks3, (des_cblock*)&(ctx->iv[0]), &ctx->num,ctx->encrypt); + return 1; } #endif diff --git a/crypto/evp/e_cfb_bf.c b/crypto/evp/e_cfb_bf.c index b09485531f..c1e7a7c935 100644 --- a/crypto/evp/e_cfb_bf.c +++ b/crypto/evp/e_cfb_bf.c @@ -62,9 +62,9 @@ #include <openssl/evp.h> #include <openssl/objects.h> -static void bf_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int bf_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); -static void bf_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int bf_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); static EVP_CIPHER bfish_cfb_cipher= { @@ -86,7 +86,7 @@ EVP_CIPHER *EVP_bf_cfb(void) return(&bfish_cfb_cipher); } -static void bf_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int bf_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv, int enc) { ctx->num=0; @@ -96,9 +96,10 @@ static void bf_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); if (key != NULL) BF_set_key(&(ctx->c.bf_ks),EVP_CIPHER_CTX_key_length(ctx),key); + return 1; } -static void bf_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int bf_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl) { BF_cfb64_encrypt( @@ -106,5 +107,6 @@ static void bf_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, (long)inl, &(ctx->c.bf_ks), &(ctx->iv[0]), &ctx->num,ctx->encrypt); + return 1; } #endif diff --git a/crypto/evp/e_cfb_c.c b/crypto/evp/e_cfb_c.c index c4efb64bd2..d29e5948a4 100644 --- a/crypto/evp/e_cfb_c.c +++ b/crypto/evp/e_cfb_c.c @@ -63,9 +63,9 @@ #include <openssl/evp.h> #include <openssl/objects.h> -static void cast_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int cast_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); -static void cast_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int cast_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); static EVP_CIPHER cast5_cfb_cipher= { @@ -87,7 +87,7 @@ EVP_CIPHER *EVP_cast5_cfb(void) return(&cast5_cfb_cipher); } -static void cast_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int cast_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv, int enc) { ctx->num=0; @@ -97,9 +97,10 @@ static void cast_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); if (key != NULL) CAST_set_key(&(ctx->c.cast_ks),EVP_CIPHER_CTX_key_length(ctx),key); + return 1; } -static void cast_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int cast_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl) { CAST_cfb64_encrypt( @@ -107,5 +108,6 @@ static void cast_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, (long)inl, &(ctx->c.cast_ks), &(ctx->iv[0]), &ctx->num,ctx->encrypt); + return 1; } #endif diff --git a/crypto/evp/e_cfb_d.c b/crypto/evp/e_cfb_d.c index 6817d78073..63d4dff681 100644 --- a/crypto/evp/e_cfb_d.c +++ b/crypto/evp/e_cfb_d.c @@ -62,9 +62,9 @@ #include <openssl/objects.h> #ifndef NO_DES -static void des_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int des_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); -static void des_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int des_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); static EVP_CIPHER d_cfb_cipher= { @@ -86,7 +86,7 @@ EVP_CIPHER *EVP_des_cfb(void) return(&d_cfb_cipher); } -static void des_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int des_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv, int enc) { des_cblock *deskey = (des_cblock *)key; @@ -98,9 +98,10 @@ static void des_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); if (deskey != NULL) des_set_key_unchecked(deskey,ctx->c.des_ks); + return 1; } -static void des_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int des_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl) { des_cfb64_encrypt( @@ -108,5 +109,6 @@ static void des_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, (long)inl, ctx->c.des_ks, (des_cblock *)&(ctx->iv[0]), &ctx->num,ctx->encrypt); + return 1; } #endif diff --git a/crypto/evp/e_cfb_i.c b/crypto/evp/e_cfb_i.c index e228057fa1..d0da6e0382 100644 --- a/crypto/evp/e_cfb_i.c +++ b/crypto/evp/e_cfb_i.c @@ -63,9 +63,9 @@ #include <openssl/evp.h> #include <openssl/objects.h> -static void idea_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int idea_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); -static void idea_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int idea_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); static EVP_CIPHER i_cfb_cipher= { @@ -87,7 +87,7 @@ EVP_CIPHER *EVP_idea_cfb(void) return(&i_cfb_cipher); } -static void idea_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int idea_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv, int enc) { ctx->num=0; @@ -97,15 +97,17 @@ static void idea_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); if (key != NULL) idea_set_encrypt_key(key,&(ctx->c.idea_ks)); + return 1; } -static void idea_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int idea_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl) { idea_cfb64_encrypt( in,out,(long)inl, &(ctx->c.idea_ks),&(ctx->iv[0]), &ctx->num,ctx->encrypt); + return 1; } #endif diff --git a/crypto/evp/e_cfb_r2.c b/crypto/evp/e_cfb_r2.c index 6e5ee8dac6..2e0fd53763 100644 --- a/crypto/evp/e_cfb_r2.c +++ b/crypto/evp/e_cfb_r2.c @@ -63,9 +63,9 @@ #include <openssl/evp.h> #include <openssl/objects.h> -static void rc2_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int rc2_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); -static void rc2_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int rc2_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); static EVP_CIPHER r2_cfb_cipher= { @@ -87,7 +87,7 @@ EVP_CIPHER *EVP_rc2_cfb(void) return(&r2_cfb_cipher); } -static void rc2_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int rc2_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv, int enc) { ctx->num=0; @@ -98,9 +98,10 @@ static void rc2_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, if (key != NULL) RC2_set_key(&(ctx->c.rc2_ks),EVP_CIPHER_CTX_key_length(ctx), key,EVP_CIPHER_key_length(ctx->cipher)*8); + return 1; } -static void rc2_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int rc2_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl) { RC2_cfb64_encrypt( @@ -108,5 +109,6 @@ static void rc2_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, (long)inl, &(ctx->c.rc2_ks), &(ctx->iv[0]), &ctx->num,ctx->encrypt); + return 1; } #endif diff --git a/crypto/evp/e_cfb_r5.c b/crypto/evp/e_cfb_r5.c index 25ec1193ca..bd092b4cd5 100644 --- a/crypto/evp/e_cfb_r5.c +++ b/crypto/evp/e_cfb_r5.c @@ -63,9 +63,9 @@ #include <openssl/evp.h> #include <openssl/objects.h> -static void rc5_32_12_16_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int rc5_32_12_16_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); -static void rc5_32_12_16_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int rc5_32_12_16_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); static EVP_CIPHER rc5_cfb_cipher= { @@ -87,7 +87,7 @@ EVP_CIPHER *EVP_rc5_32_12_16_cfb(void) return(&rc5_cfb_cipher); } -static void rc5_32_12_16_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int rc5_32_12_16_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv, int enc) { ctx->num=0; @@ -98,9 +98,10 @@ static void rc5_32_12_16_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, if (key != NULL) RC5_32_set_key(&(ctx->c.rc5_ks),EVP_RC5_32_12_16_KEY_SIZE,key, RC5_12_ROUNDS); + return 1; } -static void rc5_32_12_16_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int rc5_32_12_16_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl) { RC5_32_cfb64_encrypt( @@ -108,5 +109,6 @@ static void rc5_32_12_16_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, (long)inl, &(ctx->c.rc5_ks), &(ctx->iv[0]), &ctx->num,ctx->encrypt); + return 1; } #endif diff --git a/crypto/evp/e_ecb_3d.c b/crypto/evp/e_ecb_3d.c index 5308557ee4..157fb9e6a8 100644 --- a/crypto/evp/e_ecb_3d.c +++ b/crypto/evp/e_ecb_3d.c @@ -62,11 +62,11 @@ #include <openssl/evp.h> #include <openssl/objects.h> -static void des_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int des_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); -static void des_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int des_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); -static void des_ede_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int des_ede_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); static EVP_CIPHER d_ede_cipher2= { @@ -108,7 +108,7 @@ EVP_CIPHER *EVP_des_ede3(void) return(&d_ede3_cipher3); } -static void des_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int des_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv, int enc) { des_cblock *deskey = (des_cblock *)key; @@ -121,9 +121,10 @@ static void des_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, (char *)ctx->c.des_ede.ks1, sizeof(ctx->c.des_ede.ks1)); } + return 1; } -static void des_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, +static int des_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv, int enc) { des_cblock *deskey = (des_cblock *)key; @@ -134,16 +135,17 @@ static void des_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, des_set_key_unchecked(&deskey[1],ctx |