Closed Bug 1815136 Opened 1 year ago Closed 1 year ago

C_VerifyFinal does not return accurate error code for incorrect HMACs

Categories

(NSS :: Libraries, defect, P2)

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: joachim, Assigned: jschanck)

Details

(Whiteboard: [nss-triage])

Attachments

(1 file)

Steps to reproduce:

sftk_HMACCmp is used in the NSC_VerifyFinal function to finalize the result of an HMAC verification. If the return value is not SECSuccess, the PORT error is retrieved and mapped to CKR_xxx: https://github.com/nss-dev/nss/blob/master/lib/softoken/pkcs11c.c#L3840-L3842

However, sftk_HMACCmp doesn't actually set a PORT error. Consequently, sftk_MapCryptError receives garbage and returns a garbage result as well.

Actual results:

The return code of C_VerifyFinal is all over the place, e.g. CKR_ARGUMENTS_BAD or CKR_GENERAL_ERROR depending on the specific HMAC mechanism.

Expected results:

Return code CKR_SIGNATURE_INVALID.

An easy fix is to add PORT_SetError(SEC_ERROR_BAD_SIGNATURE); to the sftk_HMACCmp function.

The severity field is not set for this bug.
:beurdouche, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(bbeurdouche)
Flags: needinfo?(bbeurdouche)
Priority: -- → P1
Whiteboard: [nss-triage]

The severity field is not set for this bug.
:beurdouche, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(bbeurdouche)
Flags: needinfo?(bbeurdouche)

The severity field is not set for this bug.
:beurdouche, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(bbeurdouche)
Assignee: nobody → jschanck
Severity: -- → S4
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Priority: P1 → P2
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Flags: needinfo?(bbeurdouche)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: