Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 | 4 |
| 5 #ifdef FREEBL_NO_DEPEND | 5 #ifdef FREEBL_NO_DEPEND |
| 6 #include "stubs.h" | 6 #include "stubs.h" |
| 7 #endif | 7 #endif |
| 8 | 8 |
| 9 #include "prinit.h" | 9 #include "prinit.h" |
| 10 #include "prerr.h" | 10 #include "prerr.h" |
| (...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1164 { | 1164 { |
| 1165 cx->worker_cx = GCM_CreateContext(cx, cx->worker, iv, blocksize); | 1165 cx->worker_cx = GCM_CreateContext(cx, cx->worker, iv, blocksize); |
| 1166 cx->worker = (freeblCipherFunc) | 1166 cx->worker = (freeblCipherFunc) |
| 1167 (encrypt ? GCM_EncryptUpdate : GCM_DecryptUpdate); | 1167 (encrypt ? GCM_EncryptUpdate : GCM_DecryptUpdate); |
| 1168 cx->destroy = (freeblDestroyFunc) GCM_DestroyContext; | 1168 cx->destroy = (freeblDestroyFunc) GCM_DestroyContext; |
| 1169 cx->isBlock = PR_FALSE; | 1169 cx->isBlock = PR_FALSE; |
| 1170 } | 1170 } |
| 1171 break; | 1171 break; |
| 1172 case NSS_AES_CTR: | 1172 case NSS_AES_CTR: |
| 1173 cx->worker_cx = CTR_CreateContext(cx, cx->worker, iv, blocksize); | 1173 cx->worker_cx = CTR_CreateContext(cx, cx->worker, iv, blocksize); |
| 1174 » cx->worker = (freeblCipherFunc) CTR_Update ; | 1174 #if defined(USE_HW_AES) && defined(_MSC_VER) |
| 1175 » if (use_hw_aes) | |
| 1176 » cx->worker = (freeblCipherFunc) CTR_Update_HW_AES; | |
| 1177 » else | |
| 1178 #endif | |
| 1179 » cx->worker = (freeblCipherFunc) CTR_Update; | |
|
Ryan Sleevi
2014/04/23 19:53:34
Seems better to use explicit braces in this condit
wtc
2014/04/24 01:04:10
Done.
| |
| 1175 cx->destroy = (freeblDestroyFunc) CTR_DestroyContext; | 1180 cx->destroy = (freeblDestroyFunc) CTR_DestroyContext; |
| 1176 cx->isBlock = PR_FALSE; | 1181 cx->isBlock = PR_FALSE; |
| 1177 break; | 1182 break; |
| 1178 default: | 1183 default: |
| 1179 /* everything has already been set up by aes_InitContext, just | 1184 /* everything has already been set up by aes_InitContext, just |
| 1180 * return */ | 1185 * return */ |
| 1181 return SECSuccess; | 1186 return SECSuccess; |
| 1182 } | 1187 } |
| 1183 /* check to see if we succeeded in getting the worker context */ | 1188 /* check to see if we succeeded in getting the worker context */ |
| 1184 if (cx->worker_cx == NULL) { | 1189 if (cx->worker_cx == NULL) { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1284 return SECFailure; | 1289 return SECFailure; |
| 1285 } | 1290 } |
| 1286 if (maxOutputLen < inputLen) { | 1291 if (maxOutputLen < inputLen) { |
| 1287 PORT_SetError(SEC_ERROR_OUTPUT_LEN); | 1292 PORT_SetError(SEC_ERROR_OUTPUT_LEN); |
| 1288 return SECFailure; | 1293 return SECFailure; |
| 1289 } | 1294 } |
| 1290 *outputLen = inputLen; | 1295 *outputLen = inputLen; |
| 1291 return (*cx->worker)(cx->worker_cx, output, outputLen, maxOutputLen, | 1296 return (*cx->worker)(cx->worker_cx, output, outputLen, maxOutputLen, |
| 1292 input, inputLen, blocksize); | 1297 input, inputLen, blocksize); |
| 1293 } | 1298 } |
| OLD | NEW |