Closed Bug 912847 Opened 8 years ago Closed 8 years ago

Read-only SECKEY_* functions do not have the const modifer on their unmodified arguments

Categories

(NSS :: Libraries, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
3.15.2

People

(Reporter: briansmith, Assigned: briansmith)

Details

Attachments

(1 file)

This adds const to many of the SECKEY_* functions without changing their implementations.

There are other SECKEY_* functions that should probably be modified in a similar way, because callers probably expect the arguments to remain unmodified and also there may be thread-safety issues with such non-obvious modifications of arguments. However, I did not modify those functions because doing so is not trivial like the attached modifications are.
Attachment #799963 - Flags: review?(ryan.sleevi)
Comment on attachment 799963 [details] [diff] [review]
fix-SECKEY-constness.patch

Review of attachment 799963 [details] [diff] [review]:
-----------------------------------------------------------------

::: lib/cryptohi/seckey.c
@@ -207,5 @@
>  ** to create this key pair without the "sensitive" attribute, but revert to 
>  ** creating a "sensitive" key if necessary.
>  */
>  SECKEYPrivateKey *
> -SECKEY_CreateECPrivateKey(SECKEYECParams *param, SECKEYPublicKey **pubk, void *cx)

Should SECKEYECParams be const?
Attachment #799963 - Flags: review?(ryan.sleevi) → review+
http://hg.mozilla.org/projects/nss/rev/78ad4e01463d(In reply to Ryan Sleevi from comment #1)
> >  SECKEYPrivateKey *
> > -SECKEY_CreateECPrivateKey(SECKEYECParams *param, SECKEYPublicKey **pubk, void *cx)
> 
> Should SECKEYECParams be const?

I tried to make it const but it wasn't trivial like the other functions and I didn't have time to make all the needed changes. Let's do that in some follow-up.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.