зеркало из https://github.com/mozilla/pjs.git
Bugzilla Bug 298957: added new function PK11_TokenKeyGenWithFlags.
r=relyea,nelsonb. Modified files: nss/nss.def pk11wrap/pk11pub.h pk11wrap/pk11skey.c
This commit is contained in:
Родитель
905c1e3baf
Коммит
a55ffcb3aa
|
@ -850,3 +850,9 @@ NSS_Get_CERT_SignedCrlTemplate;
|
|||
;+ local:
|
||||
;+ *;
|
||||
;+};
|
||||
;+NSS_3.11 { # NSS 3.11 release
|
||||
;+ global:
|
||||
PK11_TokenKeyGenWithFlags;
|
||||
;+ local:
|
||||
;+ *;
|
||||
;+};
|
||||
|
|
|
@ -236,6 +236,10 @@ PK11SymKey *PK11_KeyGen(PK11SlotInfo *slot,CK_MECHANISM_TYPE type,
|
|||
PK11SymKey *PK11_TokenKeyGen(PK11SlotInfo *slot, CK_MECHANISM_TYPE type,
|
||||
SECItem *param, int keySize, SECItem *keyid,
|
||||
PRBool isToken, void *wincx);
|
||||
PK11SymKey *PK11_TokenKeyGenWithFlags(PK11SlotInfo *slot,
|
||||
CK_MECHANISM_TYPE type, SECItem *param,
|
||||
int keySize, SECItem *keyid, CK_FLAGS flags,
|
||||
PRBool isToken, void *wincx);
|
||||
PK11SymKey * PK11_ListFixedKeysInSlot(PK11SlotInfo *slot, char *nickname,
|
||||
void *wincx);
|
||||
PK11SymKey *PK11_GetNextSymKey(PK11SymKey *symKey);
|
||||
|
|
|
@ -771,11 +771,12 @@ PK11_MoveSymKey(PK11SlotInfo *slot, CK_ATTRIBUTE_TYPE operation,
|
|||
* from this interface!
|
||||
*/
|
||||
PK11SymKey *
|
||||
PK11_TokenKeyGen(PK11SlotInfo *slot, CK_MECHANISM_TYPE type, SECItem *param,
|
||||
int keySize, SECItem *keyid, PRBool isToken, void *wincx)
|
||||
PK11_TokenKeyGenWithFlags(PK11SlotInfo *slot, CK_MECHANISM_TYPE type,
|
||||
SECItem *param, int keySize, SECItem *keyid, CK_FLAGS flags,
|
||||
PRBool isToken, void *wincx)
|
||||
{
|
||||
PK11SymKey *symKey;
|
||||
CK_ATTRIBUTE genTemplate[6];
|
||||
CK_ATTRIBUTE genTemplate[MAX_TEMPL_ATTRS];
|
||||
CK_ATTRIBUTE *attrs = genTemplate;
|
||||
int count = sizeof(genTemplate)/sizeof(genTemplate[0]);
|
||||
CK_SESSION_HANDLE session;
|
||||
|
@ -791,8 +792,7 @@ PK11_TokenKeyGen(PK11SlotInfo *slot, CK_MECHANISM_TYPE type, SECItem *param,
|
|||
}
|
||||
|
||||
/* TNH: Isn't this redundant, since "handleKey" will set defaults? */
|
||||
PK11_SETATTRS(attrs, (!weird)
|
||||
? CKA_ENCRYPT : CKA_DECRYPT, &cktrue, sizeof(CK_BBOOL)); attrs++;
|
||||
flags |= (!weird) ? CKF_ENCRYPT : CKF_DECRYPT;
|
||||
|
||||
if (keySize != 0) {
|
||||
ck_key_size = keySize; /* Convert to PK11 type */
|
||||
|
@ -811,7 +811,7 @@ PK11_TokenKeyGen(PK11SlotInfo *slot, CK_MECHANISM_TYPE type, SECItem *param,
|
|||
PK11_SETATTRS(attrs, CKA_PRIVATE, &cktrue, sizeof(cktrue)); attrs++;
|
||||
}
|
||||
|
||||
PK11_SETATTRS(attrs, CKA_SIGN, &cktrue, sizeof(cktrue)); attrs++;
|
||||
attrs += pk11_FlagsToAttributes(flags, attrs, &cktrue);
|
||||
|
||||
count = attrs - genTemplate;
|
||||
PR_ASSERT(count <= sizeof(genTemplate)/sizeof(CK_ATTRIBUTE));
|
||||
|
@ -882,6 +882,14 @@ PK11_TokenKeyGen(PK11SlotInfo *slot, CK_MECHANISM_TYPE type, SECItem *param,
|
|||
return symKey;
|
||||
}
|
||||
|
||||
PK11SymKey *
|
||||
PK11_TokenKeyGen(PK11SlotInfo *slot, CK_MECHANISM_TYPE type, SECItem *param,
|
||||
int keySize, SECItem *keyid, PRBool isToken, void *wincx)
|
||||
{
|
||||
return PK11_TokenKeyGenWithFlags(slot, type, param, keySize, keyid,
|
||||
CKF_SIGN, isToken, wincx);
|
||||
}
|
||||
|
||||
PK11SymKey *
|
||||
PK11_KeyGen(PK11SlotInfo *slot, CK_MECHANISM_TYPE type, SECItem *param,
|
||||
int keySize, void *wincx)
|
||||
|
|
Загрузка…
Ссылка в новой задаче