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

Unified Diff: nss/lib/freebl/rijndael.c

Issue 214183004: Implement AES in different modes of operation, using AES-NI and (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/nss.git@master
Patch Set: Remove an assertion. ctr->cipher doesn't set *outlen. Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « nss/lib/freebl/intel-gcm-x86-masm.asm ('k') | patches/nss-intel-aes-windows.patch » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: nss/lib/freebl/rijndael.c
diff --git a/nss/lib/freebl/rijndael.c b/nss/lib/freebl/rijndael.c
index 8bb8905130f30095cd114cb41185e263b28c0d75..970386749b2f4f97dc2f6b30d84fae3736d835fe 100644
--- a/nss/lib/freebl/rijndael.c
+++ b/nss/lib/freebl/rijndael.c
@@ -1063,8 +1063,10 @@ aes_InitContext(AESContext *cx, const unsigned char *key, unsigned int keysize,
intel_aes_cbc_worker(encrypt, keysize);
} else
#endif
+ {
cx->worker = (freeblCipherFunc) (encrypt
? &rijndael_encryptCBC : &rijndael_decryptCBC);
+ }
} else {
#if USE_HW_AES
if (use_hw_aes) {
@@ -1072,8 +1074,10 @@ aes_InitContext(AESContext *cx, const unsigned char *key, unsigned int keysize,
intel_aes_ecb_worker(encrypt, keysize);
} else
#endif
+ {
cx->worker = (freeblCipherFunc) (encrypt
? &rijndael_encryptECB : &rijndael_decryptECB);
+ }
}
PORT_Assert((cx->Nb * (cx->Nr + 1)) <= RIJNDAEL_MAX_EXP_KEY_SIZE);
if ((cx->Nb * (cx->Nr + 1)) > RIJNDAEL_MAX_EXP_KEY_SIZE) {
@@ -1171,7 +1175,14 @@ AES_InitContext(AESContext *cx, const unsigned char *key, unsigned int keysize,
break;
case NSS_AES_CTR:
cx->worker_cx = CTR_CreateContext(cx, cx->worker, iv, blocksize);
- cx->worker = (freeblCipherFunc) CTR_Update ;
+#if defined(USE_HW_AES) && defined(_MSC_VER)
+ if (use_hw_aes) {
+ cx->worker = (freeblCipherFunc) CTR_Update_HW_AES;
+ } else
+#endif
+ {
+ cx->worker = (freeblCipherFunc) CTR_Update;
+ }
cx->destroy = (freeblDestroyFunc) CTR_DestroyContext;
cx->isBlock = PR_FALSE;
break;
« no previous file with comments | « nss/lib/freebl/intel-gcm-x86-masm.asm ('k') | patches/nss-intel-aes-windows.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698