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

pkcs_5_alg1 hangs if iterations is 0 #552

Closed
3 tasks done
guidovranken opened this issue Nov 8, 2020 · 0 comments
Closed
3 tasks done

pkcs_5_alg1 hangs if iterations is 0 #552

guidovranken opened this issue Nov 8, 2020 · 0 comments

Comments

@guidovranken
Copy link

Prerequisites

Description

pkcs_5_alg1 hangs if iterations is 0. It would be better to return an error value in this case.

Steps to Reproduce

#include <tomcrypt.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 unsigned char password[8] = { 0 };
    const unsigned char salt[8] = { 0 };
    unsigned char out[8];
    unsigned long outLen = sizeof(out);

    CF_CHECK_NE(register_hash(&sha256_desc), -1);

    CF_CHECK_EQ(pkcs_5_alg1(
                password,
                sizeof(password),
                salt,
                0,
                find_hash("sha256"),
                out,
                &outLen), CRYPT_OK);
end:
    return 0;
}

Version

Latest develop branch checkout, Clang, Linux 64 bit.

Additional Information

N/A

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

1 participant