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

Side by Side Diff: openssl/crypto/evp/e_aes.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/digest.c ('k') | openssl/crypto/evp/e_camellia.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 /* ==================================================================== 1 /* ====================================================================
2 * Copyright (c) 2001 The OpenSSL Project. All rights reserved. 2 * Copyright (c) 2001 The OpenSSL Project. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 10 *
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 typedef struct 63 typedef struct
64 { 64 {
65 AES_KEY ks; 65 AES_KEY ks;
66 } EVP_AES_KEY; 66 } EVP_AES_KEY;
67 67
68 #define data(ctx) EVP_C_DATA(EVP_AES_KEY,ctx) 68 #define data(ctx) EVP_C_DATA(EVP_AES_KEY,ctx)
69 69
70 IMPLEMENT_BLOCK_CIPHER(aes_128, ks, AES, EVP_AES_KEY, 70 IMPLEMENT_BLOCK_CIPHER(aes_128, ks, AES, EVP_AES_KEY,
71 NID_aes_128, 16, 16, 16, 128, 71 NID_aes_128, 16, 16, 16, 128,
72 » » EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_DEFAULT_ASN1, 72 » » 0, aes_init_key, NULL,
73 » » aes_init_key, 73 » » EVP_CIPHER_set_asn1_iv,
74 » » NULL, NULL, NULL, NULL) 74 » » EVP_CIPHER_get_asn1_iv,
75 » » NULL)
75 IMPLEMENT_BLOCK_CIPHER(aes_192, ks, AES, EVP_AES_KEY, 76 IMPLEMENT_BLOCK_CIPHER(aes_192, ks, AES, EVP_AES_KEY,
76 NID_aes_192, 16, 24, 16, 128, 77 NID_aes_192, 16, 24, 16, 128,
77 » » EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_DEFAULT_ASN1, 78 » » 0, aes_init_key, NULL,
78 » » aes_init_key, 79 » » EVP_CIPHER_set_asn1_iv,
79 » » NULL, NULL, NULL, NULL) 80 » » EVP_CIPHER_get_asn1_iv,
81 » » NULL)
80 IMPLEMENT_BLOCK_CIPHER(aes_256, ks, AES, EVP_AES_KEY, 82 IMPLEMENT_BLOCK_CIPHER(aes_256, ks, AES, EVP_AES_KEY,
81 NID_aes_256, 16, 32, 16, 128, 83 NID_aes_256, 16, 32, 16, 128,
82 » » EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_DEFAULT_ASN1, 84 » » 0, aes_init_key, NULL,
83 » » aes_init_key, 85 » » EVP_CIPHER_set_asn1_iv,
84 » » NULL, NULL, NULL, NULL) 86 » » EVP_CIPHER_get_asn1_iv,
87 » » NULL)
85 88
86 #define IMPLEMENT_AES_CFBR(ksize,cbits,flags)» IMPLEMENT_CFBR(aes,AES,EVP_AES_K EY,ks,ksize,cbits,16,flags) 89 #define IMPLEMENT_AES_CFBR(ksize,cbits)»IMPLEMENT_CFBR(aes,AES,EVP_AES_KEY,ks,ks ize,cbits,16)
87 90
88 IMPLEMENT_AES_CFBR(128,1,EVP_CIPH_FLAG_FIPS) 91 IMPLEMENT_AES_CFBR(128,1)
89 IMPLEMENT_AES_CFBR(192,1,EVP_CIPH_FLAG_FIPS) 92 IMPLEMENT_AES_CFBR(192,1)
90 IMPLEMENT_AES_CFBR(256,1,EVP_CIPH_FLAG_FIPS) 93 IMPLEMENT_AES_CFBR(256,1)
91 94
92 IMPLEMENT_AES_CFBR(128,8,EVP_CIPH_FLAG_FIPS) 95 IMPLEMENT_AES_CFBR(128,8)
93 IMPLEMENT_AES_CFBR(192,8,EVP_CIPH_FLAG_FIPS) 96 IMPLEMENT_AES_CFBR(192,8)
94 IMPLEMENT_AES_CFBR(256,8,EVP_CIPH_FLAG_FIPS) 97 IMPLEMENT_AES_CFBR(256,8)
95 98
96 static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 99 static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
97 const unsigned char *iv, int enc) 100 const unsigned char *iv, int enc)
98 { 101 {
99 int ret; 102 int ret;
100 103
101 if ((ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_CFB_MODE 104 if ((ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_CFB_MODE
102 || (ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_OFB_MODE 105 || (ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_OFB_MODE
103 || enc) 106 || enc)
104 ret=AES_set_encrypt_key(key, ctx->key_len * 8, ctx->cipher_data) ; 107 ret=AES_set_encrypt_key(key, ctx->key_len * 8, ctx->cipher_data) ;
105 else 108 else
106 ret=AES_set_decrypt_key(key, ctx->key_len * 8, ctx->cipher_data) ; 109 ret=AES_set_decrypt_key(key, ctx->key_len * 8, ctx->cipher_data) ;
107 110
108 if(ret < 0) 111 if(ret < 0)
109 { 112 {
110 EVPerr(EVP_F_AES_INIT_KEY,EVP_R_AES_KEY_SETUP_FAILED); 113 EVPerr(EVP_F_AES_INIT_KEY,EVP_R_AES_KEY_SETUP_FAILED);
111 return 0; 114 return 0;
112 } 115 }
113 116
114 return 1; 117 return 1;
115 } 118 }
116 119
117 #endif 120 #endif
OLDNEW
« no previous file with comments | « openssl/crypto/evp/digest.c ('k') | openssl/crypto/evp/e_camellia.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698