diff options
Diffstat (limited to 'src/lib/libcrypto/evp/e_des.c')
| -rw-r--r-- | src/lib/libcrypto/evp/e_des.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/lib/libcrypto/evp/e_des.c b/src/lib/libcrypto/evp/e_des.c index f4e998b81c..105266a4b3 100644 --- a/src/lib/libcrypto/evp/e_des.c +++ b/src/lib/libcrypto/evp/e_des.c | |||
| @@ -56,12 +56,13 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #ifndef NO_DES | 59 | #ifndef OPENSSL_NO_DES |
| 60 | #include <stdio.h> | 60 | #include <stdio.h> |
| 61 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
| 62 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
| 63 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
| 64 | #include "evp_locl.h" | 64 | #include "evp_locl.h" |
| 65 | #include <openssl/des.h> | ||
| 65 | 66 | ||
| 66 | static int des_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 67 | static int des_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
| 67 | const unsigned char *iv, int enc); | 68 | const unsigned char *iv, int enc); |
| @@ -72,34 +73,34 @@ static int des_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 72 | const unsigned char *in, unsigned int inl) | 73 | const unsigned char *in, unsigned int inl) |
| 73 | { | 74 | { |
| 74 | BLOCK_CIPHER_ecb_loop() | 75 | BLOCK_CIPHER_ecb_loop() |
| 75 | des_ecb_encrypt((des_cblock *)(in + i), (des_cblock *)(out + i), ctx->c.des_ks, ctx->encrypt); | 76 | DES_ecb_encrypt((DES_cblock *)(in + i), (DES_cblock *)(out + i), ctx->cipher_data, ctx->encrypt); |
| 76 | return 1; | 77 | return 1; |
| 77 | } | 78 | } |
| 78 | 79 | ||
| 79 | static int des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 80 | static int des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 80 | const unsigned char *in, unsigned int inl) | 81 | const unsigned char *in, unsigned int inl) |
| 81 | { | 82 | { |
| 82 | des_ofb64_encrypt(in, out, (long)inl, ctx->c.des_ks, (des_cblock *)ctx->iv, &ctx->num); | 83 | DES_ofb64_encrypt(in, out, (long)inl, ctx->cipher_data, (DES_cblock *)ctx->iv, &ctx->num); |
| 83 | return 1; | 84 | return 1; |
| 84 | } | 85 | } |
| 85 | 86 | ||
| 86 | static int des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 87 | static int des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 87 | const unsigned char *in, unsigned int inl) | 88 | const unsigned char *in, unsigned int inl) |
| 88 | { | 89 | { |
| 89 | des_ncbc_encrypt(in, out, (long)inl, ctx->c.des_ks, | 90 | DES_ncbc_encrypt(in, out, (long)inl, ctx->cipher_data, |
| 90 | (des_cblock *)ctx->iv, ctx->encrypt); | 91 | (DES_cblock *)ctx->iv, ctx->encrypt); |
| 91 | return 1; | 92 | return 1; |
| 92 | } | 93 | } |
| 93 | 94 | ||
| 94 | static int des_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 95 | static int des_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 95 | const unsigned char *in, unsigned int inl) | 96 | const unsigned char *in, unsigned int inl) |
| 96 | { | 97 | { |
| 97 | des_cfb64_encrypt(in, out, (long)inl, ctx->c.des_ks, | 98 | DES_cfb64_encrypt(in, out, (long)inl, ctx->cipher_data, |
| 98 | (des_cblock *)ctx->iv, &ctx->num, ctx->encrypt); | 99 | (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt); |
| 99 | return 1; | 100 | return 1; |
| 100 | } | 101 | } |
| 101 | 102 | ||
| 102 | BLOCK_CIPHER_defs(des, des_ks, NID_des, 8, 8, 8, | 103 | BLOCK_CIPHER_defs(des, DES_key_schedule, NID_des, 8, 8, 8, 64, |
| 103 | 0, des_init_key, NULL, | 104 | 0, des_init_key, NULL, |
| 104 | EVP_CIPHER_set_asn1_iv, | 105 | EVP_CIPHER_set_asn1_iv, |
| 105 | EVP_CIPHER_get_asn1_iv, | 106 | EVP_CIPHER_get_asn1_iv, |
| @@ -109,9 +110,9 @@ BLOCK_CIPHER_defs(des, des_ks, NID_des, 8, 8, 8, | |||
| 109 | static int des_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 110 | static int des_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
| 110 | const unsigned char *iv, int enc) | 111 | const unsigned char *iv, int enc) |
| 111 | { | 112 | { |
| 112 | des_cblock *deskey = (des_cblock *)key; | 113 | DES_cblock *deskey = (DES_cblock *)key; |
| 113 | 114 | ||
| 114 | des_set_key_unchecked(deskey,ctx->c.des_ks); | 115 | DES_set_key_unchecked(deskey,ctx->cipher_data); |
| 115 | return 1; | 116 | return 1; |
| 116 | } | 117 | } |
| 117 | 118 | ||
