mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-08 17:42:09 +03:00
- Fixed a whole bunch of dependencies on defines between files, examples and tests
This commit is contained in:
@@ -40,6 +40,8 @@
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "polarssl/aes.h"
|
||||
#include "polarssl/sha2.h"
|
||||
|
||||
@@ -52,9 +54,18 @@
|
||||
"\n example: aescrypt2 0 file file.aes hex:E76B2413958B00E193\n" \
|
||||
"\n"
|
||||
|
||||
#if !defined(POLARSSL_AES_C) || !defined(POLARSSL_SHA2_C)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_AES_C and/or POLARSSL_SHA2_C not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
int ret = 1, i, n;
|
||||
int ret = 1;
|
||||
|
||||
int i, n;
|
||||
int mode, lastn;
|
||||
size_t keylen;
|
||||
FILE *fkey, *fin = NULL, *fout = NULL;
|
||||
@@ -404,3 +415,4 @@ exit:
|
||||
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_AES_C && POLARSSL_SHA2_C */
|
||||
|
@@ -41,6 +41,8 @@
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "polarssl/cipher.h"
|
||||
#include "polarssl/md.h"
|
||||
|
||||
@@ -53,6 +55,13 @@
|
||||
"\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)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_CIPHER_C and/or POLARSSL_MD_C not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
int ret = 1, i;
|
||||
@@ -463,3 +472,4 @@ exit:
|
||||
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_CIPHER_C && POLARSSL_MD_C */
|
||||
|
@@ -30,8 +30,17 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "polarssl/md.h"
|
||||
|
||||
#if !defined(POLARSSL_MD_C)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_MD_C not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
static int generic_wrapper( const md_info_t *md_info, char *filename, unsigned char *sum )
|
||||
{
|
||||
int ret = md_file( md_info, filename, sum );
|
||||
@@ -201,3 +210,4 @@ exit:
|
||||
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_MD_C */
|
||||
|
@@ -29,8 +29,17 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "polarssl/md5.h"
|
||||
|
||||
#if !defined(POLARSSL_MD5_C)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_MD5_C not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
int main( void )
|
||||
{
|
||||
int i;
|
||||
@@ -53,3 +62,4 @@ int main( void )
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
#endif /* POLARSSL_MD5_C */
|
||||
|
@@ -30,8 +30,17 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "polarssl/md5.h"
|
||||
|
||||
#if !defined(POLARSSL_MD5_C) || !defined(POLARSSL_FS_IO)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_MD5_C and/or POLARSSL_FS_IO not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
static int md5_wrapper( char *filename, unsigned char *sum )
|
||||
{
|
||||
int ret = md5_file( filename, sum );
|
||||
@@ -159,3 +168,4 @@ int main( int argc, char *argv[] )
|
||||
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_MD5_C && POLARSSL_FS_IO */
|
||||
|
@@ -30,8 +30,17 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "polarssl/sha1.h"
|
||||
|
||||
#if !defined(POLARSSL_SHA1_C) || !defined(POLARSSL_FS_IO)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_SHA1_C and/or POLARSSL_FS_IO not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
static int sha1_wrapper( char *filename, unsigned char *sum )
|
||||
{
|
||||
int ret = sha1_file( filename, sum );
|
||||
@@ -159,3 +168,4 @@ int main( int argc, char *argv[] )
|
||||
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_SHA1_C && POLARSSL_FS_IO */
|
||||
|
@@ -30,8 +30,17 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "polarssl/sha2.h"
|
||||
|
||||
#if !defined(POLARSSL_SHA2_C) || !defined(POLARSSL_FS_IO)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_SHA2_C and/or POLARSSL_FS_IO not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
static int sha2_wrapper( char *filename, unsigned char *sum )
|
||||
{
|
||||
int ret = sha2_file( filename, sum, 0 );
|
||||
@@ -159,3 +168,4 @@ int main( int argc, char *argv[] )
|
||||
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_SHA2_C && POLARSSL_FS_IO */
|
||||
|
@@ -30,6 +30,8 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "polarssl/net.h"
|
||||
#include "polarssl/aes.h"
|
||||
#include "polarssl/dhm.h"
|
||||
@@ -40,6 +42,18 @@
|
||||
#define SERVER_NAME "localhost"
|
||||
#define SERVER_PORT 11999
|
||||
|
||||
#if !defined(POLARSSL_AES_C) || !defined(POLARSSL_DHM_C) || \
|
||||
!defined(POLARSSL_HAVEGE_C) || !defined(POLARSSL_NET_C) || \
|
||||
!defined(POLARSSL_RSA_C) || !defined(POLARSSL_SHA1_C) || \
|
||||
!defined(POLARSSL_FS_IO)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_AES_C and/or POLARSSL_DHM_C and/or POLARSSL_HAVEGE_C "
|
||||
"and/or POLARSSL_NET_C and/or POLARSSL_RSA_C and/or "
|
||||
"POLARSSL_SHA1_C and/or POLARSSL_FS_IO not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
int main( void )
|
||||
{
|
||||
FILE *f;
|
||||
@@ -253,3 +267,6 @@ exit:
|
||||
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_AES_C && POLARSSL_DHM_C && POLARSSL_HAVEGE_C &&
|
||||
POLARSSL_NET_C && POLARSSL_RSA_C && POLARSSL_SHA1_C &&
|
||||
POLARSSL_FS_IO */
|
||||
|
@@ -29,8 +29,9 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "polarssl/bignum.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "polarssl/bignum.h"
|
||||
#include "polarssl/havege.h"
|
||||
|
||||
/*
|
||||
@@ -40,6 +41,15 @@
|
||||
#define DH_P_SIZE 1024
|
||||
#define GENERATOR "4"
|
||||
|
||||
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \
|
||||
!defined(POLARSSL_FS_IO)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or "
|
||||
"POLARSSL_FS_IO not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
int main( void )
|
||||
{
|
||||
int ret = 1;
|
||||
@@ -125,3 +135,4 @@ exit:
|
||||
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_BIGNUM_C && POLARSSL_HAVEGE_C && POLARSSL_FS_IO */
|
||||
|
@@ -30,6 +30,8 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "polarssl/net.h"
|
||||
#include "polarssl/aes.h"
|
||||
#include "polarssl/dhm.h"
|
||||
@@ -40,6 +42,18 @@
|
||||
#define SERVER_PORT 11999
|
||||
#define PLAINTEXT "==Hello there!=="
|
||||
|
||||
#if !defined(POLARSSL_AES_C) || !defined(POLARSSL_DHM_C) || \
|
||||
!defined(POLARSSL_HAVEGE_C) || !defined(POLARSSL_NET_C) || \
|
||||
!defined(POLARSSL_RSA_C) || !defined(POLARSSL_SHA1_C) || \
|
||||
!defined(POLARSSL_FS_IO)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_AES_C and/or POLARSSL_DHM_C and/or POLARSSL_HAVEGE_C "
|
||||
"and/or POLARSSL_NET_C and/or POLARSSL_RSA_C and/or "
|
||||
"POLARSSL_SHA1_C and/or POLARSSL_FS_IO not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
int main( void )
|
||||
{
|
||||
FILE *f;
|
||||
@@ -256,3 +270,6 @@ exit:
|
||||
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_AES_C && POLARSSL_DHM_C && POLARSSL_HAVEGE_C &&
|
||||
POLARSSL_NET_C && POLARSSL_RSA_C && POLARSSL_SHA1_C &&
|
||||
POLARSSL_FS_IO */
|
||||
|
@@ -29,8 +29,16 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "polarssl/config.h"
|
||||
#include "polarssl/bignum.h"
|
||||
|
||||
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_FS_IO)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_BIGNUM_C and/or POLARSSL_FS_IO not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
int main( void )
|
||||
{
|
||||
mpi E, P, Q, N, H, D, X, Y, Z;
|
||||
@@ -52,6 +60,7 @@ int main( void )
|
||||
mpi_write_file( " P = ", &P, 10, NULL );
|
||||
mpi_write_file( " Q = ", &Q, 10, NULL );
|
||||
|
||||
#if defined(POLARSSL_GENPRIME)
|
||||
mpi_sub_int( &P, &P, 1 );
|
||||
mpi_sub_int( &Q, &Q, 1 );
|
||||
mpi_mul_mpi( &H, &P, &Q );
|
||||
@@ -59,7 +68,9 @@ int main( void )
|
||||
|
||||
mpi_write_file( " D = E^-1 mod (P-1)*(Q-1) = ",
|
||||
&D, 10, NULL );
|
||||
|
||||
#else
|
||||
printf("\nTest skipped (POLARSSL_GENPRIME not defined).\n\n");
|
||||
#endif
|
||||
mpi_read_string( &X, 10, "55555" );
|
||||
mpi_exp_mod( &Y, &X, &E, &N, NULL );
|
||||
mpi_exp_mod( &Z, &Y, &D, &N, NULL );
|
||||
@@ -81,3 +92,4 @@ int main( void )
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
#endif /* POLARSSL_BIGNUM_C && POLARSSL_FS_IO */
|
||||
|
@@ -29,6 +29,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "polarssl/havege.h"
|
||||
#include "polarssl/bignum.h"
|
||||
#include "polarssl/x509.h"
|
||||
@@ -37,6 +39,17 @@
|
||||
#define KEY_SIZE 1024
|
||||
#define EXPONENT 65537
|
||||
|
||||
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \
|
||||
!defined(POLARSSL_RSA_C) || !defined(POLARSSL_GENPRIME) || \
|
||||
!defined(POLARSSL_FS_IO)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or "
|
||||
"POLARSSL_RSA_C and/or POLARSSL_GENPRIME and/or "
|
||||
"POLARSSL_FS_IO not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
int main( void )
|
||||
{
|
||||
int ret;
|
||||
@@ -132,3 +145,5 @@ exit:
|
||||
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_BIGNUM_C && POLARSSL_HAVEGE_C && POLARSSL_RSA_C &&
|
||||
POLARSSL_GENPRIME && POLARSSL_FS_IO */
|
||||
|
@@ -1,8 +1,8 @@
|
||||
N = 807E3526556FADF8D4CA64074ADA36862646D5ECB24E363821306588722AF2B58058CFB88E8C0BEA5C7084F3055D232F110E59C8837A0D132A4B907E91DB4A4924134A85E7445935E55A772C0B72E12C94501D9DF66B71BA030F842531721AEF43AE48F9505BF7504CDEEA3CAA6F94530835648D770AE2E6C628DD484D10AA57
|
||||
N = A1D46FBA2318F8DCEF16C280948B1CF27966B9B47225ED2989F8D74B45BD36049C0AAB5AD0FF003553BA843C8E12782FC5873BB89A3DC84B883D25666CD22BF3ACD5B675969F8BEBFBCAC93FDD927C7442B178B10D1DFF9398E52316AAE0AF74E594650BDC3C670241D418684593CDA1A7B9DC4F20D2FDC6F66344074003E211
|
||||
E = 010001
|
||||
D = 56B3D2AD612D10993D0CAC5E7755B340E6071A46B3322F47C4AD6175A683F06E2482C8F761C88229CBE268F38B0503BEB8A59453C6D3CE8AC6196310E4DEB1CA939DF7F7EE26C4697EEDD1E5122795BFC83861DE2E3EC9E3E84F42B3A9DD25EB09B30FDDFFACCE5091493BC5577530CE9CD9C8BA244EC5FD3DF91BCECFD73961
|
||||
P = F8DAD6A5651CED9011D979A076D70C4FBD095AAE2E53EF51415832C63AD61618F0BB369F29D1363345FE481FE6C28F0830FE33A1C41F8743A4E02DD682A2E099
|
||||
Q = 842EABF3171F972DE7D6B571B70F969F8F1C305851785BB042CDAE3B794014659A744EA7D16D881B7168463CEEAF52BA0F78755BBE89CFE1361076CE3E20886F
|
||||
DP = B1C694047FE1548CD1538D21E703E595A933DF86032E8F0E7B21E8D3D8004CB4F074ADA6B296F4A35863395F20D8E8992F76C9A7CC95C169BF852EF9C9455631
|
||||
DQ = 143C54E49D289FEB4E2FC78D461A23D3FF83B03F0511E8EF7DFAA0EEC7EC3073318716B7884F3D63FE239985208144A7E950669F09F76D14AC432EFCF9F3DF0F
|
||||
QP = C2F98F412476BDA2B14F5882D929090C62BB24ED74E8B78A3BE287EABDB3FADC445D041F1DE04EBE2D39A8913DAF03C23FF632D1B3FB6CCBDD65B2A576F127F5
|
||||
D = 589552BB4F2F023ADDDD5586D0C8FD857512D82080436678D07F984A29D892D31F1F7000FC5A39A0F73E27D885E47249A4148C8A5653EF69F91F8F736BA9F84841C2D99CD8C24DE8B72B5C9BE0EDBE23F93D731749FEA9CFB4A48DD2B7F35A2703E74AA2D4DB7DE9CEEA7D763AF0ADA7AC176C4E9A22C4CDA65CEC0C65964401
|
||||
P = CD083568D2D46C44C40C1FA0101AF2155E59C70B08423112AF0C1202514BBA5210765E29FF13036F56C7495894D80CF8C3BAEE2839BACBB0B86F6A2965F60DB1
|
||||
Q = CA0EEEA5E710E8E9811A6B846399420E3AE4A4C16647E426DDF8BBBCB11CD3F35CE2E4B6BCAD07AE2C0EC2ECBFCC601B207CDD77B5673E16382B1130BF465261
|
||||
DP = 0D0E21C07BF434B4A83B116472C2147A11D8EB98A33CFBBCF1D275EF19D815941622435AAF3839B6C432CA53CE9E772CFBE1923A937A766FD93E96E6EDEC1DF1
|
||||
DQ = 269CEBE6305DFEE4809377F078C814E37B45AE6677114DFC4F76F5097E1F3031D592567AC55B9B98213B40ECD54A4D2361F5FAACA1B1F51F71E4690893C4F081
|
||||
QP = 97AC5BB885ABCA314375E9E4DB1BA4B2218C90619F61BD474F5785075ECA81750A735199A8C191FE2D3355E7CF601A70E5CABDE0E02C2538BB9FB4871540B3C1
|
||||
|
@@ -1,2 +1,2 @@
|
||||
N = 807E3526556FADF8D4CA64074ADA36862646D5ECB24E363821306588722AF2B58058CFB88E8C0BEA5C7084F3055D232F110E59C8837A0D132A4B907E91DB4A4924134A85E7445935E55A772C0B72E12C94501D9DF66B71BA030F842531721AEF43AE48F9505BF7504CDEEA3CAA6F94530835648D770AE2E6C628DD484D10AA57
|
||||
N = A1D46FBA2318F8DCEF16C280948B1CF27966B9B47225ED2989F8D74B45BD36049C0AAB5AD0FF003553BA843C8E12782FC5873BB89A3DC84B883D25666CD22BF3ACD5B675969F8BEBFBCAC93FDD927C7442B178B10D1DFF9398E52316AAE0AF74E594650BDC3C670241D418684593CDA1A7B9DC4F20D2FDC6F66344074003E211
|
||||
E = 010001
|
||||
|
@@ -30,9 +30,20 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "polarssl/rsa.h"
|
||||
#include "polarssl/sha1.h"
|
||||
|
||||
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
|
||||
!defined(POLARSSL_SHA1_C) || !defined(POLARSSL_FS_IO)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
|
||||
"POLARSSL_SHA1_C and/or POLARSSL_FS_IO not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
FILE *f;
|
||||
@@ -134,3 +145,5 @@ exit:
|
||||
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_BIGNUM_C && POLARSSL_RSA_C && POLARSSL_SHA1_C &&
|
||||
POLARSSL_FS_IO */
|
||||
|
@@ -30,6 +30,8 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "polarssl/havege.h"
|
||||
#include "polarssl/md.h"
|
||||
#include "polarssl/rsa.h"
|
||||
@@ -40,6 +42,17 @@
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \
|
||||
!defined(POLARSSL_RSA_C) || !defined(POLARSSL_SHA1_C) || \
|
||||
!defined(POLARSSL_X509_PARSE_C) || !defined(POLARSSL_FS_IO)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or "
|
||||
"POLARSSL_RSA_C and/or POLARSSL_SHA1_C and/or "
|
||||
"POLARSSL_X509_PARSE_C and/or POLARSSL_FS_IO not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
FILE *f;
|
||||
@@ -127,3 +140,5 @@ exit:
|
||||
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_BIGNUM_C && POLARSSL_HAVEGE_C && POLARSSL_RSA_C &&
|
||||
POLARSSL_SHA1_C && POLARSSL_X509_PARSE_C && POLARSSL_FS_IO */
|
||||
|
@@ -30,9 +30,20 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "polarssl/rsa.h"
|
||||
#include "polarssl/sha1.h"
|
||||
|
||||
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
|
||||
!defined(POLARSSL_SHA1_C) || !defined(POLARSSL_FS_IO)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
|
||||
"POLARSSL_SHA1_C and/or POLARSSL_FS_IO not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
FILE *f;
|
||||
@@ -137,3 +148,5 @@ exit:
|
||||
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_BIGNUM_C && POLARSSL_RSA_C && POLARSSL_SHA1_C &&
|
||||
POLARSSL_FS_IO */
|
||||
|
@@ -30,6 +30,8 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "polarssl/md.h"
|
||||
#include "polarssl/pem.h"
|
||||
#include "polarssl/rsa.h"
|
||||
@@ -40,6 +42,17 @@
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
|
||||
!defined(POLARSSL_SHA1_C) || !defined(POLARSSL_X509_PARSE_C) || \
|
||||
!defined(POLARSSL_FS_IO)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
|
||||
"POLARSSL_SHA1_C and/or POLARSSL_X509_PARSE_C and/or "
|
||||
"POLARSSL_FS_IO not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
FILE *f;
|
||||
@@ -128,3 +141,5 @@ exit:
|
||||
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_BIGNUM_C && POLARSSL_RSA_C && POLARSSL_SHA1_C &&
|
||||
POLARSSL_X509_PARSE_C && POLARSSL_FS_IO */
|
||||
|
@@ -24,10 +24,19 @@
|
||||
*/
|
||||
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "polarssl/havege.h"
|
||||
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if !defined(POLARSSL_HAVEGE_C)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_HAVEGE_C not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
FILE *f;
|
||||
@@ -70,3 +79,4 @@ int main( int argc, char *argv[] )
|
||||
fclose( f );
|
||||
return( 0 );
|
||||
}
|
||||
#endif /* POLARSSL_HAVEGE_C */
|
||||
|
@@ -30,6 +30,8 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "polarssl/net.h"
|
||||
#include "polarssl/ssl.h"
|
||||
#include "polarssl/havege.h"
|
||||
@@ -49,6 +51,17 @@ void my_debug( void *ctx, int level, const char *str )
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \
|
||||
!defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \
|
||||
!defined(POLARSSL_NET_C) || !defined(POLARSSL_RSA_C)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or "
|
||||
"POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or "
|
||||
"POLARSSL_NET_C and/or POLARSSL_RSA_C not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
int main( void )
|
||||
{
|
||||
int ret, len, server_fd;
|
||||
@@ -170,3 +183,5 @@ exit:
|
||||
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_BIGNUM_C && POLARSSL_HAVEGE_C && POLARSSL_SSL_TLS_C &&
|
||||
POLARSSL_SSL_CLI_C && POLARSSL_NET_C && POLARSSL_RSA_C */
|
||||
|
@@ -31,6 +31,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "polarssl/net.h"
|
||||
#include "polarssl/ssl.h"
|
||||
#include "polarssl/havege.h"
|
||||
@@ -41,6 +43,7 @@
|
||||
#define DFL_SERVER_PORT 4433
|
||||
#define DFL_REQUEST_PAGE "/"
|
||||
#define DFL_DEBUG_LEVEL 0
|
||||
#define DFL_CA_FILE ""
|
||||
#define DFL_CRT_FILE ""
|
||||
#define DFL_KEY_FILE ""
|
||||
#define DFL_FORCE_CIPHER 0
|
||||
@@ -56,6 +59,7 @@ struct options
|
||||
int server_port; /* port on which the ssl service runs */
|
||||
int debug_level; /* level of debugging */
|
||||
char *request_page; /* page on server to request */
|
||||
char *ca_file; /* the file with the CA certificate(s) */
|
||||
char *crt_file; /* the file with the client certificate */
|
||||
char *key_file; /* the file with the client key */
|
||||
int force_ciphersuite[2]; /* protocol/ciphersuite to use, or all */
|
||||
@@ -70,18 +74,38 @@ void my_debug( void *ctx, int level, const char *str )
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(POLARSSL_FS_IO)
|
||||
#define USAGE_IO \
|
||||
" ca_file=%%s default: \"\" (pre-loaded)\n" \
|
||||
" crt_file=%%s default: \"\" (pre-loaded)\n" \
|
||||
" key_file=%%s default: \"\" (pre-loaded)\n"
|
||||
#else
|
||||
#define USAGE_IO \
|
||||
" No file operations available (POLARSSL_FS_IO not defined)\n"
|
||||
#endif /* POLARSSL_FS_IO */
|
||||
|
||||
#define USAGE \
|
||||
"\n usage: ssl_client2 param=<>...\n" \
|
||||
"\n acceptable parameters:\n" \
|
||||
" server_name=%%s default: localhost\n" \
|
||||
" server_port=%%d default: 4433\n" \
|
||||
" debug_level=%%d default: 0 (disabled)\n" \
|
||||
USAGE_IO \
|
||||
" request_page=%%s default: \".\"\n" \
|
||||
" crt_file=%%s default: \"\" (pre-loaded)\n" \
|
||||
" key_file=%%s default: \"\" (pre-loaded)\n" \
|
||||
" force_ciphersuite=<name> default: all enabled\n"\
|
||||
" acceptable ciphersuite names:\n"
|
||||
|
||||
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \
|
||||
!defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \
|
||||
!defined(POLARSSL_NET_C) || !defined(POLARSSL_RSA_C)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or "
|
||||
"POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or "
|
||||
"POLARSSL_NET_C and/or POLARSSL_RSA_C not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
int ret = 0, len, server_fd;
|
||||
@@ -126,6 +150,7 @@ int main( int argc, char *argv[] )
|
||||
opt.server_port = DFL_SERVER_PORT;
|
||||
opt.debug_level = DFL_DEBUG_LEVEL;
|
||||
opt.request_page = DFL_REQUEST_PAGE;
|
||||
opt.ca_file = DFL_CA_FILE;
|
||||
opt.crt_file = DFL_CRT_FILE;
|
||||
opt.key_file = DFL_KEY_FILE;
|
||||
opt.force_ciphersuite[0]= DFL_FORCE_CIPHER;
|
||||
@@ -161,6 +186,8 @@ int main( int argc, char *argv[] )
|
||||
}
|
||||
else if( strcmp( p, "request_page" ) == 0 )
|
||||
opt.request_page = q;
|
||||
else if( strcmp( p, "ca_file" ) == 0 )
|
||||
opt.ca_file = q;
|
||||
else if( strcmp( p, "crt_file" ) == 0 )
|
||||
opt.crt_file = q;
|
||||
else if( strcmp( p, "key_file" ) == 0 )
|
||||
@@ -191,12 +218,20 @@ int main( int argc, char *argv[] )
|
||||
printf( "\n . Loading the CA root certificate ..." );
|
||||
fflush( stdout );
|
||||
|
||||
/*
|
||||
* Alternatively, you may load the CA certificates from a .pem or
|
||||
* .crt file by calling x509parse_crtfile( &cacert, "myca.crt" ).
|
||||
*/
|
||||
ret = x509parse_crt( &cacert, (unsigned char *) test_ca_crt,
|
||||
strlen( test_ca_crt ) );
|
||||
#if defined(POLARSSL_FS_IO)
|
||||
if( strlen( opt.ca_file ) )
|
||||
ret = x509parse_crtfile( &cacert, opt.ca_file );
|
||||
else
|
||||
#endif
|
||||
#if defined(POLARSSL_CERTS_C)
|
||||
ret = x509parse_crt( &cacert, (unsigned char *) test_ca_crt,
|
||||
strlen( test_ca_crt ) );
|
||||
#else
|
||||
{
|
||||
ret = 1;
|
||||
printf("POLARSSL_CERTS_C not defined.");
|
||||
}
|
||||
#endif
|
||||
if( ret != 0 )
|
||||
{
|
||||
printf( " failed\n ! x509parse_crt returned %d\n\n", ret );
|
||||
@@ -213,23 +248,40 @@ int main( int argc, char *argv[] )
|
||||
printf( " . Loading the client cert. and key..." );
|
||||
fflush( stdout );
|
||||
|
||||
#if defined(POLARSSL_FS_IO)
|
||||
if( strlen( opt.crt_file ) )
|
||||
ret = x509parse_crtfile( &clicert, opt.crt_file );
|
||||
else
|
||||
#endif
|
||||
#if defined(POLARSSL_CERTS_C)
|
||||
ret = x509parse_crt( &clicert, (unsigned char *) test_cli_crt,
|
||||
strlen( test_cli_crt ) );
|
||||
#else
|
||||
{
|
||||
ret = 1;
|
||||
printf("POLARSSL_CERTS_C not defined.");
|
||||
}
|
||||
#endif
|
||||
if( ret != 0 )
|
||||
{
|
||||
printf( " failed\n ! x509parse_crt returned %d\n\n", ret );
|
||||
goto exit;
|
||||
}
|
||||
|
||||
#if defined(POLARSSL_FS_IO)
|
||||
if( strlen( opt.key_file ) )
|
||||
ret = x509parse_keyfile( &rsa, opt.key_file, "" );
|
||||
else
|
||||
#endif
|
||||
#if defined(POLARSSL_CERTS_C)
|
||||
ret = x509parse_key( &rsa, (unsigned char *) test_cli_key,
|
||||
strlen( test_cli_key ), NULL, 0 );
|
||||
|
||||
#else
|
||||
{
|
||||
ret = 1;
|
||||
printf("POLARSSL_CERTS_C not defined.");
|
||||
}
|
||||
#endif
|
||||
if( ret != 0 )
|
||||
{
|
||||
printf( " failed\n ! x509parse_key returned %d\n\n", ret );
|
||||
@@ -376,12 +428,18 @@ int main( int argc, char *argv[] )
|
||||
if( ret == POLARSSL_ERR_SSL_PEER_CLOSE_NOTIFY )
|
||||
break;
|
||||
|
||||
if( ret <= 0 )
|
||||
if( ret < 0 )
|
||||
{
|
||||
printf( "failed\n ! ssl_read returned %d\n\n", ret );
|
||||
break;
|
||||
}
|
||||
|
||||
if( ret == 0 )
|
||||
{
|
||||
printf("\n\nEOF\n\n");
|
||||
break;
|
||||
}
|
||||
|
||||
len = ret;
|
||||
printf( " %d bytes read\n\n%s", len, (char *) buf );
|
||||
}
|
||||
@@ -407,3 +465,5 @@ exit:
|
||||
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_BIGNUM_C && POLARSSL_HAVEGE_C && POLARSSL_SSL_TLS_C &&
|
||||
POLARSSL_SSL_CLI_C && POLARSSL_NET_C && POLARSSL_RSA_C */
|
||||
|
@@ -37,6 +37,8 @@
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "polarssl/havege.h"
|
||||
#include "polarssl/certs.h"
|
||||
#include "polarssl/x509.h"
|
||||
@@ -171,6 +173,18 @@ static int my_set_session( ssl_context *ssl )
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_CERTS_C) || \
|
||||
!defined(POLARSSL_HAVEGE_C) || !defined(POLARSSL_SSL_TLS_C) || \
|
||||
!defined(POLARSSL_SSL_SRV_C) || !defined(POLARSSL_NET_C) || \
|
||||
!defined(POLARSSL_RSA_C)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_BIGNUM_C and/or POLARSSL_CERTS_C and/or POLARSSL_HAVEGE_C "
|
||||
"and/or POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_SRV_C and/or "
|
||||
"POLARSSL_NET_C and/or POLARSSL_RSA_C not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
int main( void )
|
||||
{
|
||||
int ret, len, cnt = 0, pid;
|
||||
@@ -436,3 +450,6 @@ exit:
|
||||
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_BIGNUM_C && POLARSSL_CERTS_C && POLARSSL_HAVEGE_C &&
|
||||
POLARSSL_SSL_TLS_C && POLARSSL_SSL_SRV_C && POLARSSL_NET_C &&
|
||||
POLARSSL_RSA_C */
|
||||
|
@@ -32,6 +32,8 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "polarssl/base64.h"
|
||||
#include "polarssl/error.h"
|
||||
#include "polarssl/net.h"
|
||||
@@ -47,6 +49,7 @@
|
||||
#define DFL_MAIL_FROM ""
|
||||
#define DFL_MAIL_TO ""
|
||||
#define DFL_DEBUG_LEVEL 0
|
||||
#define DFL_CA_FILE ""
|
||||
#define DFL_CRT_FILE ""
|
||||
#define DFL_KEY_FILE ""
|
||||
#define DFL_FORCE_CIPHER 0
|
||||
@@ -70,6 +73,7 @@ struct options
|
||||
char *user_pwd; /* password to use for authentication */
|
||||
char *mail_from; /* E-Mail address to use as sender */
|
||||
char *mail_to; /* E-Mail address to use as recipient */
|
||||
char *ca_file; /* the file with the CA certificate(s) */
|
||||
char *crt_file; /* the file with the client certificate */
|
||||
char *key_file; /* the file with the client key */
|
||||
int force_ciphersuite[2]; /* protocol/ciphersuite to use, or all */
|
||||
@@ -84,10 +88,22 @@ void my_debug( void *ctx, int level, const char *str )
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \
|
||||
!defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \
|
||||
!defined(POLARSSL_NET_C) || !defined(POLARSSL_RSA_C)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or "
|
||||
"POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or "
|
||||
"POLARSSL_NET_C and/or POLARSSL_RSA_C not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
int do_handshake( ssl_context *ssl, struct options *opt )
|
||||
{
|
||||
int ret;
|
||||
unsigned char buf[1024];
|
||||
memset(buf, 0, 1024);
|
||||
|
||||
/*
|
||||
* 4. Handshake
|
||||
@@ -99,7 +115,9 @@ int do_handshake( ssl_context *ssl, struct options *opt )
|
||||
{
|
||||
if( ret != POLARSSL_ERR_NET_WANT_READ && ret != POLARSSL_ERR_NET_WANT_WRITE )
|
||||
{
|
||||
#if defined(POLARSSL_ERROR_C)
|
||||
error_strerror( ret, (char *) buf, 1024 );
|
||||
#endif
|
||||
printf( " failed\n ! ssl_handshake returned %d: %s\n\n", ret, buf );
|
||||
return( -1 );
|
||||
}
|
||||
@@ -265,20 +283,37 @@ int write_and_get_response( int sock_fd, unsigned char *buf, size_t len )
|
||||
while( 1 );
|
||||
}
|
||||
|
||||
#if defined(POLARSSL_BASE64_C)
|
||||
#define USAGE_AUTH \
|
||||
" authentication=%%d default: 0 (disabled)\n" \
|
||||
" user_name=%%s default: \"user\"\n" \
|
||||
" user_pwd=%%s default: \"password\"\n"
|
||||
#else
|
||||
#define USAGE_AUTH \
|
||||
" authentication options disabled. (Require POLARSSL_BASE64_C)\n"
|
||||
#endif /* POLARSSL_BASE64_C */
|
||||
|
||||
#if defined(POLARSSL_FS_IO)
|
||||
#define USAGE_IO \
|
||||
" ca_file=%%s default: \"\" (pre-loaded)\n" \
|
||||
" crt_file=%%s default: \"\" (pre-loaded)\n" \
|
||||
" key_file=%%s default: \"\" (pre-loaded)\n"
|
||||
#else
|
||||
#define USAGE_IO \
|
||||
" No file operations available (POLARSSL_FS_IO not defined)\n"
|
||||
#endif /* POLARSSL_FS_IO */
|
||||
|
||||
#define USAGE \
|
||||
"\n usage: ssl_mail_client param=<>...\n" \
|
||||
"\n acceptable parameters:\n" \
|
||||
" server_name=%%s default: localhost\n" \
|
||||
" server_port=%%d default: 4433\n" \
|
||||
" debug_level=%%d default: 0 (disabled)\n" \
|
||||
" authentication=%%d default: 0 (disabled)\n" \
|
||||
" mode=%%d default: 0 (SSL/TLS) (1 for STARTTLS)\n" \
|
||||
" user_name=%%s default: \"user\"\n" \
|
||||
" user_pwd=%%s default: \"password\"\n" \
|
||||
USAGE_AUTH \
|
||||
" mail_from=%%s default: \"\"\n" \
|
||||
" mail_to=%%s default: \"\"\n" \
|
||||
" crt_file=%%s default: \"\" (pre-loaded)\n" \
|
||||
" key_file=%%s default: \"\" (pre-loaded)\n" \
|
||||
USAGE_IO \
|
||||
" force_ciphersuite=<name> default: all enabled\n"\
|
||||
" acceptable ciphersuite names:\n"
|
||||
|
||||
@@ -286,7 +321,9 @@ int main( int argc, char *argv[] )
|
||||
{
|
||||
int ret = 0, len, server_fd;
|
||||
unsigned char buf[1024];
|
||||
#if defined(POLARSSL_BASE64_C)
|
||||
unsigned char base[1024];
|
||||
#endif
|
||||
char hostname[32];
|
||||
havege_state hs;
|
||||
ssl_context ssl;
|
||||
@@ -333,6 +370,7 @@ int main( int argc, char *argv[] )
|
||||
opt.user_pwd = DFL_USER_PWD;
|
||||
opt.mail_from = DFL_MAIL_FROM;
|
||||
opt.mail_to = DFL_MAIL_TO;
|
||||
opt.ca_file = DFL_CA_FILE;
|
||||
opt.crt_file = DFL_CRT_FILE;
|
||||
opt.key_file = DFL_KEY_FILE;
|
||||
opt.force_ciphersuite[0]= DFL_FORCE_CIPHER;
|
||||
@@ -389,6 +427,8 @@ int main( int argc, char *argv[] )
|
||||
opt.mail_from = q;
|
||||
else if( strcmp( p, "mail_to" ) == 0 )
|
||||
opt.mail_to = q;
|
||||
else if( strcmp( p, "ca_file" ) == 0 )
|
||||
opt.ca_file = q;
|
||||
else if( strcmp( p, "crt_file" ) == 0 )
|
||||
opt.crt_file = q;
|
||||
else if( strcmp( p, "key_file" ) == 0 )
|
||||
@@ -419,12 +459,20 @@ int main( int argc, char *argv[] )
|
||||
printf( "\n . Loading the CA root certificate ..." );
|
||||
fflush( stdout );
|
||||
|
||||
/*
|
||||
* Alternatively, you may load the CA certificates from a .pem or
|
||||
* .crt file by calling x509parse_crtfile( &cacert, "myca.crt" ).
|
||||
*/
|
||||
ret = x509parse_crt( &cacert, (unsigned char *) test_ca_crt,
|
||||
strlen( test_ca_crt ) );
|
||||
#if defined(POLARSSL_FS_IO)
|
||||
if( strlen( opt.ca_file ) )
|
||||
ret = x509parse_crtfile( &cacert, opt.ca_file );
|
||||
else
|
||||
#endif
|
||||
#if defined(POLARSSL_CERTS_C)
|
||||
ret = x509parse_crt( &cacert, (unsigned char *) test_ca_crt,
|
||||
strlen( test_ca_crt ) );
|
||||
#else
|
||||
{
|
||||
ret = 1;
|
||||
printf("POLARSSL_CERTS_C not defined.");
|
||||
}
|
||||
#endif
|
||||
if( ret != 0 )
|
||||
{
|
||||
printf( " failed\n ! x509parse_crt returned %d\n\n", ret );
|
||||
@@ -441,23 +489,40 @@ int main( int argc, char *argv[] )
|
||||
printf( " . Loading the client cert. and key..." );
|
||||
fflush( stdout );
|
||||
|
||||
#if defined(POLARSSL_FS_IO)
|
||||
if( strlen( opt.crt_file ) )
|
||||
ret = x509parse_crtfile( &clicert, opt.crt_file );
|
||||
else
|
||||
#endif
|
||||
#if defined(POLARSSL_CERTS_C)
|
||||
ret = x509parse_crt( &clicert, (unsigned char *) test_cli_crt,
|
||||
strlen( test_cli_crt ) );
|
||||
#else
|
||||
{
|
||||
ret = 1;
|
||||
printf("POLARSSL_CERTS_C not defined.");
|
||||
}
|
||||
#endif
|
||||
if( ret != 0 )
|
||||
{
|
||||
printf( " failed\n ! x509parse_crt returned %d\n\n", ret );
|
||||
goto exit;
|
||||
}
|
||||
|
||||
#if defined(POLARSSL_FS_IO)
|
||||
if( strlen( opt.key_file ) )
|
||||
ret = x509parse_keyfile( &rsa, opt.key_file, "" );
|
||||
else
|
||||
#endif
|
||||
#if defined(POLARSSL_CERTS_C)
|
||||
ret = x509parse_key( &rsa, (unsigned char *) test_cli_key,
|
||||
strlen( test_cli_key ), NULL, 0 );
|
||||
|
||||
#else
|
||||
{
|
||||
ret = 1;
|
||||
printf("POLARSSL_CERTS_C not defined.");
|
||||
}
|
||||
#endif
|
||||
if( ret != 0 )
|
||||
{
|
||||
printf( " failed\n ! x509parse_key returned %d\n\n", ret );
|
||||
@@ -593,6 +658,7 @@ int main( int argc, char *argv[] )
|
||||
goto exit;
|
||||
}
|
||||
|
||||
#if defined(POLARSSL_BASE64_C)
|
||||
if( opt.authentication )
|
||||
{
|
||||
printf( " > Write AUTH LOGIN to server:" );
|
||||
@@ -637,6 +703,7 @@ int main( int argc, char *argv[] )
|
||||
|
||||
printf(" ok\n" );
|
||||
}
|
||||
#endif
|
||||
|
||||
printf( " > Write MAIL FROM to server:" );
|
||||
fflush( stdout );
|
||||
@@ -717,3 +784,5 @@ exit:
|
||||
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_BIGNUM_C && POLARSSL_HAVEGE_C && POLARSSL_SSL_TLS_C &&
|
||||
POLARSSL_SSL_CLI_C && POLARSSL_NET_C && POLARSSL_RSA_C */
|
||||
|
@@ -35,6 +35,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "polarssl/havege.h"
|
||||
#include "polarssl/certs.h"
|
||||
#include "polarssl/x509.h"
|
||||
@@ -168,6 +170,18 @@ static int my_set_session( ssl_context *ssl )
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_CERTS_C) || \
|
||||
!defined(POLARSSL_HAVEGE_C) || !defined(POLARSSL_SSL_TLS_C) || \
|
||||
!defined(POLARSSL_SSL_SRV_C) || !defined(POLARSSL_NET_C) || \
|
||||
!defined(POLARSSL_RSA_C)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_BIGNUM_C and/or POLARSSL_CERTS_C and/or POLARSSL_HAVEGE_C "
|
||||
"and/or POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_SRV_C and/or "
|
||||
"POLARSSL_NET_C and/or POLARSSL_RSA_C not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
int main( void )
|
||||
{
|
||||
int ret, len;
|
||||
@@ -409,3 +423,6 @@ exit:
|
||||
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_BIGNUM_C && POLARSSL_CERTS_C && POLARSSL_HAVEGE_C &&
|
||||
POLARSSL_SSL_TLS_C && POLARSSL_SSL_SRV_C && POLARSSL_NET_C &&
|
||||
POLARSSL_RSA_C */
|
||||
|
@@ -57,6 +57,13 @@ static int myrand( void *rng_state )
|
||||
|
||||
unsigned char buf[BUFSIZE];
|
||||
|
||||
#if !defined(POLARSSL_TIMING_C)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_TIMING_C not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
int main( void )
|
||||
{
|
||||
int keysize;
|
||||
@@ -75,7 +82,8 @@ int main( void )
|
||||
#if defined(POLARSSL_CAMELLIA_C)
|
||||
camellia_context camellia;
|
||||
#endif
|
||||
#if defined(POLARSSL_RSA_C)
|
||||
#if defined(POLARSSL_RSA_C) && defined(POLARSSL_BIGNUM_C) && \
|
||||
defined(POLARSSL_GENPRIME)
|
||||
rsa_context rsa;
|
||||
#endif
|
||||
|
||||
@@ -263,7 +271,8 @@ int main( void )
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_RSA_C)
|
||||
#if defined(POLARSSL_RSA_C) && defined(POLARSSL_BIGNUM_C) && \
|
||||
defined(POLARSSL_GENPRIME)
|
||||
rsa_init( &rsa, RSA_PKCS_V15, 0 );
|
||||
rsa_gen_key( &rsa, myrand, NULL, 1024, 65537 );
|
||||
|
||||
@@ -361,3 +370,4 @@ int main( void )
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
#endif /* POLARSSL_TIMING_C */
|
||||
|
@@ -117,12 +117,12 @@ int main( int argc, char *argv[] )
|
||||
return( ret );
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_RSA_C)
|
||||
#if defined(POLARSSL_RSA_C) && defined(POLARSSL_BIGNUM_C)
|
||||
if( ( ret = rsa_self_test( v ) ) != 0 )
|
||||
return( ret );
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_X509_PARSE_C)
|
||||
#if defined(POLARSSL_X509_PARSE_C) && defined(POLARSSL_BIGNUM_C)
|
||||
if( ( ret = x509_self_test( v ) ) != 0 )
|
||||
return( ret );
|
||||
#endif
|
||||
|
@@ -30,6 +30,8 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "polarssl/certs.h"
|
||||
#include "polarssl/x509.h"
|
||||
|
||||
@@ -63,6 +65,15 @@ char *client_private_keys[MAX_CLIENT_CERTS] =
|
||||
"cert_digest.key"
|
||||
};
|
||||
|
||||
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
|
||||
!defined(POLARSSL_X509_PARSE_C) || !defined(POLARSSL_FS_IO)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
|
||||
"POLARSSL_X509_PARSE_C and/or POLARSSL_FS_IO not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
int main( void )
|
||||
{
|
||||
int ret, i;
|
||||
@@ -232,3 +243,5 @@ exit:
|
||||
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_BIGNUM_C && POLARSSL_RSA_C && POLARSSL_X509_PARSE_C &&
|
||||
POLARSSL_FS_IO */
|
||||
|
@@ -31,6 +31,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "polarssl/net.h"
|
||||
#include "polarssl/ssl.h"
|
||||
#include "polarssl/havege.h"
|
||||
@@ -121,6 +123,19 @@ void my_debug( void *ctx, int level, const char *str )
|
||||
fprintf( stderr, "%s", str );
|
||||
}
|
||||
|
||||
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \
|
||||
!defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_SRV_C) || \
|
||||
!defined(POLARSSL_SSL_CLI_C) || !defined(POLARSSL_NET_C) || \
|
||||
!defined(POLARSSL_RSA_C)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or "
|
||||
"POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_SRV_C and/or "
|
||||
"POLARSSL_SSL_CLI_C and/or POLARSSL_NET_C and/or "
|
||||
"POLARSSL_RSA_C not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
/*
|
||||
* perform a single SSL connection
|
||||
*/
|
||||
@@ -180,6 +195,10 @@ static int ssl_test( struct options *opt )
|
||||
|
||||
if( opt->opmode == OPMODE_SERVER )
|
||||
{
|
||||
#if !defined(POLARSSL_CERTS_C)
|
||||
printf("POLARSSL_CERTS_C not defined.\n");
|
||||
goto exit;
|
||||
#else
|
||||
ret = x509parse_crt( &srvcert, (unsigned char *) test_srv_crt,
|
||||
strlen( test_srv_crt ) );
|
||||
if( ret != 0 )
|
||||
@@ -203,6 +222,7 @@ static int ssl_test( struct options *opt )
|
||||
printf( " ! x509parse_key returned %d\n\n", ret );
|
||||
goto exit;
|
||||
}
|
||||
#endif
|
||||
|
||||
if( server_fd < 0 )
|
||||
{
|
||||
@@ -571,3 +591,6 @@ exit:
|
||||
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_BIGNUM_C && POLARSSL_HAVEGE_C && POLARSSL_SSL_TLS_C &&
|
||||
POLARSSL_SSL_SRV_C && POLARSSL_SSL_CLI_C && POLARSSL_NET_C &&
|
||||
POLARSSL_RSA_C */
|
||||
|
@@ -31,6 +31,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "polarssl/havege.h"
|
||||
#include "polarssl/net.h"
|
||||
#include "polarssl/ssl.h"
|
||||
@@ -77,6 +79,19 @@ void my_debug( void *ctx, int level, const char *str )
|
||||
" debug_level=%%d default: 0 (disabled)\n" \
|
||||
"\n"
|
||||
|
||||
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \
|
||||
!defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \
|
||||
!defined(POLARSSL_NET_C) || !defined(POLARSSL_RSA_C) || \
|
||||
!defined(POLARSSL_X509_PARSE_C) || !defined(POLARSSL_FS_IO)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or "
|
||||
"POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or "
|
||||
"POLARSSL_NET_C and/or POLARSSL_RSA_C and/or "
|
||||
"POLARSSL_X509_PARSE_C and/or POLARSSL_FS_IO not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
int ret = 0, server_fd;
|
||||
@@ -287,3 +302,6 @@ exit:
|
||||
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_BIGNUM_C && POLARSSL_HAVEGE_C && POLARSSL_SSL_TLS_C &&
|
||||
POLARSSL_SSL_CLI_C && POLARSSL_NET_C && POLARSSL_RSA_C &&
|
||||
POLARSSL_X509_PARSE_C && POLARSSL_FS_IO */
|
||||
|
@@ -31,6 +31,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "polarssl/x509.h"
|
||||
|
||||
#define DFL_FILENAME "crl.pem"
|
||||
@@ -61,6 +63,15 @@ void my_debug( void *ctx, int level, const char *str )
|
||||
" debug_level=%%d default: 0 (disabled)\n" \
|
||||
"\n"
|
||||
|
||||
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
|
||||
!defined(POLARSSL_X509_PARSE_C) || !defined(POLARSSL_FS_IO)
|
||||
int main( void )
|
||||
{
|
||||
printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
|
||||
"POLARSSL_X509_PARSE_C and/or POLARSSL_FS_IO not defined.\n");
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
int ret = 0;
|
||||
@@ -152,3 +163,5 @@ exit:
|
||||
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_BIGNUM_C && POLARSSL_RSA_C && POLARSSL_X509_PARSE_C &&
|
||||
POLARSSL_FS_IO */
|
||||
|
Reference in New Issue
Block a user