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

Unified Diff: mozilla/security/nss/lib/pk11wrap/pk11obj.c

Issue 13327005: PK11_DecryptWithSymKey and PK11_EncryptWithSymKey have been (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/nss/
Patch Set: Created 7 years, 9 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 | « mozilla/security/nss/lib/freebl/gcm.c ('k') | mozilla/security/nss/lib/pk11wrap/pk11pub.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mozilla/security/nss/lib/pk11wrap/pk11obj.c
===================================================================
--- mozilla/security/nss/lib/pk11wrap/pk11obj.c (revision 190723)
+++ mozilla/security/nss/lib/pk11wrap/pk11obj.c (working copy)
@@ -823,11 +823,11 @@
}
SECStatus
-PK11_EncryptWithSymKey(PK11SymKey *symKey,
- CK_MECHANISM_TYPE mechanism, SECItem *param,
- unsigned char *out, unsigned int *outLen,
- unsigned int maxLen,
- const unsigned char *data, unsigned dataLen)
+PK11_Decrypt(PK11SymKey *symKey,
+ CK_MECHANISM_TYPE mechanism, SECItem *param,
+ unsigned char *out, unsigned int *outLen,
+ unsigned int maxLen,
+ const unsigned char *enc, unsigned encLen)
{
PK11SlotInfo *slot = symKey->slot;
CK_MECHANISM mech = {0, NULL, 0 };
@@ -846,17 +846,18 @@
session = pk11_GetNewSession(slot, &owner);
haslock = (!owner || !slot->isThreadSafe);
if (haslock) PK11_EnterSlotMonitor(slot);
- crv = PK11_GETTAB(slot)->C_EncryptInit(session, &mech, symKey->objectID);
+ crv = PK11_GETTAB(slot)->C_DecryptInit(session, &mech, symKey->objectID);
if (crv != CKR_OK) {
if (haslock) PK11_ExitSlotMonitor(slot);
- pk11_CloseSession(slot,session,owner);
+ pk11_CloseSession(slot, session, owner);
PORT_SetError( PK11_MapError(crv) );
return SECFailure;
}
- crv = PK11_GETTAB(slot)->C_Encrypt(session, (unsigned char *)data,
- dataLen, out, &len);
+
+ crv = PK11_GETTAB(slot)->C_Decrypt(session, (unsigned char *)enc, encLen,
+ out, &len);
if (haslock) PK11_ExitSlotMonitor(slot);
- pk11_CloseSession(slot,session,owner);
+ pk11_CloseSession(slot, session, owner);
*outLen = len;
if (crv != CKR_OK) {
PORT_SetError( PK11_MapError(crv) );
@@ -866,11 +867,11 @@
}
SECStatus
-PK11_DecryptWithSymKey(PK11SymKey *symKey,
- CK_MECHANISM_TYPE mechanism, SECItem *param,
- unsigned char *out, unsigned int *outLen,
- unsigned int maxLen,
- const unsigned char *enc, unsigned encLen)
+PK11_Encrypt(PK11SymKey *symKey,
+ CK_MECHANISM_TYPE mechanism, SECItem *param,
+ unsigned char *out, unsigned int *outLen,
+ unsigned int maxLen,
+ const unsigned char *data, unsigned int dataLen)
{
PK11SlotInfo *slot = symKey->slot;
CK_MECHANISM mech = {0, NULL, 0 };
@@ -889,18 +890,17 @@
session = pk11_GetNewSession(slot, &owner);
haslock = (!owner || !slot->isThreadSafe);
if (haslock) PK11_EnterSlotMonitor(slot);
- crv = PK11_GETTAB(slot)->C_DecryptInit(session, &mech, symKey->objectID);
+ crv = PK11_GETTAB(slot)->C_EncryptInit(session, &mech, symKey->objectID);
if (crv != CKR_OK) {
if (haslock) PK11_ExitSlotMonitor(slot);
- pk11_CloseSession(slot, session, owner);
+ pk11_CloseSession(slot,session,owner);
PORT_SetError( PK11_MapError(crv) );
return SECFailure;
}
-
- crv = PK11_GETTAB(slot)->C_Decrypt(session, (unsigned char *)enc, encLen,
- out, &len);
+ crv = PK11_GETTAB(slot)->C_Encrypt(session, (unsigned char *)data,
+ dataLen, out, &len);
if (haslock) PK11_ExitSlotMonitor(slot);
- pk11_CloseSession(slot, session, owner);
+ pk11_CloseSession(slot,session,owner);
*outLen = len;
ramant (doing other things) 2013/03/29 19:35:10 nit: why delete spaces between arguments in line#
wtc 2013/03/29 20:52:19 What I did here was to reorder the PK11_Encrypt an
if (crv != CKR_OK) {
PORT_SetError( PK11_MapError(crv) );
« no previous file with comments | « mozilla/security/nss/lib/freebl/gcm.c ('k') | mozilla/security/nss/lib/pk11wrap/pk11pub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698