diff options
author | beck <> | 1999-09-29 04:37:45 +0000 |
---|---|---|
committer | beck <> | 1999-09-29 04:37:45 +0000 |
commit | de8f24ea083384bb66b32ec105dc4743c5663cdf (patch) | |
tree | 1412176ae62a3cab2cf2b0b92150fcbceaac6092 /src/lib/libcrypto/evp/e_xcbc_d.c | |
parent | cb929d29896bcb87c2a97417fbd03e50078fc178 (diff) | |
download | openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.gz openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.bz2 openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.zip |
OpenSSL 0.9.4 merge
Diffstat (limited to 'src/lib/libcrypto/evp/e_xcbc_d.c')
-rw-r--r-- | src/lib/libcrypto/evp/e_xcbc_d.c | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/src/lib/libcrypto/evp/e_xcbc_d.c b/src/lib/libcrypto/evp/e_xcbc_d.c index 0d7fda0c47..3a6628a75c 100644 --- a/src/lib/libcrypto/evp/e_xcbc_d.c +++ b/src/lib/libcrypto/evp/e_xcbc_d.c | |||
@@ -56,21 +56,16 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #ifndef NO_DES | ||
59 | #include <stdio.h> | 60 | #include <stdio.h> |
60 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
61 | #include "evp.h" | 62 | #include <openssl/evp.h> |
62 | #include "objects.h" | 63 | #include <openssl/objects.h> |
63 | 64 | ||
64 | #ifndef NOPROTO | ||
65 | static void desx_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, | 65 | static void desx_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, |
66 | unsigned char *iv,int enc); | 66 | unsigned char *iv,int enc); |
67 | static void desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 67 | static void desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
68 | unsigned char *in, unsigned int inl); | 68 | unsigned char *in, unsigned int inl); |
69 | #else | ||
70 | static void desx_cbc_init_key(); | ||
71 | static void desx_cbc_cipher(); | ||
72 | #endif | ||
73 | |||
74 | static EVP_CIPHER d_xcbc_cipher= | 69 | static EVP_CIPHER d_xcbc_cipher= |
75 | { | 70 | { |
76 | NID_desx_cbc, | 71 | NID_desx_cbc, |
@@ -84,39 +79,34 @@ static EVP_CIPHER d_xcbc_cipher= | |||
84 | EVP_CIPHER_get_asn1_iv, | 79 | EVP_CIPHER_get_asn1_iv, |
85 | }; | 80 | }; |
86 | 81 | ||
87 | EVP_CIPHER *EVP_desx_cbc() | 82 | EVP_CIPHER *EVP_desx_cbc(void) |
88 | { | 83 | { |
89 | return(&d_xcbc_cipher); | 84 | return(&d_xcbc_cipher); |
90 | } | 85 | } |
91 | 86 | ||
92 | static void desx_cbc_init_key(ctx,key,iv,enc) | 87 | static void desx_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, |
93 | EVP_CIPHER_CTX *ctx; | 88 | unsigned char *iv, int enc) |
94 | unsigned char *key; | ||
95 | unsigned char *iv; | ||
96 | int enc; | ||
97 | { | 89 | { |
90 | des_cblock *deskey = (des_cblock *)key; | ||
91 | |||
98 | if (iv != NULL) | 92 | if (iv != NULL) |
99 | memcpy(&(ctx->oiv[0]),iv,8); | 93 | memcpy(&(ctx->oiv[0]),iv,8); |
100 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); | 94 | memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); |
101 | if (key != NULL) | 95 | if (deskey != NULL) |
102 | { | 96 | { |
103 | des_set_key((des_cblock *)key,ctx->c.desx_cbc.ks); | 97 | des_set_key(deskey,ctx->c.desx_cbc.ks); |
104 | memcpy(&(ctx->c.desx_cbc.inw[0]),&(key[8]),8); | 98 | memcpy(&(ctx->c.desx_cbc.inw[0]),&(key[8]),8); |
105 | memcpy(&(ctx->c.desx_cbc.outw[0]),&(key[16]),8); | 99 | memcpy(&(ctx->c.desx_cbc.outw[0]),&(key[16]),8); |
106 | } | 100 | } |
107 | } | 101 | } |
108 | 102 | ||
109 | static void desx_cbc_cipher(ctx,out,in,inl) | 103 | static void desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
110 | EVP_CIPHER_CTX *ctx; | 104 | unsigned char *in, unsigned int inl) |
111 | unsigned char *out; | ||
112 | unsigned char *in; | ||
113 | unsigned int inl; | ||
114 | { | 105 | { |
115 | des_xcbc_encrypt( | 106 | des_xcbc_encrypt(in,out,inl,ctx->c.desx_cbc.ks, |
116 | (des_cblock *)in,(des_cblock *)out, | ||
117 | (long)inl, ctx->c.desx_cbc.ks, | ||
118 | (des_cblock *)&(ctx->iv[0]), | 107 | (des_cblock *)&(ctx->iv[0]), |
119 | (des_cblock *)&(ctx->c.desx_cbc.inw[0]), | 108 | &ctx->c.desx_cbc.inw, |
120 | (des_cblock *)&(ctx->c.desx_cbc.outw[0]), | 109 | &ctx->c.desx_cbc.outw, |
121 | ctx->encrypt); | 110 | ctx->encrypt); |
122 | } | 111 | } |
112 | #endif | ||