Fix compiler warnings in lib/softoken/pkcs11c.c

RESOLVED FIXED in 3.14

Status

P2
trivial
RESOLVED FIXED
7 years ago
4 years ago

People

(Reporter: wtc, Assigned: wtc)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Assignee)

Description

7 years ago
Created attachment 622206 [details] [diff] [review]
Simply declare 'okm' without the 'const' (checked in)

Visual C++ warns when we pass 'okm':
    const CK_BYTE * okm;        /* output keying material */
as the third argument to sftk_forceAttribute:
    crv = sftk_forceAttribute(key, CKA_VALUE, okm, keySize);
which expects a void * argument:
    void *value,

The warning message is:

..\..\third_party\nss\mozilla\security\nss\lib\softoken\pkcs11c.c(6265)
: warning C4090: 'function' : different 'const' qualifiers

I suggest that we simply declare 'okm' without the 'const'.
Attachment #622206 - Flags: review?(bsmith)
(Assignee)

Comment 1

7 years ago
Created attachment 622208 [details] [diff] [review]
"Proper" fix

The proper fix is probably to add 'const' to the function argument.
This requires casting away the 'const' in one assignment statement,
which seems safe.  But it should be checked.
Attachment #622208 - Flags: feedback?(bsmith)
Comment on attachment 622206 [details] [diff] [review]
Simply declare 'okm' without the 'const' (checked in)

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

:( r+
Attachment #622206 - Flags: review?(bsmith) → review+
(Assignee)

Comment 3

6 years ago
Comment on attachment 622206 [details] [diff] [review]
Simply declare 'okm' without the 'const' (checked in)

Patch checked in on the NSS trunk (NSS 3.14).

Checking in pkcs11c.c;
/cvsroot/mozilla/security/nss/lib/softoken/pkcs11c.c,v  <--  pkcs11c.c
new revision: 1.130; previous revision: 1.129
done
Attachment #622206 - Attachment description: Simply declare 'okm' without the 'const' → Simply declare 'okm' without the 'const' (checked in)
(Assignee)

Updated

6 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.