mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2026-01-07 23:18:59 +01:00
- Fixed a whole bunch of dependencies on defines between files, examples and tests
This commit is contained in:
parent
2c0994e973
commit
5690efccc4
66 changed files with 1408 additions and 701 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue