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

Side by Side Diff: openssl/crypto/evp/e_xcbc_d.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/e_seed.c ('k') | openssl/crypto/evp/enc_min.c » ('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/e_xcbc_d.c */ 1 /* crypto/evp/e_xcbc_d.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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59 #include <stdio.h> 59 #include <stdio.h>
60 #include "cryptlib.h" 60 #include "cryptlib.h"
61 61
62 #ifndef OPENSSL_NO_DES 62 #ifndef OPENSSL_NO_DES
63 63
64 #include <openssl/evp.h> 64 #include <openssl/evp.h>
65 #include <openssl/objects.h> 65 #include <openssl/objects.h>
66 #include "evp_locl.h"
66 #include <openssl/des.h> 67 #include <openssl/des.h>
67 68
68 static int desx_cbc_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 69 static int desx_cbc_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
69 const unsigned char *iv,int enc); 70 const unsigned char *iv,int enc);
70 static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 71 static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
71 » » » const unsigned char *in, unsigned int inl); 72 » » » const unsigned char *in, size_t inl);
72 73
73 74
74 typedef struct 75 typedef struct
75 { 76 {
76 DES_key_schedule ks;/* key schedule */ 77 DES_key_schedule ks;/* key schedule */
77 DES_cblock inw; 78 DES_cblock inw;
78 DES_cblock outw; 79 DES_cblock outw;
79 } DESX_CBC_KEY; 80 } DESX_CBC_KEY;
80 81
81 #define data(ctx) ((DESX_CBC_KEY *)(ctx)->cipher_data) 82 #define data(ctx) ((DESX_CBC_KEY *)(ctx)->cipher_data)
(...skipping 24 matching lines...) Expand all
106 DES_cblock *deskey = (DES_cblock *)key; 107 DES_cblock *deskey = (DES_cblock *)key;
107 108
108 DES_set_key_unchecked(deskey,&data(ctx)->ks); 109 DES_set_key_unchecked(deskey,&data(ctx)->ks);
109 memcpy(&data(ctx)->inw[0],&key[8],8); 110 memcpy(&data(ctx)->inw[0],&key[8],8);
110 memcpy(&data(ctx)->outw[0],&key[16],8); 111 memcpy(&data(ctx)->outw[0],&key[16],8);
111 112
112 return 1; 113 return 1;
113 } 114 }
114 115
115 static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 116 static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
116 » » » const unsigned char *in, unsigned int inl) 117 » » » const unsigned char *in, size_t inl)
117 { 118 {
118 » DES_xcbc_encrypt(in,out,inl,&data(ctx)->ks, 119 » while (inl>=EVP_MAXCHUNK)
120 » » {
121 » » DES_xcbc_encrypt(in,out,(long)EVP_MAXCHUNK,&data(ctx)->ks,
119 (DES_cblock *)&(ctx->iv[0]), 122 (DES_cblock *)&(ctx->iv[0]),
120 &data(ctx)->inw, 123 &data(ctx)->inw,
121 &data(ctx)->outw, 124 &data(ctx)->outw,
122 ctx->encrypt); 125 ctx->encrypt);
126 inl-=EVP_MAXCHUNK;
127 in +=EVP_MAXCHUNK;
128 out+=EVP_MAXCHUNK;
129 }
130 if (inl)
131 DES_xcbc_encrypt(in,out,(long)inl,&data(ctx)->ks,
132 (DES_cblock *)&(ctx->iv[0]),
133 &data(ctx)->inw,
134 &data(ctx)->outw,
135 ctx->encrypt);
123 return 1; 136 return 1;
124 } 137 }
125 #endif 138 #endif
OLDNEW
« no previous file with comments | « openssl/crypto/evp/e_seed.c ('k') | openssl/crypto/evp/enc_min.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698