mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 06:55:46 +01:00
Rename to mbed TLS in examples
This commit is contained in:
parent
b64d9a79a4
commit
9169921271
@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
#define HTTP_RESPONSE \
|
#define HTTP_RESPONSE \
|
||||||
"HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n" \
|
"HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n" \
|
||||||
"<h2>PolarSSL Test Server</h2>\r\n" \
|
"<h2>mbed TLS Test Server</h2>\r\n" \
|
||||||
"<p>Successful connection using: %s</p>\r\n"
|
"<p>Successful connection using: %s</p>\r\n"
|
||||||
|
|
||||||
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_CERTS_C) || \
|
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_CERTS_C) || \
|
||||||
|
@ -805,9 +805,9 @@ int main( int argc, char *argv[] )
|
|||||||
printf( " > Write content to server:" );
|
printf( " > Write content to server:" );
|
||||||
fflush( stdout );
|
fflush( stdout );
|
||||||
|
|
||||||
len = sprintf( (char *) buf, "From: %s\r\nSubject: PolarSSL Test mail\r\n\r\n"
|
len = sprintf( (char *) buf, "From: %s\r\nSubject: mbed TLS Test mail\r\n\r\n"
|
||||||
"This is a simple test mail from the "
|
"This is a simple test mail from the "
|
||||||
"PolarSSL mail client example.\r\n"
|
"mbed TLS mail client example.\r\n"
|
||||||
"\r\n"
|
"\r\n"
|
||||||
"Enjoy!", opt.mail_from );
|
"Enjoy!", opt.mail_from );
|
||||||
ret = write_ssl_data( &ssl, buf, len );
|
ret = write_ssl_data( &ssl, buf, len );
|
||||||
|
@ -77,7 +77,7 @@ int main( int argc, char *argv[] )
|
|||||||
|
|
||||||
#define HTTP_RESPONSE \
|
#define HTTP_RESPONSE \
|
||||||
"HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n" \
|
"HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n" \
|
||||||
"<h2>PolarSSL Test Server</h2>\r\n" \
|
"<h2>mbed TLS Test Server</h2>\r\n" \
|
||||||
"<p>Successful connection using: %s</p>\r\n"
|
"<p>Successful connection using: %s</p>\r\n"
|
||||||
|
|
||||||
#define DEBUG_LEVEL 0
|
#define DEBUG_LEVEL 0
|
||||||
|
@ -71,7 +71,7 @@ int main( int argc, char *argv[] )
|
|||||||
|
|
||||||
#define HTTP_RESPONSE \
|
#define HTTP_RESPONSE \
|
||||||
"HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n" \
|
"HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n" \
|
||||||
"<h2>PolarSSL Test Server</h2>\r\n" \
|
"<h2>mbed TLS Test Server</h2>\r\n" \
|
||||||
"<p>Successful connection using: %s</p>\r\n"
|
"<p>Successful connection using: %s</p>\r\n"
|
||||||
|
|
||||||
#define DEBUG_LEVEL 0
|
#define DEBUG_LEVEL 0
|
||||||
|
@ -134,7 +134,7 @@ int main( int argc, char *argv[] )
|
|||||||
* packets (for fragmentation purposes) */
|
* packets (for fragmentation purposes) */
|
||||||
#define HTTP_RESPONSE \
|
#define HTTP_RESPONSE \
|
||||||
"HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n" \
|
"HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n" \
|
||||||
"<h2>PolarSSL Test Server</h2>\r\n" \
|
"<h2>mbed TLS Test Server</h2>\r\n" \
|
||||||
"<p>Successful connection using: %s</p>\r\n" // LONG_RESPONSE
|
"<p>Successful connection using: %s</p>\r\n" // LONG_RESPONSE
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Test application that shows some PolarSSL and OpenSSL compatibility
|
* Test application that shows some mbed TLS and OpenSSL compatibility
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011-2012 Brainspark B.V.
|
* Copyright (C) 2011-2012 Brainspark B.V.
|
||||||
*
|
*
|
||||||
@ -103,7 +103,7 @@ int main( int argc, char *argv[] )
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf( " . Reading private key from %s into PolarSSL ...", argv[1] );
|
printf( " . Reading private key from %s into mbed TLS ...", argv[1] );
|
||||||
fflush( stdout );
|
fflush( stdout );
|
||||||
|
|
||||||
pk_init( &p_pk );
|
pk_init( &p_pk );
|
||||||
@ -152,7 +152,7 @@ int main( int argc, char *argv[] )
|
|||||||
/*
|
/*
|
||||||
* Calculate the RSA encryption with public key.
|
* Calculate the RSA encryption with public key.
|
||||||
*/
|
*/
|
||||||
printf( " . Generating the RSA encrypted value with PolarSSL (RSA_PUBLIC) ..." );
|
printf( " . Generating the RSA encrypted value with mbed TLS (RSA_PUBLIC) ..." );
|
||||||
fflush( stdout );
|
fflush( stdout );
|
||||||
|
|
||||||
if( ( ret = rsa_pkcs1_encrypt( p_rsa, ctr_drbg_random, &ctr_drbg, RSA_PUBLIC, strlen( argv[2] ), input, p_pub_encrypted ) ) != 0 )
|
if( ( ret = rsa_pkcs1_encrypt( p_rsa, ctr_drbg_random, &ctr_drbg, RSA_PUBLIC, strlen( argv[2] ), input, p_pub_encrypted ) ) != 0 )
|
||||||
@ -178,7 +178,7 @@ int main( int argc, char *argv[] )
|
|||||||
/*
|
/*
|
||||||
* Calculate the RSA encryption with private key.
|
* Calculate the RSA encryption with private key.
|
||||||
*/
|
*/
|
||||||
printf( " . Generating the RSA encrypted value with PolarSSL (RSA_PRIVATE) ..." );
|
printf( " . Generating the RSA encrypted value with mbed TLS (RSA_PRIVATE) ..." );
|
||||||
fflush( stdout );
|
fflush( stdout );
|
||||||
|
|
||||||
if( ( ret = rsa_pkcs1_encrypt( p_rsa, ctr_drbg_random, &ctr_drbg, RSA_PRIVATE, strlen( argv[2] ), input, p_priv_encrypted ) ) != 0 )
|
if( ( ret = rsa_pkcs1_encrypt( p_rsa, ctr_drbg_random, &ctr_drbg, RSA_PRIVATE, strlen( argv[2] ), input, p_priv_encrypted ) ) != 0 )
|
||||||
@ -206,7 +206,7 @@ int main( int argc, char *argv[] )
|
|||||||
/*
|
/*
|
||||||
* Calculate the RSA decryption with private key.
|
* Calculate the RSA decryption with private key.
|
||||||
*/
|
*/
|
||||||
printf( " . Generating the RSA decrypted value for OpenSSL (PUBLIC) with PolarSSL (PRIVATE) ..." );
|
printf( " . Generating the RSA decrypted value for OpenSSL (PUBLIC) with mbed TLS (PRIVATE) ..." );
|
||||||
fflush( stdout );
|
fflush( stdout );
|
||||||
|
|
||||||
if( ( ret = rsa_pkcs1_decrypt( p_rsa, ctr_drbg_random, &ctr_drbg, RSA_PRIVATE, &olen, o_pub_encrypted, p_pub_decrypted, 1024 ) ) != 0 )
|
if( ( ret = rsa_pkcs1_decrypt( p_rsa, ctr_drbg_random, &ctr_drbg, RSA_PRIVATE, &olen, o_pub_encrypted, p_pub_decrypted, 1024 ) ) != 0 )
|
||||||
@ -216,7 +216,7 @@ int main( int argc, char *argv[] )
|
|||||||
else
|
else
|
||||||
printf( " passed\n");
|
printf( " passed\n");
|
||||||
|
|
||||||
printf( " . Generating the RSA decrypted value for PolarSSL (PUBLIC) with OpenSSL (PRIVATE) ..." );
|
printf( " . Generating the RSA decrypted value for mbed TLS (PUBLIC) with OpenSSL (PRIVATE) ..." );
|
||||||
fflush( stdout );
|
fflush( stdout );
|
||||||
|
|
||||||
if( ( ret = RSA_private_decrypt( p_rsa->len, p_pub_encrypted, o_pub_decrypted, o_rsa, RSA_PKCS1_PADDING ) ) == -1 )
|
if( ( ret = RSA_private_decrypt( p_rsa->len, p_pub_encrypted, o_pub_decrypted, o_rsa, RSA_PKCS1_PADDING ) ) == -1 )
|
||||||
@ -230,7 +230,7 @@ int main( int argc, char *argv[] )
|
|||||||
/*
|
/*
|
||||||
* Calculate the RSA decryption with public key.
|
* Calculate the RSA decryption with public key.
|
||||||
*/
|
*/
|
||||||
printf( " . Generating the RSA decrypted value for OpenSSL (PRIVATE) with PolarSSL (PUBLIC) ..." );
|
printf( " . Generating the RSA decrypted value for OpenSSL (PRIVATE) with mbed TLS (PUBLIC) ..." );
|
||||||
fflush( stdout );
|
fflush( stdout );
|
||||||
|
|
||||||
if( ( ret = rsa_pkcs1_decrypt( p_rsa, NULL, NULL, RSA_PUBLIC, &olen, o_priv_encrypted, p_priv_decrypted, 1024 ) ) != 0 )
|
if( ( ret = rsa_pkcs1_decrypt( p_rsa, NULL, NULL, RSA_PUBLIC, &olen, o_priv_encrypted, p_priv_decrypted, 1024 ) ) != 0 )
|
||||||
@ -240,7 +240,7 @@ int main( int argc, char *argv[] )
|
|||||||
else
|
else
|
||||||
printf( " passed\n");
|
printf( " passed\n");
|
||||||
|
|
||||||
printf( " . Generating the RSA decrypted value for PolarSSL (PRIVATE) with OpenSSL (PUBLIC) ..." );
|
printf( " . Generating the RSA decrypted value for mbed TLS (PRIVATE) with OpenSSL (PUBLIC) ..." );
|
||||||
fflush( stdout );
|
fflush( stdout );
|
||||||
|
|
||||||
if( ( ret = RSA_public_decrypt( p_rsa->len, p_priv_encrypted, o_priv_decrypted, o_rsa, RSA_PKCS1_PADDING ) ) == -1 )
|
if( ( ret = RSA_public_decrypt( p_rsa->len, p_priv_encrypted, o_priv_decrypted, o_rsa, RSA_PKCS1_PADDING ) ) == -1 )
|
||||||
@ -252,10 +252,10 @@ int main( int argc, char *argv[] )
|
|||||||
printf( " passed\n");
|
printf( " passed\n");
|
||||||
|
|
||||||
printf( "\n" );
|
printf( "\n" );
|
||||||
printf( "String value (OpenSSL Public Encrypt, PolarSSL Private Decrypt): '%s'\n", p_pub_decrypted );
|
printf( "String value (OpenSSL Public Encrypt, mbed TLS Private Decrypt): '%s'\n", p_pub_decrypted );
|
||||||
printf( "String value (PolarSSL Public Encrypt, OpenSSL Private Decrypt): '%s'\n", o_pub_decrypted );
|
printf( "String value (mbed TLS Public Encrypt, OpenSSL Private Decrypt): '%s'\n", o_pub_decrypted );
|
||||||
printf( "String value (OpenSSL Private Encrypt, PolarSSL Public Decrypt): '%s'\n", p_priv_decrypted );
|
printf( "String value (OpenSSL Private Encrypt, mbed TLS Public Decrypt): '%s'\n", p_priv_decrypted );
|
||||||
printf( "String value (PolarSSL Private Encrypt, OpenSSL Public Decrypt): '%s'\n", o_priv_decrypted );
|
printf( "String value (mbed TLS Private Encrypt, OpenSSL Public Decrypt): '%s'\n", o_priv_decrypted );
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
ctr_drbg_free( &ctr_drbg );
|
ctr_drbg_free( &ctr_drbg );
|
||||||
|
@ -57,7 +57,7 @@ int main( int argc, char *argv[] )
|
|||||||
#define DFL_FILENAME "keyfile.key"
|
#define DFL_FILENAME "keyfile.key"
|
||||||
#define DFL_DEBUG_LEVEL 0
|
#define DFL_DEBUG_LEVEL 0
|
||||||
#define DFL_OUTPUT_FILENAME "cert.req"
|
#define DFL_OUTPUT_FILENAME "cert.req"
|
||||||
#define DFL_SUBJECT_NAME "CN=Cert,O=PolarSSL,C=NL"
|
#define DFL_SUBJECT_NAME "CN=Cert,O=mbed TLS,C=UK"
|
||||||
#define DFL_KEY_USAGE 0
|
#define DFL_KEY_USAGE 0
|
||||||
#define DFL_NS_CERT_TYPE 0
|
#define DFL_NS_CERT_TYPE 0
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ int write_certificate_request( x509write_csr *req, const char *output_file,
|
|||||||
" filename=%%s default: keyfile.key\n" \
|
" filename=%%s default: keyfile.key\n" \
|
||||||
" debug_level=%%d default: 0 (disabled)\n" \
|
" debug_level=%%d default: 0 (disabled)\n" \
|
||||||
" output_file=%%s default: cert.req\n" \
|
" output_file=%%s default: cert.req\n" \
|
||||||
" subject_name=%%s default: CN=Cert,O=PolarSSL,C=NL\n" \
|
" subject_name=%%s default: CN=Cert,O=mbed TLS,C=UK\n" \
|
||||||
" key_usage=%%s default: (empty)\n" \
|
" key_usage=%%s default: (empty)\n" \
|
||||||
" Comma-separated-list of values:\n" \
|
" Comma-separated-list of values:\n" \
|
||||||
" digital_signature\n" \
|
" digital_signature\n" \
|
||||||
|
@ -63,8 +63,8 @@ int main( int argc, char *argv[] )
|
|||||||
#define DFL_SUBJECT_PWD ""
|
#define DFL_SUBJECT_PWD ""
|
||||||
#define DFL_ISSUER_PWD ""
|
#define DFL_ISSUER_PWD ""
|
||||||
#define DFL_OUTPUT_FILENAME "cert.crt"
|
#define DFL_OUTPUT_FILENAME "cert.crt"
|
||||||
#define DFL_SUBJECT_NAME "CN=Cert,O=PolarSSL,C=NL"
|
#define DFL_SUBJECT_NAME "CN=Cert,O=mbed TLS,C=UK"
|
||||||
#define DFL_ISSUER_NAME "CN=CA,O=PolarSSL,C=NL"
|
#define DFL_ISSUER_NAME "CN=CA,O=mbed TLS,C=UK"
|
||||||
#define DFL_NOT_BEFORE "20010101000000"
|
#define DFL_NOT_BEFORE "20010101000000"
|
||||||
#define DFL_NOT_AFTER "20301231235959"
|
#define DFL_NOT_AFTER "20301231235959"
|
||||||
#define DFL_SERIAL "1"
|
#define DFL_SERIAL "1"
|
||||||
@ -142,12 +142,12 @@ int write_certificate( x509write_cert *crt, const char *output_file,
|
|||||||
USAGE_CSR \
|
USAGE_CSR \
|
||||||
" subject_key=%%s default: subject.key\n" \
|
" subject_key=%%s default: subject.key\n" \
|
||||||
" subject_pwd=%%s default: (empty)\n" \
|
" subject_pwd=%%s default: (empty)\n" \
|
||||||
" subject_name=%%s default: CN=Cert,O=PolarSSL,C=NL\n" \
|
" subject_name=%%s default: CN=Cert,O=mbed TLS,C=UK\n" \
|
||||||
"\n" \
|
"\n" \
|
||||||
" issuer_crt=%%s default: (empty)\n" \
|
" issuer_crt=%%s default: (empty)\n" \
|
||||||
" If issuer_crt is specified, issuer_name is\n" \
|
" If issuer_crt is specified, issuer_name is\n" \
|
||||||
" ignored!\n" \
|
" ignored!\n" \
|
||||||
" issuer_name=%%s default: CN=CA,O=PolarSSL,C=NL\n" \
|
" issuer_name=%%s default: CN=CA,O=mbed TLS,C=UK\n" \
|
||||||
"\n" \
|
"\n" \
|
||||||
" selfsign=%%d default: 0 (false)\n" \
|
" selfsign=%%d default: 0 (false)\n" \
|
||||||
" If selfsign is enabled, issuer_name and\n" \
|
" If selfsign is enabled, issuer_name and\n" \
|
||||||
|
Loading…
Reference in New Issue
Block a user