Merge pull request #91 from kaleb-himes/CLU-FIX

Fixes for default build with no keygen enabled
pull/92/head
JacobBarthelmeh 2018-04-05 11:37:38 -06:00 committed by GitHub
commit 4896ddbf25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View File

@ -116,7 +116,7 @@ int wolfCLU_decrypt(char* alg, char* mode, byte* pwdKey, byte* key, int size,
/* replicates old pwdKey if pwdKeys match */
if (keyType == 1) {
if (wc_PBKDF2(key, pwdKey, (int) strlen((const char*)pwdKey), salt,
SALT_SIZE, 4096, size, SHA256) != 0) {
SALT_SIZE, 4096, size, WC_SHA256) != 0) {
printf("pwdKey set error.\n");
wolfCLU_freeBins(input, output, NULL, NULL, NULL);
return ENCRYPT_ERROR;

View File

@ -421,6 +421,9 @@ int wolfCLU_genKey_RSA(RNG* rng, char* fName, int directive, int fmt, int
#endif
}
#endif /* WOLFSSL_KEY_GEN && !NO_ASN*/
/*
* makes a cyptographically secure key by stretching a user entered pwdKey
*/
@ -443,11 +446,10 @@ int wolfCLU_genKey_PWDBASED(RNG* rng, byte* pwdKey, int size, byte* salt, int pa
/* stretches pwdKey */
ret = (int) wc_PBKDF2(pwdKey, pwdKey, (int) strlen((const char*)pwdKey), salt, SALT_SIZE,
4096, size, SHA256);
4096, size, WC_SHA256);
if (ret != 0)
return ret;
return 0;
}
#endif /* WOLFSSL_KEY_GEN && !NO_ASN*/

View File

@ -112,7 +112,7 @@ int wolfCLU_genKeySetup(int argc, char** argv)
#endif /* HAVE_ED25519 */
} else if (XSTRNCMP(keyType, "ecc", 3) == 0) {
#ifdef HAVE_ECC
#if defined(HAVE_ECC) && defined(WOLFSSL_KEY_GEN)
/* ECC flags */
int directiveArg;
int sizeArg;
@ -173,7 +173,7 @@ int wolfCLU_genKeySetup(int argc, char** argv)
return NOT_COMPILED_IN;
#endif /* HAVE_ECC */
} else if (XSTRNCMP(keyType, "rsa", 3) == 0) {
#ifndef NO_RSA
#if defined(NO_RSA) && defined(WOLFSSL_KEY_GEN)
/* RSA flags */
int directiveArg;
int sizeArg;