Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 36115
Collapse All | Expand All

(-)nss_oaep.c (-1 lines)
Lines 20-26 Link Here
20
 */
20
 */
21
21
22
#include "pk11func.h"
22
#include "pk11func.h"
23
#include "secrng.h"
24
#include "keyhi.h"
23
#include "keyhi.h"
25
24
26
/* for g_assert; PORT_Assert seems disabled... */
25
/* for g_assert; PORT_Assert seems disabled... */
(-)nss_pss.c (-1 lines)
Lines 20-26 Link Here
20
 */
20
 */
21
21
22
#include "pk11func.h"
22
#include "pk11func.h"
23
#include "secrng.h"
24
#include "keyhi.h"
23
#include "keyhi.h"
25
24
26
/* for g_assert; PORT_Assert seems disabled... */
25
/* for g_assert; PORT_Assert seems disabled... */
(-)rsa_nss.c (-5 / +21 lines)
Lines 29-35 Link Here
29
#include <nspr.h>
29
#include <nspr.h>
30
#include <nss.h>
30
#include <nss.h>
31
#include <pk11func.h>
31
#include <pk11func.h>
32
#include <secrng.h>
33
#include <keyhi.h>
32
#include <keyhi.h>
34
#include <nssb64.h>
33
#include <nssb64.h>
35
34
Lines 440-447 Link Here
440
   const CK_MECHANISM_TYPE SymEncryptionType = CKM_DES3_CBC_PAD;
439
   const CK_MECHANISM_TYPE SymEncryptionType = CKM_DES3_CBC_PAD;
441
   PK11SlotInfo *symSlot;
440
   PK11SlotInfo *symSlot;
442
   PK11SymKey *symKey;
441
   PK11SymKey *symKey;
442
   SECItem *pubKeyValue;
443
   SECItem symKeyItem;  /* storage space for binary key import */
443
   SECItem symKeyItem;  /* storage space for binary key import */
444
   unsigned char symKeyData[32] = {0};
444
   unsigned char symKeyData[24] = {0};
445
   SECItem *iv = 0, *wrappedKey = 0, label;
445
   SECItem *iv = 0, *wrappedKey = 0, label;
446
   CK_ATTRIBUTE_TYPE attribs[3] = { CKA_SIGN, CKA_DECRYPT, CKA_SIGN_RECOVER };
446
   CK_ATTRIBUTE_TYPE attribs[3] = { CKA_SIGN, CKA_DECRYPT, CKA_SIGN_RECOVER };
447
   const int NumAttribs = 3;
447
   const int NumAttribs = 3;
Lines 454-459 Link Here
454
   /* NNNN is the Base64 encoding of the IV, and                      */
454
   /* NNNN is the Base64 encoding of the IV, and                      */
455
   /* MMMM is the Base64 encoding of the encrypted private key        */
455
   /* MMMM is the Base64 encoding of the encrypted private key        */
456
456
457
457
   key->proto = rsa_nss_proto;
458
   key->proto = rsa_nss_proto;
458
   
459
   
459
   split_key = g_strsplit(key_str, ",", 3);
460
   split_key = g_strsplit(key_str, ",", 3);
Lines 546-551 Link Here
546
      return 0;
547
      return 0;
547
   }
548
   }
548
549
550
   pubKeyValue = SECITEM_DupItem(&key->store.rsa_nss.pub->u.rsa.modulus);
551
549
   symSlot = PK11_GetBestSlot(SymEncryptionType, NULL);
552
   symSlot = PK11_GetBestSlot(SymEncryptionType, NULL);
550
   g_assert(symSlot != 0);
553
   g_assert(symSlot != 0);
551
   
554
   
Lines 554-570 Link Here
554
   
557
   
555
   symKey  = PK11_ImportSymKey(symSlot, PK11_GetKeyGen(SymEncryptionType),
558
   symKey  = PK11_ImportSymKey(symSlot, PK11_GetKeyGen(SymEncryptionType),
556
                               PK11_OriginUnwrap, CKA_WRAP, &symKeyItem, NULL);
559
                               PK11_OriginUnwrap, CKA_WRAP, &symKeyItem, NULL);
557
   
560
561
   if (!symKey) {
562
      gaim_debug(GAIM_DEBUG_ERROR, "gaim-encryption",
563
                 "Error creating symmetric key: unable to load private key\n");
564
      g_strfreev(split_key);
565
566
      SECKEY_DestroyPublicKey(key->store.rsa_nss.pub);
567
      SECITEM_FreeItem (pubKeyValue, PR_TRUE);
568
      g_free(key);
569
      return 0;
570
   }
571
558
   label.data = NULL; label.len = 0;
572
   label.data = NULL; label.len = 0;
559
573
560
   key->store.rsa_nss.priv =
574
   key->store.rsa_nss.priv =
561
      PK11_UnwrapPrivKey(symSlot, symKey, SymEncryptionType, iv,
575
      PK11_UnwrapPrivKey(symSlot, symKey, SymEncryptionType, iv,
562
                         wrappedKey, &label, &(key->store.rsa_nss.pub->u.rsa.modulus),
576
                         wrappedKey, &label, pubKeyValue,
563
                         PR_FALSE, PR_FALSE, CKK_RSA, attribs, NumAttribs, 0);
577
                         PR_FALSE, PR_FALSE, CKK_RSA, attribs, NumAttribs, 0);
564
   
578
   
579
   SECITEM_FreeItem (pubKeyValue, PR_TRUE);
580
565
   if (key->store.rsa_nss.priv == 0) {
581
   if (key->store.rsa_nss.priv == 0) {
566
      gaim_debug(GAIM_DEBUG_ERROR, "gaim-encryption", 
582
      gaim_debug(GAIM_DEBUG_ERROR, "gaim-encryption", 
567
                 "Error decoding RSANSS Public key\n");
583
                 "Error decoding RSANSS Private key\n");
568
      g_strfreev(split_key);
584
      g_strfreev(split_key);
569
585
570
      SECKEY_DestroyPublicKey(key->store.rsa_nss.pub);
586
      SECKEY_DestroyPublicKey(key->store.rsa_nss.pub);

Return to bug 36115