mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-09 21:33:43 +00:00
fix unitialized key_type variable. Add asserts to it doesn't happen again.
This commit is contained in:
parent
bbb8b219af
commit
a119a2b900
@ -3068,7 +3068,7 @@ CK_RV NSC_GenerateKey(CK_SESSION_HANDLE hSession,
|
||||
PK11Session *session;
|
||||
PRBool checkWeak = PR_FALSE;
|
||||
CK_ULONG key_length = 0;
|
||||
CK_KEY_TYPE key_type;
|
||||
CK_KEY_TYPE key_type = -1;
|
||||
CK_OBJECT_CLASS objclass = CKO_SECRET_KEY;
|
||||
CK_RV crv = CKR_OK;
|
||||
CK_BBOOL cktrue = CK_TRUE;
|
||||
@ -3144,6 +3144,7 @@ CK_RV NSC_GenerateKey(CK_SESSION_HANDLE hSession,
|
||||
case CKM_NETSCAPE_PBE_MD5_HMAC_KEY_GEN:
|
||||
case CKM_NETSCAPE_PBE_MD2_HMAC_KEY_GEN:
|
||||
key_gen_type = pk11_pbe_hmac;
|
||||
key_type = CKK_GENERIC_SECRET;
|
||||
break;
|
||||
case CKM_NETSCAPE_PBE_SHA1_TRIPLE_DES_CBC:
|
||||
case CKM_NETSCAPE_PBE_SHA1_40_BIT_RC2_CBC:
|
||||
@ -3177,6 +3178,10 @@ CK_RV NSC_GenerateKey(CK_SESSION_HANDLE hSession,
|
||||
|
||||
if (crv != CKR_OK) { pk11_FreeObject(key); return crv; }
|
||||
|
||||
/* if there was no error,
|
||||
* key_type *MUST* be set in the switch statement above */
|
||||
PORT_Assert( key_type != -1 );
|
||||
|
||||
/*
|
||||
* now to the actual key gen.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user