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/evp_enc.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/evp_enc.c')
-rw-r--r-- | src/lib/libcrypto/evp/evp_enc.c | 71 |
1 files changed, 19 insertions, 52 deletions
diff --git a/src/lib/libcrypto/evp/evp_enc.c b/src/lib/libcrypto/evp/evp_enc.c index 93cc3a9464..5299a65b6a 100644 --- a/src/lib/libcrypto/evp/evp_enc.c +++ b/src/lib/libcrypto/evp/evp_enc.c | |||
@@ -58,23 +58,18 @@ | |||
58 | 58 | ||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
61 | #include "evp.h" | 61 | #include <openssl/evp.h> |
62 | 62 | ||
63 | char *EVP_version="EVP part of SSLeay 0.9.0b 29-Jun-1998"; | 63 | const char *EVP_version="EVP" OPENSSL_VERSION_PTEXT; |
64 | 64 | ||
65 | void EVP_CIPHER_CTX_init(ctx) | 65 | void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx) |
66 | EVP_CIPHER_CTX *ctx; | ||
67 | { | 66 | { |
68 | memset(ctx,0,sizeof(EVP_CIPHER_CTX)); | 67 | memset(ctx,0,sizeof(EVP_CIPHER_CTX)); |
69 | /* ctx->cipher=NULL; */ | 68 | /* ctx->cipher=NULL; */ |
70 | } | 69 | } |
71 | 70 | ||
72 | void EVP_CipherInit(ctx,data,key,iv,enc) | 71 | void EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *data, |
73 | EVP_CIPHER_CTX *ctx; | 72 | unsigned char *key, unsigned char *iv, int enc) |
74 | EVP_CIPHER *data; | ||
75 | unsigned char *key; | ||
76 | unsigned char *iv; | ||
77 | int enc; | ||
78 | { | 73 | { |
79 | if (enc) | 74 | if (enc) |
80 | EVP_EncryptInit(ctx,data,key,iv); | 75 | EVP_EncryptInit(ctx,data,key,iv); |
@@ -82,22 +77,15 @@ int enc; | |||
82 | EVP_DecryptInit(ctx,data,key,iv); | 77 | EVP_DecryptInit(ctx,data,key,iv); |
83 | } | 78 | } |
84 | 79 | ||
85 | void EVP_CipherUpdate(ctx,out,outl,in,inl) | 80 | void EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, |
86 | EVP_CIPHER_CTX *ctx; | 81 | unsigned char *in, int inl) |
87 | unsigned char *out; | ||
88 | int *outl; | ||
89 | unsigned char *in; | ||
90 | int inl; | ||
91 | { | 82 | { |
92 | if (ctx->encrypt) | 83 | if (ctx->encrypt) |
93 | EVP_EncryptUpdate(ctx,out,outl,in,inl); | 84 | EVP_EncryptUpdate(ctx,out,outl,in,inl); |
94 | else EVP_DecryptUpdate(ctx,out,outl,in,inl); | 85 | else EVP_DecryptUpdate(ctx,out,outl,in,inl); |
95 | } | 86 | } |
96 | 87 | ||
97 | int EVP_CipherFinal(ctx,out,outl) | 88 | int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) |
98 | EVP_CIPHER_CTX *ctx; | ||
99 | unsigned char *out; | ||
100 | int *outl; | ||
101 | { | 89 | { |
102 | if (ctx->encrypt) | 90 | if (ctx->encrypt) |
103 | { | 91 | { |
@@ -107,11 +95,8 @@ int *outl; | |||
107 | else return(EVP_DecryptFinal(ctx,out,outl)); | 95 | else return(EVP_DecryptFinal(ctx,out,outl)); |
108 | } | 96 | } |
109 | 97 | ||
110 | void EVP_EncryptInit(ctx,cipher,key,iv) | 98 | void EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, |
111 | EVP_CIPHER_CTX *ctx; | 99 | unsigned char *key, unsigned char *iv) |
112 | EVP_CIPHER *cipher; | ||
113 | unsigned char *key; | ||
114 | unsigned char *iv; | ||
115 | { | 100 | { |
116 | if (cipher != NULL) | 101 | if (cipher != NULL) |
117 | ctx->cipher=cipher; | 102 | ctx->cipher=cipher; |
@@ -120,11 +105,8 @@ unsigned char *iv; | |||
120 | ctx->buf_len=0; | 105 | ctx->buf_len=0; |
121 | } | 106 | } |
122 | 107 | ||
123 | void EVP_DecryptInit(ctx,cipher,key,iv) | 108 | void EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, |
124 | EVP_CIPHER_CTX *ctx; | 109 | unsigned char *key, unsigned char *iv) |
125 | EVP_CIPHER *cipher; | ||
126 | unsigned char *key; | ||
127 | unsigned char *iv; | ||
128 | { | 110 | { |
129 | if (cipher != NULL) | 111 | if (cipher != NULL) |
130 | ctx->cipher=cipher; | 112 | ctx->cipher=cipher; |
@@ -134,12 +116,8 @@ unsigned char *iv; | |||
134 | } | 116 | } |
135 | 117 | ||
136 | 118 | ||
137 | void EVP_EncryptUpdate(ctx,out,outl,in,inl) | 119 | void EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, |
138 | EVP_CIPHER_CTX *ctx; | 120 | unsigned char *in, int inl) |
139 | unsigned char *out; | ||
140 | int *outl; | ||
141 | unsigned char *in; | ||
142 | int inl; | ||
143 | { | 121 | { |
144 | int i,j,bl; | 122 | int i,j,bl; |
145 | 123 | ||
@@ -179,10 +157,7 @@ int inl; | |||
179 | ctx->buf_len=i; | 157 | ctx->buf_len=i; |
180 | } | 158 | } |
181 | 159 | ||
182 | void EVP_EncryptFinal(ctx,out,outl) | 160 | void EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) |
183 | EVP_CIPHER_CTX *ctx; | ||
184 | unsigned char *out; | ||
185 | int *outl; | ||
186 | { | 161 | { |
187 | int i,n,b,bl; | 162 | int i,n,b,bl; |
188 | 163 | ||
@@ -200,12 +175,8 @@ int *outl; | |||
200 | *outl=b; | 175 | *outl=b; |
201 | } | 176 | } |
202 | 177 | ||
203 | void EVP_DecryptUpdate(ctx,out,outl,in,inl) | 178 | void EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, |
204 | EVP_CIPHER_CTX *ctx; | 179 | unsigned char *in, int inl) |
205 | unsigned char *out; | ||
206 | int *outl; | ||
207 | unsigned char *in; | ||
208 | int inl; | ||
209 | { | 180 | { |
210 | int b,bl,n; | 181 | int b,bl,n; |
211 | int keep_last=0; | 182 | int keep_last=0; |
@@ -249,10 +220,7 @@ int inl; | |||
249 | } | 220 | } |
250 | } | 221 | } |
251 | 222 | ||
252 | int EVP_DecryptFinal(ctx,out,outl) | 223 | int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) |
253 | EVP_CIPHER_CTX *ctx; | ||
254 | unsigned char *out; | ||
255 | int *outl; | ||
256 | { | 224 | { |
257 | int i,b; | 225 | int i,b; |
258 | int n; | 226 | int n; |
@@ -293,8 +261,7 @@ int *outl; | |||
293 | return(1); | 261 | return(1); |
294 | } | 262 | } |
295 | 263 | ||
296 | void EVP_CIPHER_CTX_cleanup(c) | 264 | void EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c) |
297 | EVP_CIPHER_CTX *c; | ||
298 | { | 265 | { |
299 | if ((c->cipher != NULL) && (c->cipher->cleanup != NULL)) | 266 | if ((c->cipher != NULL) && (c->cipher->cleanup != NULL)) |
300 | c->cipher->cleanup(c); | 267 | c->cipher->cleanup(c); |