aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/evp/e_cbc_3d.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2000-05-28 12:44:46 +0000
committerDr. Stephen Henson <steve@openssl.org>2000-05-28 12:44:46 +0000
commit360370d9530d552078a453f7333faeab0039268f (patch)
tree8bc290cacd648726e273496e748e1f1f1eba6695 /crypto/evp/e_cbc_3d.c
parent1fab73ac856225762dae9ef738e792b5ccbd8a32 (diff)
downloadopenssl-360370d9530d552078a453f7333faeab0039268f.tar.gz
Third phase of EVP cipher overhaul.
Remove duplicated code in EVP.
Diffstat (limited to 'crypto/evp/e_cbc_3d.c')
-rw-r--r--crypto/evp/e_cbc_3d.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/crypto/evp/e_cbc_3d.c b/crypto/evp/e_cbc_3d.c
index 7ee7851c55..bf58d4920d 100644
--- a/crypto/evp/e_cbc_3d.c
+++ b/crypto/evp/e_cbc_3d.c
@@ -113,18 +113,11 @@ static int des_cbc_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key,
{
des_cblock *deskey = (des_cblock *)key;
- if (iv != NULL)
- memcpy(&(ctx->oiv[0]),iv,8);
- memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8);
-
- if (deskey != NULL)
- {
- des_set_key_unchecked(&deskey[0],ctx->c.des_ede.ks1);
- des_set_key_unchecked(&deskey[1],ctx->c.des_ede.ks2);
- memcpy( (char *)ctx->c.des_ede.ks3,
+ des_set_key_unchecked(&deskey[0],ctx->c.des_ede.ks1);
+ des_set_key_unchecked(&deskey[1],ctx->c.des_ede.ks2);
+ memcpy( (char *)ctx->c.des_ede.ks3,
(char *)ctx->c.des_ede.ks1,
sizeof(ctx->c.des_ede.ks1));
- }
return 1;
}
@@ -133,16 +126,10 @@ static int des_cbc_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key,
{
des_cblock *deskey = (des_cblock *)key;
- if (iv != NULL)
- memcpy(&(ctx->oiv[0]),iv,8);
- memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8);
+ des_set_key_unchecked(&deskey[0],ctx->c.des_ede.ks1);
+ des_set_key_unchecked(&deskey[1],ctx->c.des_ede.ks2);
+ des_set_key_unchecked(&deskey[2],ctx->c.des_ede.ks3);
- if (deskey != NULL)
- {
- des_set_key_unchecked(&deskey[0],ctx->c.des_ede.ks1);
- des_set_key_unchecked(&deskey[1],ctx->c.des_ede.ks2);
- des_set_key_unchecked(&deskey[2],ctx->c.des_ede.ks3);
- }
return 1;
}