mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-28 02:06:25 +01:00
cleanup programs
Clean up the contents of programs, add more guards to includes, move all defines to the top of the top of files, remove some unused includes
This commit is contained in:
parent
3cfb34564f
commit
18b78c7498
48 changed files with 801 additions and 603 deletions
|
|
@ -29,8 +29,19 @@
|
|||
#if defined(POLARSSL_PLATFORM_C)
|
||||
#include "polarssl/platform.h"
|
||||
#else
|
||||
#define polarssl_printf printf
|
||||
#include <stdio.h>
|
||||
#define polarssl_fprintf fprintf
|
||||
#define polarssl_printf printf
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_AES_C) && defined(POLARSSL_SHA256_C) &&\
|
||||
defined(POLARSSL_FS_IO)
|
||||
#include "polarssl/aes.h"
|
||||
#include "polarssl/sha256.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
|
@ -43,14 +54,6 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "polarssl/aes.h"
|
||||
#include "polarssl/sha256.h"
|
||||
|
||||
#define MODE_ENCRYPT 0
|
||||
#define MODE_DECRYPT 1
|
||||
|
||||
|
|
@ -60,12 +63,13 @@
|
|||
"\n example: aescrypt2 0 file file.aes hex:E76B2413958B00E193\n" \
|
||||
"\n"
|
||||
|
||||
#if !defined(POLARSSL_AES_C) || !defined(POLARSSL_SHA256_C)
|
||||
#if !defined(POLARSSL_AES_C) || !defined(POLARSSL_SHA256_C) ||\
|
||||
!defined(POLARSSL_FS_IO)
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
((void) argc);
|
||||
((void) argv);
|
||||
polarssl_printf("POLARSSL_AES_C and/or POLARSSL_SHA256_C not defined.\n");
|
||||
polarssl_printf("POLARSSL_AES_C and/or POLARSSL_SHA256_C and/or POLARSSL_FS_IO not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
|
|
@ -442,4 +446,4 @@ exit:
|
|||
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_AES_C && POLARSSL_SHA256_C */
|
||||
#endif /* POLARSSL_AES_C && POLARSSL_SHA256_C && POLARSSL_FS_IO */
|
||||
|
|
|
|||
|
|
@ -30,8 +30,19 @@
|
|||
#if defined(POLARSSL_PLATFORM_C)
|
||||
#include "polarssl/platform.h"
|
||||
#else
|
||||
#define polarssl_printf printf
|
||||
#include <stdio.h>
|
||||
#define polarssl_fprintf fprintf
|
||||
#define polarssl_printf printf
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_CIPHER_C) && defined(POLARSSL_MD_C) &&\
|
||||
defined(POLARSSL_FS_IO)
|
||||
#include "polarssl/cipher.h"
|
||||
#include "polarssl/md.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
|
@ -44,14 +55,6 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "polarssl/cipher.h"
|
||||
#include "polarssl/md.h"
|
||||
|
||||
#define MODE_ENCRYPT 0
|
||||
#define MODE_DECRYPT 1
|
||||
|
||||
|
|
@ -61,13 +64,14 @@
|
|||
"\n example: crypt_and_hash 0 file file.aes AES-128-CBC SHA1 hex:E76B2413958B00E193\n" \
|
||||
"\n"
|
||||
|
||||
#if !defined(POLARSSL_CIPHER_C) || !defined(POLARSSL_MD_C)
|
||||
#if !defined(POLARSSL_CIPHER_C) || !defined(POLARSSL_MD_C) ||\
|
||||
!defined(POLARSSL_FS_IO)
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
((void) argc);
|
||||
((void) argv);
|
||||
|
||||
polarssl_printf("POLARSSL_CIPHER_C and/or POLARSSL_MD_C not defined.\n");
|
||||
polarssl_printf("POLARSSL_CIPHER_C and/or POLARSSL_MD_C and/or POLARSSL_FS_IO not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
|
|
@ -542,4 +546,4 @@ exit:
|
|||
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_CIPHER_C && POLARSSL_MD_C */
|
||||
#endif /* POLARSSL_CIPHER_C && POLARSSL_MD_C && POLARSSL_FS_IO */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue