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

Side by Side Diff: core/src/fdrm/crypto/fx_crypt_aes.cpp

Issue 1252613002: FX_BOOL considered harmful. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Manual edits. Created 5 years, 5 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
« no previous file with comments | « core/src/fdrm/crypto/fx_crypt.cpp ('k') | core/src/fdrm/crypto/fx_crypt_sha.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../../include/fdrm/fx_crypt.h" 7 #include "../../../include/fdrm/fx_crypt.h"
8 #ifdef __cplusplus 8 #ifdef __cplusplus
9 extern "C" { 9 extern "C" {
10 #endif 10 #endif
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 aes_encrypt(ctx, iv); 981 aes_encrypt(ctx, iv);
982 for (i = 0; i < 4; i++) { 982 for (i = 0; i < 4; i++) {
983 PUT_32BIT_MSB_FIRST(dest + 4 * i, iv[i]); 983 PUT_32BIT_MSB_FIRST(dest + 4 * i, iv[i]);
984 } 984 }
985 dest += 16; 985 dest += 16;
986 src += 16; 986 src += 16;
987 len -= 16; 987 len -= 16;
988 } 988 }
989 FXSYS_memcpy(ctx->iv, iv, sizeof(iv)); 989 FXSYS_memcpy(ctx->iv, iv, sizeof(iv));
990 } 990 }
991 void CRYPT_AESSetKey(void* context, FX_DWORD blocklen, const uint8_t* key, FX_DW ORD keylen, FX_BOOL bEncrypt) 991 void CRYPT_AESSetKey(void* context, FX_DWORD blocklen, const uint8_t* key, FX_DW ORD keylen, bool bEncrypt)
992 { 992 {
993 aes_setup((AESContext*)context, blocklen, key, keylen); 993 aes_setup((AESContext*)context, blocklen, key, keylen);
994 } 994 }
995 void CRYPT_AESSetIV(void* context, const uint8_t* iv) 995 void CRYPT_AESSetIV(void* context, const uint8_t* iv)
996 { 996 {
997 int i; 997 int i;
998 for (i = 0; i < ((AESContext*)context)->Nb; i++) { 998 for (i = 0; i < ((AESContext*)context)->Nb; i++) {
999 ((AESContext*)context)->iv[i] = GET_32BIT_MSB_FIRST(iv + 4 * i); 999 ((AESContext*)context)->iv[i] = GET_32BIT_MSB_FIRST(iv + 4 * i);
1000 } 1000 }
1001 } 1001 }
1002 void CRYPT_AESDecrypt(void* context, uint8_t* dest, const uint8_t* src, FX_DWORD len) 1002 void CRYPT_AESDecrypt(void* context, uint8_t* dest, const uint8_t* src, FX_DWORD len)
1003 { 1003 {
1004 aes_decrypt_cbc(dest, src, len, (AESContext*)context); 1004 aes_decrypt_cbc(dest, src, len, (AESContext*)context);
1005 } 1005 }
1006 void CRYPT_AESEncrypt(void* context, uint8_t* dest, const uint8_t* src, FX_DWORD len) 1006 void CRYPT_AESEncrypt(void* context, uint8_t* dest, const uint8_t* src, FX_DWORD len)
1007 { 1007 {
1008 aes_encrypt_cbc(dest, src, len, (AESContext*)context); 1008 aes_encrypt_cbc(dest, src, len, (AESContext*)context);
1009 } 1009 }
1010 #ifdef __cplusplus 1010 #ifdef __cplusplus
1011 }; 1011 };
1012 #endif 1012 #endif
OLDNEW
« no previous file with comments | « core/src/fdrm/crypto/fx_crypt.cpp ('k') | core/src/fdrm/crypto/fx_crypt_sha.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698