Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(383)

Side by Side Diff: openssl/crypto/evp/evp_lib.c

Issue 9254031: Upgrade chrome's OpenSSL to same version Android ships with. (Closed) Base URL: http://src.chromium.org/svn/trunk/deps/third_party/openssl/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « openssl/crypto/evp/evp_key.c ('k') | openssl/crypto/evp/evp_locl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* crypto/evp/evp_lib.c */ 1 /* crypto/evp/evp_lib.c */
2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * This package is an SSL implementation written 5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com). 6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL. 7 * The implementation was written so as to conform with Netscapes SSL.
8 * 8 *
9 * This library is free for commercial and non-commercial use as long as 9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions 10 * the following conditions are aheared to. The following conditions
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 #include "cryptlib.h" 60 #include "cryptlib.h"
61 #include <openssl/evp.h> 61 #include <openssl/evp.h>
62 #include <openssl/objects.h> 62 #include <openssl/objects.h>
63 63
64 int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type) 64 int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type)
65 { 65 {
66 int ret; 66 int ret;
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);
75 } 73 }
76 74
77 int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type) 75 int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type)
78 { 76 {
79 int ret; 77 int ret;
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);
88 } 84 }
89 85
90 int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) 86 int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type)
91 { 87 {
92 int i=0; 88 int i=0;
93 unsigned int l; 89 unsigned int l;
94 90
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 int EVP_CIPHER_block_size(const EVP_CIPHER *e) 177 int EVP_CIPHER_block_size(const EVP_CIPHER *e)
182 { 178 {
183 return e->block_size; 179 return e->block_size;
184 } 180 }
185 181
186 int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx) 182 int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx)
187 { 183 {
188 return ctx->cipher->block_size; 184 return ctx->cipher->block_size;
189 } 185 }
190 186
187 int 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
191 const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx) 192 const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx)
192 { 193 {
193 return ctx->cipher; 194 return ctx->cipher;
194 } 195 }
195 196
196 unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher) 197 unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher)
197 { 198 {
198 return cipher->flags; 199 return cipher->flags;
199 } 200 }
200 201
202 unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx)
203 {
204 return ctx->cipher->flags;
205 }
206
201 void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx) 207 void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx)
202 { 208 {
203 return ctx->app_data; 209 return ctx->app_data;
204 } 210 }
205 211
206 void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data) 212 void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data)
207 { 213 {
208 ctx->app_data = data; 214 ctx->app_data = data;
209 } 215 }
210 216
211 int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher) 217 int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher)
212 { 218 {
213 return cipher->iv_len; 219 return cipher->iv_len;
214 } 220 }
215 221
222 int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx)
223 {
224 return ctx->cipher->iv_len;
225 }
226
216 int EVP_CIPHER_key_length(const EVP_CIPHER *cipher) 227 int EVP_CIPHER_key_length(const EVP_CIPHER *cipher)
217 { 228 {
218 return cipher->key_len; 229 return cipher->key_len;
219 } 230 }
220 231
221 int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx) 232 int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx)
222 { 233 {
223 return ctx->key_len; 234 return ctx->key_len;
224 } 235 }
225 236
237 int EVP_CIPHER_nid(const EVP_CIPHER *cipher)
238 {
239 return cipher->nid;
240 }
241
226 int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx) 242 int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx)
227 { 243 {
228 return ctx->cipher->nid; 244 return ctx->cipher->nid;
229 } 245 }
230 246
231 int EVP_MD_block_size(const EVP_MD *md) 247 int EVP_MD_block_size(const EVP_MD *md)
232 { 248 {
233 return md->block_size; 249 return md->block_size;
234 } 250 }
235 251
236 int EVP_MD_type(const EVP_MD *md) 252 int EVP_MD_type(const EVP_MD *md)
237 { 253 {
238 return md->type; 254 return md->type;
239 } 255 }
240 256
241 int EVP_MD_pkey_type(const EVP_MD *md) 257 int EVP_MD_pkey_type(const EVP_MD *md)
242 { 258 {
243 return md->pkey_type; 259 return md->pkey_type;
244 } 260 }
245 261
246 int EVP_MD_size(const EVP_MD *md) 262 int EVP_MD_size(const EVP_MD *md)
247 { 263 {
264 if (!md)
265 {
266 EVPerr(EVP_F_EVP_MD_SIZE, EVP_R_MESSAGE_DIGEST_IS_NULL);
267 return -1;
268 }
248 return md->md_size; 269 return md->md_size;
249 } 270 }
250 271
251 const EVP_MD * EVP_MD_CTX_md(const EVP_MD_CTX *ctx) 272 unsigned long EVP_MD_flags(const EVP_MD *md)
252 { 273 {
274 return md->flags;
275 }
276
277 const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx)
278 {
279 if (!ctx)
280 return NULL;
253 return ctx->digest; 281 return ctx->digest;
254 } 282 }
255 283
256 void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags) 284 void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags)
257 { 285 {
258 ctx->flags |= flags; 286 ctx->flags |= flags;
259 } 287 }
260 288
261 void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags) 289 void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags)
262 { 290 {
(...skipping 12 matching lines...) Expand all
275 303
276 void EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags) 304 void EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags)
277 { 305 {
278 ctx->flags &= ~flags; 306 ctx->flags &= ~flags;
279 } 307 }
280 308
281 int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags) 309 int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags)
282 { 310 {
283 return (ctx->flags & flags); 311 return (ctx->flags & flags);
284 } 312 }
OLDNEW
« no previous file with comments | « openssl/crypto/evp/evp_key.c ('k') | openssl/crypto/evp/evp_locl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698