summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp/evp_lib.c
diff options
context:
space:
mode:
authordjm <>2010-10-01 22:59:01 +0000
committerdjm <>2010-10-01 22:59:01 +0000
commitfe047d8b632246cb2db3234a0a4f32e5c318857b (patch)
tree939b752540947d33507b3acc48d76a8bfb7c3dc3 /src/lib/libcrypto/evp/evp_lib.c
parent2ea67f4aa254b09ded62e6e14fc893bbe6381579 (diff)
downloadopenbsd-fe047d8b632246cb2db3234a0a4f32e5c318857b.tar.gz
openbsd-fe047d8b632246cb2db3234a0a4f32e5c318857b.tar.bz2
openbsd-fe047d8b632246cb2db3234a0a4f32e5c318857b.zip
resolve conflicts, fix local changes
Diffstat (limited to 'src/lib/libcrypto/evp/evp_lib.c')
-rw-r--r--src/lib/libcrypto/evp/evp_lib.c44
1 files changed, 39 insertions, 5 deletions
diff --git a/src/lib/libcrypto/evp/evp_lib.c b/src/lib/libcrypto/evp/evp_lib.c
index 174cf6c594..40951a04f0 100644
--- a/src/lib/libcrypto/evp/evp_lib.c
+++ b/src/lib/libcrypto/evp/evp_lib.c
@@ -67,8 +67,6 @@ int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type)
67 67
68 if (c->cipher->set_asn1_parameters != NULL) 68 if (c->cipher->set_asn1_parameters != NULL)
69 ret=c->cipher->set_asn1_parameters(c,type); 69 ret=c->cipher->set_asn1_parameters(c,type);
70 else if (c->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1)
71 ret=EVP_CIPHER_set_asn1_iv(c, type);
72 else 70 else
73 ret=-1; 71 ret=-1;
74 return(ret); 72 return(ret);
@@ -80,8 +78,6 @@ int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type)
80 78
81 if (c->cipher->get_asn1_parameters != NULL) 79 if (c->cipher->get_asn1_parameters != NULL)
82 ret=c->cipher->get_asn1_parameters(c,type); 80 ret=c->cipher->get_asn1_parameters(c,type);
83 else if (c->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1)
84 ret=EVP_CIPHER_get_asn1_iv(c, type);
85 else 81 else
86 ret=-1; 82 ret=-1;
87 return(ret); 83 return(ret);
@@ -163,6 +159,12 @@ int EVP_CIPHER_type(const EVP_CIPHER *ctx)
163 159
164 return NID_des_cfb64; 160 return NID_des_cfb64;
165 161
162 case NID_des_ede3_cfb64:
163 case NID_des_ede3_cfb8:
164 case NID_des_ede3_cfb1:
165
166 return NID_des_cfb64;
167
166 default: 168 default:
167 /* Check it has an OID and it is valid */ 169 /* Check it has an OID and it is valid */
168 otmp = OBJ_nid2obj(nid); 170 otmp = OBJ_nid2obj(nid);
@@ -182,6 +184,11 @@ int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx)
182 return ctx->cipher->block_size; 184 return ctx->cipher->block_size;
183 } 185 }
184 186
187int EVP_Cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl)
188 {
189 return ctx->cipher->do_cipher(ctx,out,in,inl);
190 }
191
185const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx) 192const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx)
186 { 193 {
187 return ctx->cipher; 194 return ctx->cipher;
@@ -192,6 +199,11 @@ unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher)
192 return cipher->flags; 199 return cipher->flags;
193 } 200 }
194 201
202unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx)
203 {
204 return ctx->cipher->flags;
205 }
206
195void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx) 207void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx)
196 { 208 {
197 return ctx->app_data; 209 return ctx->app_data;
@@ -207,6 +219,11 @@ int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher)
207 return cipher->iv_len; 219 return cipher->iv_len;
208 } 220 }
209 221
222int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx)
223 {
224 return ctx->cipher->iv_len;
225 }
226
210int EVP_CIPHER_key_length(const EVP_CIPHER *cipher) 227int EVP_CIPHER_key_length(const EVP_CIPHER *cipher)
211 { 228 {
212 return cipher->key_len; 229 return cipher->key_len;
@@ -217,6 +234,11 @@ int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx)
217 return ctx->key_len; 234 return ctx->key_len;
218 } 235 }
219 236
237int EVP_CIPHER_nid(const EVP_CIPHER *cipher)
238 {
239 return cipher->nid;
240 }
241
220int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx) 242int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx)
221 { 243 {
222 return ctx->cipher->nid; 244 return ctx->cipher->nid;
@@ -239,11 +261,23 @@ int EVP_MD_pkey_type(const EVP_MD *md)
239 261
240int EVP_MD_size(const EVP_MD *md) 262int EVP_MD_size(const EVP_MD *md)
241 { 263 {
264 if (!md)
265 {
266 EVPerr(EVP_F_EVP_MD_SIZE, EVP_R_MESSAGE_DIGEST_IS_NULL);
267 return -1;
268 }
242 return md->md_size; 269 return md->md_size;
243 } 270 }
244 271
245const EVP_MD * EVP_MD_CTX_md(const EVP_MD_CTX *ctx) 272unsigned long EVP_MD_flags(const EVP_MD *md)
273 {
274 return md->flags;
275 }
276
277const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx)
246 { 278 {
279 if (!ctx)
280 return NULL;
247 return ctx->digest; 281 return ctx->digest;
248 } 282 }
249 283