Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary assert in PK11MessageDigest.c #278

Merged
merged 1 commit into from
Oct 2, 2019

Conversation

cipherboy
Copy link
Member

This ASSERT_OUTOFMEM(env) is incorrect for two reasons:

  1. When JSS_RefByteArray detects a zero-length result, it returns
    false but doesn't throw an exception. It is up to the caller to
    handle that as they wish. In our case, we can safely skip the
    PK11_DigestOp call.
  2. When length < offset+len (and JSS_RefByteArray exits
    successfully), we won't have thrown an exception.

This only shows up in debug builds; release builds aren't affected.

This bug was detected by CI after merging the CMAC changes (#259).

Signed-off-by: Alexander Scheel <[email protected]>

This ASSERT_OUTOFMEM(env) is incorrect for two reasons:

 1. When JSS_RefByteArray detects a zero-length result, it returns
    false but doesn't throw an exception. It is up to the caller to
    handle that as they wish. In our case, we can safely skip the
    PK11_DigestOp call.
 2. When length < offset+len (and JSS_RefByteArray exits
    successfully), we won't have thrown an exception.

This only shows up in debug builds; release builds aren't affected.

Signed-off-by: Alexander Scheel <[email protected]>
@cipherboy cipherboy added Bug Something isn't working primitives Changes which affect cryptographic or NSS primitives; low-level work labels Oct 2, 2019
@cipherboy cipherboy added this to the 4.6.2 milestone Oct 2, 2019
@cipherboy cipherboy self-assigned this Oct 2, 2019
@cipherboy cipherboy merged commit 0fd96dd into dogtagpki:master Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working primitives Changes which affect cryptographic or NSS primitives; low-level work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant