Bug 618496: stripping out unused WeaveCrypto attributes. r=philiKON
authorRichard Newman <rnewman@mozilla.com>
Tue, 01 Mar 2011 21:37:44 -0800
changeset 63303 aa2115807bded25ec70be41d2655f930f8996837
parent 63273 2b14cbd242f2fa60c7fd2d4ada69a2ef95ed3ba4
child 63304 ab322645172b7f94a0af3089952b8e3f0c553a99
push id1
push userroot
push dateTue, 10 Dec 2013 15:46:25 +0000
reviewersphiliKON
bugs618496
Bug 618496: stripping out unused WeaveCrypto attributes. r=philiKON
services/crypto/modules/WeaveCrypto.js
--- a/services/crypto/modules/WeaveCrypto.js
+++ b/services/crypto/modules/WeaveCrypto.js
@@ -166,62 +166,21 @@ WeaveCrypto.prototype = {
         // typedef PRUint32 PK11AttrFlags;
         this.nss_t.PK11AttrFlags = ctypes.unsigned_int;
         // security/nss/lib/util/seccomon.h#83
         // typedef struct SECItemStr SECItem; --> SECItemStr defined right below it
         this.nss_t.SECItem = ctypes.StructType(
             "SECItem", [{ type: this.nss_t.SECItemType },
                         { data: ctypes.unsigned_char.ptr },
                         { len : ctypes.int }]);
-        // security/nss/lib/softoken/secmodt.h#65
-        // typedef struct PK11RSAGenParamsStr --> def'n on line 139
-        this.nss_t.PK11RSAGenParams = ctypes.StructType(
-            "PK11RSAGenParams", [{ keySizeInBits: ctypes.int },
-                                 { pe : ctypes.unsigned_long }]);
-        // security/nss/lib/cryptohi/keythi.h#233
-        // typedef struct SECKEYPrivateKeyStr SECKEYPrivateKey; --> def'n right above it
-        this.nss_t.SECKEYPrivateKey = ctypes.StructType(
-            "SECKEYPrivateKey", [{ arena:        this.nss_t.PLArenaPool.ptr  },
-                                 { keyType:      this.nss_t.KeyType          },
-                                 { pkcs11Slot:   this.nss_t.PK11SlotInfo.ptr },
-                                 { pkcs11ID:     this.nss_t.CK_OBJECT_HANDLE },
-                                 { pkcs11IsTemp: this.nss_t.PRBool           },
-                                 { wincx:        ctypes.voidptr_t            },
-                                 { staticflags:  ctypes.unsigned_int         }]);
-        // security/nss/lib/cryptohi/keythi.h#78
-        // typedef struct SECKEYRSAPublicKeyStr --> def'n right above it
-        this.nss_t.SECKEYRSAPublicKey = ctypes.StructType(
-            "SECKEYRSAPublicKey", [{ arena:          this.nss_t.PLArenaPool.ptr },
-                                   { modulus:        this.nss_t.SECItem         },
-                                   { publicExponent: this.nss_t.SECItem         }]);
-        // security/nss/lib/cryptohi/keythi.h#189
-        // typedef struct SECKEYPublicKeyStr SECKEYPublicKey; --> def'n right above it
-        this.nss_t.SECKEYPublicKey = ctypes.StructType(
-            "SECKEYPublicKey", [{ arena:      this.nss_t.PLArenaPool.ptr    },
-                                { keyType:    this.nss_t.KeyType            },
-                                { pkcs11Slot: this.nss_t.PK11SlotInfo.ptr   },
-                                { pkcs11ID:   this.nss_t.CK_OBJECT_HANDLE   },
-                                { rsa:        this.nss_t.SECKEYRSAPublicKey } ]);
-                                // XXX: "rsa" et al into a union here!
-                                // { dsa: SECKEYDSAPublicKey },
-                                // { dh:  SECKEYDHPublicKey },
-                                // { kea: SECKEYKEAPublicKey },
-                                // { fortezza: SECKEYFortezzaPublicKey },
-                                // { ec:  SECKEYECPublicKey } ]);
         // security/nss/lib/util/secoidt.h#52
         // typedef struct SECAlgorithmIDStr --> def'n right below it
         this.nss_t.SECAlgorithmID = ctypes.StructType(
             "SECAlgorithmID", [{ algorithm:  this.nss_t.SECItem },
                                { parameters: this.nss_t.SECItem }]);
-        // security/nss/lib/certdb/certt.h#98
-        // typedef struct CERTSubjectPublicKeyInfoStrA --> def'n on line 160
-        this.nss_t.CERTSubjectPublicKeyInfo = ctypes.StructType(
-            "CERTSubjectPublicKeyInfo", [{ arena:            this.nss_t.PLArenaPool.ptr },
-                                         { algorithm:        this.nss_t.SECAlgorithmID  },
-                                         { subjectPublicKey: this.nss_t.SECItem         }]);
 
 
         // security/nss/lib/util/pkcs11t.h
         this.nss.CKK_RSA = 0x0;
         this.nss.CKM_RSA_PKCS_KEY_PAIR_GEN = 0x0000;
         this.nss.CKM_AES_KEY_GEN           = 0x1080; 
         this.nss.CKA_ENCRYPT = 0x104;
         this.nss.CKA_DECRYPT = 0x105;
@@ -315,97 +274,30 @@ WeaveCrypto.prototype = {
                                                 ctypes.int.ptr, ctypes.int, ctypes.unsigned_char.ptr, ctypes.int);
         // security/nss/lib/pk11wrap/pk11pub.h#688
         // SECStatus PK11_DigestFinal(PK11Context *context, unsigned char *data,
         //                            unsigned int *outLen, unsigned int length);
         this.nss.PK11_DigestFinal = nsslib.declare("PK11_DigestFinal",
                                                    ctypes.default_abi, this.nss_t.SECStatus,
                                                    this.nss_t.PK11Context.ptr, ctypes.unsigned_char.ptr,
                                                    ctypes.unsigned_int.ptr, ctypes.unsigned_int);
-        // security/nss/lib/pk11wrap/pk11pub.h#507
-        // SECKEYPrivateKey *PK11_GenerateKeyPairWithFlags(PK11SlotInfo *slot,
-        //                                                 CK_MECHANISM_TYPE type, void *param, SECKEYPublicKey **pubk,
-        //                                                 PK11AttrFlags attrFlags, void *wincx);
-        this.nss.PK11_GenerateKeyPairWithFlags = nsslib.declare("PK11_GenerateKeyPairWithFlags",
-                                                   ctypes.default_abi, this.nss_t.SECKEYPrivateKey.ptr,
-                                                   this.nss_t.PK11SlotInfo.ptr, this.nss_t.CK_MECHANISM_TYPE, ctypes.voidptr_t,
-                                                   this.nss_t.SECKEYPublicKey.ptr.ptr, this.nss_t.PK11AttrFlags, ctypes.voidptr_t);
-        // security/nss/lib/pk11wrap/pk11pub.h#466
-        // SECStatus PK11_SetPrivateKeyNickname(SECKEYPrivateKey *privKey, const char *nickname);
-        this.nss.PK11_SetPrivateKeyNickname = nsslib.declare("PK11_SetPrivateKeyNickname",
-                                                             ctypes.default_abi, this.nss_t.SECStatus,
-                                                             this.nss_t.SECKEYPrivateKey.ptr, ctypes.char.ptr);
         // security/nss/lib/pk11wrap/pk11pub.h#731
         // SECAlgorithmID * PK11_CreatePBEV2AlgorithmID(SECOidTag pbeAlgTag, SECOidTag cipherAlgTag,
         //                                              SECOidTag prfAlgTag, int keyLength, int iteration,
         //                                              SECItem *salt);
         this.nss.PK11_CreatePBEV2AlgorithmID = nsslib.declare("PK11_CreatePBEV2AlgorithmID",
                                                               ctypes.default_abi, this.nss_t.SECAlgorithmID.ptr,
                                                               this.nss_t.SECOidTag, this.nss_t.SECOidTag, this.nss_t.SECOidTag, 
                                                               ctypes.int, ctypes.int, this.nss_t.SECItem.ptr);
         // security/nss/lib/pk11wrap/pk11pub.h#736
         // PK11SymKey * PK11_PBEKeyGen(PK11SlotInfo *slot, SECAlgorithmID *algid,  SECItem *pwitem, PRBool faulty3DES, void *wincx);
         this.nss.PK11_PBEKeyGen = nsslib.declare("PK11_PBEKeyGen",
                                                  ctypes.default_abi, this.nss_t.PK11SymKey.ptr,
                                                  this.nss_t.PK11SlotInfo.ptr, this.nss_t.SECAlgorithmID.ptr,
                                                  this.nss_t.SECItem.ptr, this.nss_t.PRBool, ctypes.voidptr_t);
-        // security/nss/lib/pk11wrap/pk11pub.h#574
-        // SECStatus PK11_WrapPrivKey(PK11SlotInfo *slot, PK11SymKey *wrappingKey,
-        //                            SECKEYPrivateKey *privKey, CK_MECHANISM_TYPE wrapType,
-        //                            SECItem *param, SECItem *wrappedKey, void *wincx);
-        this.nss.PK11_WrapPrivKey = nsslib.declare("PK11_WrapPrivKey",
-                                                   ctypes.default_abi, this.nss_t.SECStatus,
-                                                   this.nss_t.PK11SlotInfo.ptr, this.nss_t.PK11SymKey.ptr,
-                                                   this.nss_t.SECKEYPrivateKey.ptr, this.nss_t.CK_MECHANISM_TYPE,
-                                                   this.nss_t.SECItem.ptr, this.nss_t.SECItem.ptr, ctypes.voidptr_t);
-        // security/nss/lib/cryptohi/keyhi.h#159
-        // SECItem* SECKEY_EncodeDERSubjectPublicKeyInfo(SECKEYPublicKey *pubk);
-        this.nss.SECKEY_EncodeDERSubjectPublicKeyInfo = nsslib.declare("SECKEY_EncodeDERSubjectPublicKeyInfo",
-                                                                       ctypes.default_abi, this.nss_t.SECItem.ptr,
-                                                                       this.nss_t.SECKEYPublicKey.ptr);
-        // security/nss/lib/cryptohi/keyhi.h#165
-        // CERTSubjectPublicKeyInfo * SECKEY_DecodeDERSubjectPublicKeyInfo(SECItem *spkider);
-        this.nss.SECKEY_DecodeDERSubjectPublicKeyInfo = nsslib.declare("SECKEY_DecodeDERSubjectPublicKeyInfo",
-                                                                       ctypes.default_abi, this.nss_t.CERTSubjectPublicKeyInfo.ptr,
-                                                                       this.nss_t.SECItem.ptr);
-        // security/nss/lib/cryptohi/keyhi.h#179
-        // SECKEYPublicKey * SECKEY_ExtractPublicKey(CERTSubjectPublicKeyInfo *);
-        this.nss.SECKEY_ExtractPublicKey = nsslib.declare("SECKEY_ExtractPublicKey",
-                                                          ctypes.default_abi, this.nss_t.SECKEYPublicKey.ptr,
-                                                          this.nss_t.CERTSubjectPublicKeyInfo.ptr);
-        // security/nss/lib/pk11wrap/pk11pub.h#377
-        // SECStatus PK11_PubWrapSymKey(CK_MECHANISM_TYPE type, SECKEYPublicKey *pubKey,
-        //                              PK11SymKey *symKey, SECItem *wrappedKey);
-        this.nss.PK11_PubWrapSymKey = nsslib.declare("PK11_PubWrapSymKey",
-                                                     ctypes.default_abi, this.nss_t.SECStatus,
-                                                     this.nss_t.CK_MECHANISM_TYPE, this.nss_t.SECKEYPublicKey.ptr,
-                                                     this.nss_t.PK11SymKey.ptr, this.nss_t.SECItem.ptr);
-        // security/nss/lib/pk11wrap/pk11pub.h#568
-        // SECKEYPrivateKey *PK11_UnwrapPrivKey(PK11SlotInfo *slot, 
-        //                 PK11SymKey *wrappingKey, CK_MECHANISM_TYPE wrapType,
-        //                 SECItem *param, SECItem *wrappedKey, SECItem *label, 
-        //                 SECItem *publicValue, PRBool token, PRBool sensitive,
-        //                 CK_KEY_TYPE keyType, CK_ATTRIBUTE_TYPE *usage, int usageCount,
-        //                 void *wincx);
-        this.nss.PK11_UnwrapPrivKey = nsslib.declare("PK11_UnwrapPrivKey",
-                                                     ctypes.default_abi, this.nss_t.SECKEYPrivateKey.ptr,
-                                                     this.nss_t.PK11SlotInfo.ptr, this.nss_t.PK11SymKey.ptr,
-                                                     this.nss_t.CK_MECHANISM_TYPE, this.nss_t.SECItem.ptr,
-                                                     this.nss_t.SECItem.ptr, this.nss_t.SECItem.ptr,
-                                                     this.nss_t.SECItem.ptr, this.nss_t.PRBool,
-                                                     this.nss_t.PRBool, this.nss_t.CK_KEY_TYPE,
-                                                     this.nss_t.CK_ATTRIBUTE_TYPE.ptr, ctypes.int,
-                                                     ctypes.voidptr_t);
-        // security/nss/lib/pk11wrap/pk11pub.h#447
-        // PK11SymKey *PK11_PubUnwrapSymKey(SECKEYPrivateKey *key, SECItem *wrapppedKey,
-        //         CK_MECHANISM_TYPE target, CK_ATTRIBUTE_TYPE operation, int keySize);
-        this.nss.PK11_PubUnwrapSymKey = nsslib.declare("PK11_PubUnwrapSymKey",
-                                                       ctypes.default_abi, this.nss_t.PK11SymKey.ptr,
-                                                       this.nss_t.SECKEYPrivateKey.ptr, this.nss_t.SECItem.ptr,
-                                                       this.nss_t.CK_MECHANISM_TYPE, this.nss_t.CK_ATTRIBUTE_TYPE, ctypes.int);
         // security/nss/lib/pk11wrap/pk11pub.h#675
         // void PK11_DestroyContext(PK11Context *context, PRBool freeit);
         this.nss.PK11_DestroyContext = nsslib.declare("PK11_DestroyContext",
                                                        ctypes.default_abi, ctypes.void_t,
                                                        this.nss_t.PK11Context.ptr, this.nss_t.PRBool);
         // security/nss/lib/pk11wrap/pk11pub.h#299
         // void PK11_FreeSymKey(PK11SymKey *key);
         this.nss.PK11_FreeSymKey = nsslib.declare("PK11_FreeSymKey",
@@ -427,36 +319,21 @@ WeaveCrypto.prototype = {
         this.nss.SECITEM_ZfreeItem = nsslib.declare("SECITEM_ZfreeItem",
                                                     ctypes.default_abi, ctypes.void_t,
                                                     this.nss_t.SECItem.ptr, this.nss_t.PRBool);
         // security/nss/lib/util/secitem.h#114
         // extern void SECITEM_FreeItem(SECItem *zap, PRBool freeit);
         this.nss.SECITEM_FreeItem = nsslib.declare("SECITEM_FreeItem",
                                                    ctypes.default_abi, ctypes.void_t,
                                                    this.nss_t.SECItem.ptr, this.nss_t.PRBool);
-        // security/nss/lib/cryptohi/keyhi.h#193
-        // extern void SECKEY_DestroyPublicKey(SECKEYPublicKey *key);
-        this.nss.SECKEY_DestroyPublicKey = nsslib.declare("SECKEY_DestroyPublicKey",
-                                                          ctypes.default_abi, ctypes.void_t,
-                                                          this.nss_t.SECKEYPublicKey.ptr);
-        // security/nss/lib/cryptohi/keyhi.h#186
-        // extern void SECKEY_DestroyPrivateKey(SECKEYPrivateKey *key);
-        this.nss.SECKEY_DestroyPrivateKey = nsslib.declare("SECKEY_DestroyPrivateKey",
-                                                           ctypes.default_abi, ctypes.void_t,
-                                                           this.nss_t.SECKEYPrivateKey.ptr);
         // security/nss/lib/util/secoid.h#103
         // extern void SECOID_DestroyAlgorithmID(SECAlgorithmID *aid, PRBool freeit);
         this.nss.SECOID_DestroyAlgorithmID = nsslib.declare("SECOID_DestroyAlgorithmID",
                                                             ctypes.default_abi, ctypes.void_t,
                                                             this.nss_t.SECAlgorithmID.ptr, this.nss_t.PRBool);
-        // security/nss/lib/cryptohi/keyhi.h#58
-        // extern void SECKEY_DestroySubjectPublicKeyInfo(CERTSubjectPublicKeyInfo *spki);
-        this.nss.SECKEY_DestroySubjectPublicKeyInfo = nsslib.declare("SECKEY_DestroySubjectPublicKeyInfo",
-                                                                     ctypes.default_abi, ctypes.void_t,
-                                                                     this.nss_t.CERTSubjectPublicKeyInfo.ptr);
     },
 
 
     //
     // IWeaveCrypto interfaces
     //