diff options
author | Brian Smith <brian@briansmith.org> | 2013-09-11 21:39:56 -0700 |
---|---|---|
committer | Brian Smith <brian@briansmith.org> | 2013-09-11 21:39:56 -0700 |
commit | edea655bb109bd76052419f2bd2b79645c66c036 (patch) | |
tree | f0625180d83a05bb818480c705ab4454b648ab9e | |
parent | bee7e0b1771e55011b65bc09bc28e876c85ee4a7 (diff) | |
download | nss-hg-edea655bb109bd76052419f2bd2b79645c66c036.tar.gz |
Bug 912847: Add const modifier to several SECKEY_* functions, r=rsleevi
-rw-r--r-- | lib/certdb/cert.h | 2 | ||||
-rw-r--r-- | lib/cryptohi/keyhi.h | 20 | ||||
-rw-r--r-- | lib/cryptohi/seckey.c | 31 | ||||
-rw-r--r-- | lib/nss/utilwrap.c | 4 | ||||
-rw-r--r-- | lib/util/secalgid.c | 5 | ||||
-rw-r--r-- | lib/util/secoid.h | 4 |
6 files changed, 34 insertions, 32 deletions
diff --git a/lib/certdb/cert.h b/lib/certdb/cert.h index b8c5e56c9..7c6402d38 100644 --- a/lib/certdb/cert.h +++ b/lib/certdb/cert.h @@ -268,7 +268,7 @@ extern SECKEYPublicKey *CERT_ExtractPublicKey(CERTCertificate *cert); ** Retrieve the Key Type associated with the cert we're dealing with */ -extern KeyType CERT_GetCertKeyType (CERTSubjectPublicKeyInfo *spki); +extern KeyType CERT_GetCertKeyType (const CERTSubjectPublicKeyInfo *spki); /* ** Initialize the certificate database. This is called to create diff --git a/lib/cryptohi/keyhi.h b/lib/cryptohi/keyhi.h index 8de955998..3793b570d 100644 --- a/lib/cryptohi/keyhi.h +++ b/lib/cryptohi/keyhi.h @@ -95,12 +95,12 @@ SECKEY_CreateSubjectPublicKeyInfo(SECKEYPublicKey *k); /* ** Decode a DER encoded public key into an SECKEYPublicKey structure. */ -extern SECKEYPublicKey *SECKEY_DecodeDERPublicKey(SECItem *pubkder); +extern SECKEYPublicKey *SECKEY_DecodeDERPublicKey(const SECItem *pubkder); /* ** Convert a base64 ascii encoded DER public key to our internal format. */ -extern SECKEYPublicKey *SECKEY_ConvertAndDecodePublicKey(char *pubkstr); +extern SECKEYPublicKey *SECKEY_ConvertAndDecodePublicKey(const char *pubkstr); /* ** Convert a base64 ascii encoded DER public key and challenge to spki, @@ -122,21 +122,21 @@ SECKEY_EncodeDERSubjectPublicKeyInfo(SECKEYPublicKey *pubk); ** CERTSubjectPublicKeyInfo structure. */ extern CERTSubjectPublicKeyInfo * -SECKEY_DecodeDERSubjectPublicKeyInfo(SECItem *spkider); +SECKEY_DecodeDERSubjectPublicKeyInfo(const SECItem *spkider); /* ** Convert a base64 ascii encoded DER subject public key info to our ** internal format. */ extern CERTSubjectPublicKeyInfo * -SECKEY_ConvertAndDecodeSubjectPublicKeyInfo(char *spkistr); +SECKEY_ConvertAndDecodeSubjectPublicKeyInfo(const char *spkistr); /* * extract the public key from a subject Public Key info structure. * (used by JSS). */ extern SECKEYPublicKey * -SECKEY_ExtractPublicKey(CERTSubjectPublicKeyInfo *); +SECKEY_ExtractPublicKey(const CERTSubjectPublicKeyInfo *); /* ** Destroy a private key object. @@ -183,7 +183,7 @@ SECKEY_DestroyEncryptedPrivateKeyInfo(SECKEYEncryptedPrivateKeyInfo *epki, extern SECStatus SECKEY_CopyPrivateKeyInfo(PLArenaPool *poolp, SECKEYPrivateKeyInfo *to, - SECKEYPrivateKeyInfo *from); + const SECKEYPrivateKeyInfo *from); extern SECStatus SECKEY_CacheStaticFlags(SECKEYPrivateKey* key); @@ -199,19 +199,19 @@ SECKEY_CacheStaticFlags(SECKEYPrivateKey* key); extern SECStatus SECKEY_CopyEncryptedPrivateKeyInfo(PLArenaPool *poolp, SECKEYEncryptedPrivateKeyInfo *to, - SECKEYEncryptedPrivateKeyInfo *from); + const SECKEYEncryptedPrivateKeyInfo *from); /* * Accessor functions for key type of public and private keys. */ -KeyType SECKEY_GetPrivateKeyType(SECKEYPrivateKey *privKey); -KeyType SECKEY_GetPublicKeyType(SECKEYPublicKey *pubKey); +KeyType SECKEY_GetPrivateKeyType(const SECKEYPrivateKey *privKey); +KeyType SECKEY_GetPublicKeyType(const SECKEYPublicKey *pubKey); /* * Creates a PublicKey from its DER encoding. * Currently only supports RSA and DSA keys. */ SECKEYPublicKey* -SECKEY_ImportDERPublicKey(SECItem *derKey, CK_KEY_TYPE type); +SECKEY_ImportDERPublicKey(const SECItem *derKey, CK_KEY_TYPE type); SECKEYPrivateKeyList* SECKEY_NewPrivateKeyList(void); diff --git a/lib/cryptohi/seckey.c b/lib/cryptohi/seckey.c index a0c80d49d..f63d15062 100644 --- a/lib/cryptohi/seckey.c +++ b/lib/cryptohi/seckey.c @@ -444,8 +444,9 @@ SECKEY_UpdateCertPQG(CERTCertificate * subjectCert) * the normal standard format. Store the decoded parameters in * a V3 certificate data structure. */ -SECStatus -SECKEY_DSADecodePQG(PLArenaPool *arena, SECKEYPublicKey *pubk, SECItem *params) { +static SECStatus +seckey_DSADecodePQG(PLArenaPool *arena, SECKEYPublicKey *pubk, + const SECItem *params) { SECStatus rv; SECItem newparams; @@ -539,13 +540,13 @@ seckey_GetKeyType (SECOidTag tag) { /* Function used to determine what kind of cert we are dealing with. */ KeyType -CERT_GetCertKeyType (CERTSubjectPublicKeyInfo *spki) +CERT_GetCertKeyType (const CERTSubjectPublicKeyInfo *spki) { return seckey_GetKeyType(SECOID_GetAlgorithmTag(&spki->algorithm)); } static SECKEYPublicKey * -seckey_ExtractPublicKey(CERTSubjectPublicKeyInfo *spki) +seckey_ExtractPublicKey(const CERTSubjectPublicKeyInfo *spki) { SECKEYPublicKey *pubk; SECItem os, newOs, newParms; @@ -594,7 +595,7 @@ seckey_ExtractPublicKey(CERTSubjectPublicKeyInfo *spki) rv = SEC_QuickDERDecodeItem(arena, pubk, SECKEY_DSAPublicKeyTemplate, &newOs); if (rv != SECSuccess) break; - rv = SECKEY_DSADecodePQG(arena, pubk, + rv = seckey_DSADecodePQG(arena, pubk, &spki->algorithm.parameters); if (rv == SECSuccess) return pubk; @@ -644,7 +645,7 @@ seckey_ExtractPublicKey(CERTSubjectPublicKeyInfo *spki) /* required for JSS */ SECKEYPublicKey * -SECKEY_ExtractPublicKey(CERTSubjectPublicKeyInfo *spki) +SECKEY_ExtractPublicKey(const CERTSubjectPublicKeyInfo *spki) { return seckey_ExtractPublicKey(spki); } @@ -1344,7 +1345,7 @@ SECKEY_DestroySubjectPublicKeyInfo(CERTSubjectPublicKeyInfo *spki) * similiar to CERT_ExtractPublicKey for other key times. */ SECKEYPublicKey * -SECKEY_DecodeDERPublicKey(SECItem *pubkder) +SECKEY_DecodeDERPublicKey(const SECItem *pubkder) { PLArenaPool *arena; SECKEYPublicKey *pubk; @@ -1385,7 +1386,7 @@ SECKEY_DecodeDERPublicKey(SECItem *pubkder) * Decode a base64 ascii encoded DER encoded public key. */ SECKEYPublicKey * -SECKEY_ConvertAndDecodePublicKey(char *pubkstr) +SECKEY_ConvertAndDecodePublicKey(const char *pubkstr) { SECKEYPublicKey *pubk; SECStatus rv; @@ -1425,7 +1426,7 @@ finish: CERTSubjectPublicKeyInfo * -SECKEY_DecodeDERSubjectPublicKeyInfo(SECItem *spkider) +SECKEY_DecodeDERSubjectPublicKeyInfo(const SECItem *spkider) { PLArenaPool *arena; CERTSubjectPublicKeyInfo *spki; @@ -1464,7 +1465,7 @@ SECKEY_DecodeDERSubjectPublicKeyInfo(SECItem *spkider) * Decode a base64 ascii encoded DER encoded subject public key info. */ CERTSubjectPublicKeyInfo * -SECKEY_ConvertAndDecodeSubjectPublicKeyInfo(char *spkistr) +SECKEY_ConvertAndDecodeSubjectPublicKeyInfo(const char *spkistr) { CERTSubjectPublicKeyInfo *spki; SECStatus rv; @@ -1647,7 +1648,7 @@ SECKEY_DestroyEncryptedPrivateKeyInfo(SECKEYEncryptedPrivateKeyInfo *epki, SECStatus SECKEY_CopyPrivateKeyInfo(PLArenaPool *poolp, SECKEYPrivateKeyInfo *to, - SECKEYPrivateKeyInfo *from) + const SECKEYPrivateKeyInfo *from) { SECStatus rv = SECFailure; @@ -1671,7 +1672,7 @@ SECKEY_CopyPrivateKeyInfo(PLArenaPool *poolp, SECStatus SECKEY_CopyEncryptedPrivateKeyInfo(PLArenaPool *poolp, SECKEYEncryptedPrivateKeyInfo *to, - SECKEYEncryptedPrivateKeyInfo *from) + const SECKEYEncryptedPrivateKeyInfo *from) { SECStatus rv = SECFailure; @@ -1689,19 +1690,19 @@ SECKEY_CopyEncryptedPrivateKeyInfo(PLArenaPool *poolp, } KeyType -SECKEY_GetPrivateKeyType(SECKEYPrivateKey *privKey) +SECKEY_GetPrivateKeyType(const SECKEYPrivateKey *privKey) { return privKey->keyType; } KeyType -SECKEY_GetPublicKeyType(SECKEYPublicKey *pubKey) +SECKEY_GetPublicKeyType(const SECKEYPublicKey *pubKey) { return pubKey->keyType; } SECKEYPublicKey* -SECKEY_ImportDERPublicKey(SECItem *derKey, CK_KEY_TYPE type) +SECKEY_ImportDERPublicKey(const SECItem *derKey, CK_KEY_TYPE type) { SECKEYPublicKey *pubk = NULL; SECStatus rv = SECFailure; diff --git a/lib/nss/utilwrap.c b/lib/nss/utilwrap.c index a9ef690a5..d3b60375c 100644 --- a/lib/nss/utilwrap.c +++ b/lib/nss/utilwrap.c @@ -293,12 +293,12 @@ SECStatus SECOID_SetAlgorithmID(PLArenaPool *arena, SECAlgorithmID *aid, } SECStatus SECOID_CopyAlgorithmID(PLArenaPool *arena, SECAlgorithmID *dest, - SECAlgorithmID *src) + const SECAlgorithmID *src) { return SECOID_CopyAlgorithmID_Util(arena, dest, src); } -SECOidTag SECOID_GetAlgorithmTag(SECAlgorithmID *aid) +SECOidTag SECOID_GetAlgorithmTag(const SECAlgorithmID *aid) { return SECOID_GetAlgorithmTag_Util(aid); } diff --git a/lib/util/secalgid.c b/lib/util/secalgid.c index 05888abc2..b60f8df34 100644 --- a/lib/util/secalgid.c +++ b/lib/util/secalgid.c @@ -9,7 +9,7 @@ #include "secerr.h" SECOidTag -SECOID_GetAlgorithmTag(SECAlgorithmID *id) +SECOID_GetAlgorithmTag(const SECAlgorithmID *id) { if (id == NULL || id->algorithm.data == NULL) return SEC_OID_UNKNOWN; @@ -97,7 +97,8 @@ SECOID_SetAlgorithmID(PLArenaPool *arena, SECAlgorithmID *id, SECOidTag which, } SECStatus -SECOID_CopyAlgorithmID(PLArenaPool *arena, SECAlgorithmID *to, SECAlgorithmID *from) +SECOID_CopyAlgorithmID(PLArenaPool *arena, SECAlgorithmID *to, + const SECAlgorithmID *from) { SECStatus rv; diff --git a/lib/util/secoid.h b/lib/util/secoid.h index 333371b4f..19087444d 100644 --- a/lib/util/secoid.h +++ b/lib/util/secoid.h @@ -54,12 +54,12 @@ extern SECStatus SECOID_SetAlgorithmID(PLArenaPool *arena, SECAlgorithmID *aid, ** to do that). */ extern SECStatus SECOID_CopyAlgorithmID(PLArenaPool *arena, SECAlgorithmID *dest, - SECAlgorithmID *src); + const SECAlgorithmID *src); /* ** Get the tag number for the given algorithm-id object. */ -extern SECOidTag SECOID_GetAlgorithmTag(SECAlgorithmID *aid); +extern SECOidTag SECOID_GetAlgorithmTag(const SECAlgorithmID *aid); /* ** Destroy an algorithm-id object. |