Minor fixes to resolve build issue with example when using --enable-opensslextra.

pull/109/head
David Garske 2018-10-11 09:46:00 -07:00
parent 1ba591f2dd
commit ae7c43ce7e
2 changed files with 8 additions and 8 deletions

View File

@ -1,6 +1,6 @@
How to use aes-file-encrypt.c
1) a. Compile wolfSSL with ./configure --enable-pwdbased --enable-dtls, run
1) a. Compile wolfSSL with ./configure --enable-pwdbased, run
'make', and then install by typing 'sudo make install'.
b. In the crypto/aes directory run the Makefile by typing 'make'.
2) Make a file to encode. Can be any file (ex. .txt .in .out .file etc.)

View File

@ -46,7 +46,7 @@ int GenerateKey(RNG* rng, byte* key, int size, byte* salt, int pad)
/* stretches key */
ret = wc_PBKDF2(key, key, strlen((const char*)key), salt, SALT_SIZE, 4096,
size, SHA256);
size, WC_SHA256);
if (ret != 0)
return -1030;
@ -54,7 +54,7 @@ int GenerateKey(RNG* rng, byte* key, int size, byte* salt, int pad)
}
/*
* Encrypts a file using AES
* Encrypts a file using AES
*/
int AesEncrypt(Aes* aes, byte* key, int size, FILE* inFile, FILE* outFile)
{
@ -107,7 +107,7 @@ int AesEncrypt(Aes* aes, byte* key, int size, FILE* inFile, FILE* outFile)
/* stretches key to fit size */
ret = GenerateKey(&rng, key, size, salt, padCounter);
if (ret != 0)
if (ret != 0)
return -1040;
/* sets key */
@ -140,7 +140,7 @@ int AesEncrypt(Aes* aes, byte* key, int size, FILE* inFile, FILE* outFile)
}
/*
* Decryptsr a file using AES
* Decryptsr a file using AES
*/
int AesDecrypt(Aes* aes, byte* key, int size, FILE* inFile, FILE* outFile)
{
@ -182,7 +182,7 @@ int AesDecrypt(Aes* aes, byte* key, int size, FILE* inFile, FILE* outFile)
/* replicates old key if keys match */
ret = wc_PBKDF2(key, key, strlen((const char*)key), salt, SALT_SIZE, 4096,
size, SHA256);
size, WC_SHA256);
if (ret != 0)
return -1050;
@ -336,7 +336,7 @@ int main(int argc, char** argv)
else if (ret == 0 && choice != 'n') {
key = malloc(size); /* sets size memory of key */
ret = NoEcho((char*)key, size);
if (choice == 'e')
if (choice == 'e')
AesEncrypt(&aes, key, size, inFile, outFile);
else if (choice == 'd')
AesDecrypt(&aes, key, size, inFile, outFile);
@ -345,6 +345,6 @@ int main(int argc, char** argv)
printf("Must select either -e or -d for encryption and decryption\n");
ret = -110;
}
return ret;
}