From ae7c43ce7e4c498ec35176f2245e886a1d130fd2 Mon Sep 17 00:00:00 2001 From: David Garske Date: Thu, 11 Oct 2018 09:46:00 -0700 Subject: [PATCH] Minor fixes to resolve build issue with example when using --enable-opensslextra. --- crypto/aes/README | 2 +- crypto/aes/aes-file-encrypt.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/crypto/aes/README b/crypto/aes/README index 63f7c2e6..21d44ebf 100644 --- a/crypto/aes/README +++ b/crypto/aes/README @@ -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.) diff --git a/crypto/aes/aes-file-encrypt.c b/crypto/aes/aes-file-encrypt.c index 3c95be28..6ff4913d 100644 --- a/crypto/aes/aes-file-encrypt.c +++ b/crypto/aes/aes-file-encrypt.c @@ -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; }