Skip to content

Commit 1913b94

Browse files
committed
Add missing system includes for perror, sysconf, stdio (uid_t, gid_t, struct stat). Allow building aesgcm-file-encrypt even if AES GCM streaming is not enabled, but show message on run.
1 parent ef14ade commit 1913b94

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

crypto/aes/aes-file-encrypt.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,18 @@
2222
#include <stdio.h>
2323
#include <unistd.h>
2424
#include <termios.h>
25-
#include <wolfssl/options.h>
25+
26+
#ifndef WOLFSSL_USER_SETTINGS
27+
#include <wolfssl/options.h>
28+
#endif
29+
#include <wolfssl/wolfcrypt/settings.h>
2630
#include <wolfssl/wolfcrypt/aes.h>
2731
#include <wolfssl/wolfcrypt/sha256.h>
2832
#include <wolfssl/wolfcrypt/random.h>
2933
#include <wolfssl/wolfcrypt/pwdbased.h>
3034

3135
#if defined(HAVE_PBKDF2) && !defined(NO_PWDBASED)
36+
3237
#define SALT_SIZE 8
3338

3439
/*

crypto/aes/aesgcm-file-encrypt.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,20 @@
2121

2222
/* aesgcm-file-encrypt */
2323

24-
#include <wolfssl/options.h>
24+
#ifndef WOLFSSL_USER_SETTINGS
25+
#include <wolfssl/options.h>
26+
#endif
27+
#include <wolfssl/wolfcrypt/settings.h>
2528
#include <wolfssl/wolfcrypt/aes.h>
2629
#include <wolfssl/wolfcrypt/error-crypt.h>
2730
#include <wolfssl/wolfcrypt/types.h>
2831

32+
#include <stdio.h>
2933
#include <fcntl.h>
34+
#include <sys/stat.h>
35+
#include <unistd.h>
36+
37+
#ifdef WOLFSSL_AESGCM_STREAM
3038

3139
#ifdef OPENSSL_EXTRA
3240
#include <wolfssl/ssl.h>
@@ -952,3 +960,12 @@ int main(int argc, char** argv)
952960
}
953961
return 0;
954962
}
963+
964+
#else
965+
int main()
966+
{
967+
printf("This example requires AES GCM streaming. Build wolfSSL with "
968+
"./configure --enable-aesgcm-stream\n");
969+
return 0;
970+
}
971+
#endif

0 commit comments

Comments
 (0)