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

ARIA GCM ciphers memory leak after EVP_CTRL_AEAD_SET_IVLEN #8567

Closed
guidovranken opened this issue Mar 24, 2019 · 1 comment
Closed

ARIA GCM ciphers memory leak after EVP_CTRL_AEAD_SET_IVLEN #8567

guidovranken opened this issue Mar 24, 2019 · 1 comment

Comments

@guidovranken
Copy link
Contributor

#include <openssl/evp.h>

#define CF_CHECK_EQ(expr, res) if ( (expr) != (res) ) { goto end; }
#define CF_CHECK_NE(expr, res) if ( (expr) == (res) ) { goto end; }

int main(void)
{
    const EVP_CIPHER* cipher = NULL;
    EVP_CIPHER_CTX* ctx = NULL;

    CF_CHECK_NE(cipher = EVP_aria_128_gcm(), NULL);
    CF_CHECK_NE(ctx = EVP_CIPHER_CTX_new(), NULL);
    CF_CHECK_EQ(EVP_EncryptInit_ex(ctx, cipher, NULL, NULL, NULL), 1);

    /* Leak occurs here */
    CF_CHECK_EQ(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, 100, NULL), 1);

end:
    EVP_CIPHER_CTX_free(ctx);

    return 0;
}

iv is allocated but not freed: https://github.com/openssl/openssl/blob/master/crypto/evp/e_aria.c#L269

mattcaswell added a commit to mattcaswell/openssl that referenced this issue Mar 26, 2019
@mattcaswell
Copy link
Member

Fix in #8586.

levitte pushed a commit that referenced this issue Mar 27, 2019
Fixes #8567

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from #8586)

(cherry picked from commit 183f52e)
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

No branches or pull requests

2 participants