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

apr_jwe_decrypt_content_aesgcm() null terminate string #127

Merged
merged 1 commit into from
Apr 1, 2016
Merged

apr_jwe_decrypt_content_aesgcm() null terminate string #127

merged 1 commit into from
Apr 1, 2016

Conversation

jdennis
Copy link
Contributor

@jdennis jdennis commented Mar 31, 2016

Also fixes unit test failure.

The test test_jwt_decrypt_gcm() in test.c would sometimes fail. The
failure was caused by extra garbage appearing in the decrypted string
after the expected string. This is due to the failure of
apr_jwe_decrypt_content_aesgcm() to null terminate the string as is
similarity done in apr_jwe_decrypt_content_aescbc().

This patch copies the logic from apr_jwe_decrypt_content_aescbc()
regarding the decryption output length (p_len) and the final output
length (f_len) which are then used to compute the end of the data in
the output buffer, the next octet after the decrypted data in the
output buffer is then assigned a null terminator.

Signed-off-by: John Dennis jdennis@redhat.com

Also fixes unit test failure.

The test test_jwt_decrypt_gcm() in test.c would sometimes fail. The
failure was caused by extra garbage appearing in the decrypted string
after the expected string. This is due to the failure of
apr_jwe_decrypt_content_aesgcm() to null terminate the string as is
similarity done in apr_jwe_decrypt_content_aescbc().

This patch copies the logic from apr_jwe_decrypt_content_aescbc()
regarding the decryption output length (p_len) and the final output
length (f_len) which are then used to compute the end of the data in
the output buffer, the next octet after the decrypted data in the
output buffer is then assigned a null terminator.

Signed-off-by: John Dennis <jdennis@redhat.com>
@zandbelt zandbelt merged commit 32f13dd into OpenIDC:master Apr 1, 2016
zandbelt pushed a commit that referenced this pull request Apr 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants