mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-27 10:57:34 +09:00
re-introduce old nss im too tired for this
This commit is contained in:
parent
3c46be320d
commit
3a838106b9
2871 changed files with 1374431 additions and 1762417 deletions
|
|
@ -6,8 +6,6 @@
|
|||
* Interfaces.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "seccomon.h"
|
||||
#include "secmod.h"
|
||||
#include "nssilock.h"
|
||||
|
|
@ -31,7 +29,7 @@ pk11_FindRSAPubKey(PK11SlotInfo *slot)
|
|||
CK_KEY_TYPE key_type = CKK_RSA;
|
||||
CK_OBJECT_CLASS class_type = CKO_PUBLIC_KEY;
|
||||
CK_ATTRIBUTE theTemplate[2];
|
||||
size_t template_count = sizeof(theTemplate) / sizeof(theTemplate[0]);
|
||||
int template_count = sizeof(theTemplate) / sizeof(theTemplate[0]);
|
||||
CK_ATTRIBUTE *attrs = theTemplate;
|
||||
|
||||
PK11_SETATTRS(attrs, CKA_CLASS, &class_type, sizeof(class_type));
|
||||
|
|
@ -78,14 +76,15 @@ pk11_KeyExchange(PK11SlotInfo *slot, CK_MECHANISM_TYPE type,
|
|||
if (privKeyHandle == CK_INVALID_HANDLE) {
|
||||
PK11RSAGenParams rsaParams;
|
||||
|
||||
if (symKeyLength > 120) /* bytes */ {
|
||||
/* we'd have to generate an RSA key pair > 1024 bits long,
|
||||
if (symKeyLength > 53) /* bytes */ {
|
||||
/* we'd have to generate an RSA key pair > 512 bits long,
|
||||
** and that's too costly. Don't even try.
|
||||
*/
|
||||
PORT_SetError(SEC_ERROR_CANNOT_MOVE_SENSITIVE_KEY);
|
||||
goto rsa_failed;
|
||||
}
|
||||
rsaParams.keySizeInBits = 1024;
|
||||
rsaParams.keySizeInBits =
|
||||
(symKeyLength > 21 || symKeyLength == 0) ? 512 : 256;
|
||||
rsaParams.pe = 0x10001;
|
||||
privKey = PK11_GenerateKeyPair(slot, CKM_RSA_PKCS_KEY_PAIR_GEN,
|
||||
&rsaParams, &pubKey, PR_FALSE, PR_TRUE, symKey->cx);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue