mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-30 22:43:08 +03:00
The Great Renaming
A simple execution of tmp/invoke-rename.pl
This commit is contained in:
@ -14,26 +14,26 @@ EOU
|
||||
|
||||
# Things that shouldn't be enabled with "full".
|
||||
# Notes:
|
||||
# - POLARSSL_X509_ALLOW_EXTENSIONS_NON_V3 and
|
||||
# POLARSSL_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION could be enabled if the
|
||||
# - MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3 and
|
||||
# MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION could be enabled if the
|
||||
# respective tests were adapted
|
||||
my @excluded = qw(
|
||||
POLARSSL_DEPRECATED_REMOVED
|
||||
POLARSSL_HAVE_INT8
|
||||
POLARSSL_HAVE_INT16
|
||||
POLARSSL_HAVE_SSE2
|
||||
POLARSSL_PLATFORM_NO_STD_FUNCTIONS
|
||||
POLARSSL_ECP_DP_M221_ENABLED
|
||||
POLARSSL_ECP_DP_M383_ENABLED
|
||||
POLARSSL_ECP_DP_M511_ENABLED
|
||||
POLARSSL_NO_DEFAULT_ENTROPY_SOURCES
|
||||
POLARSSL_NO_PLATFORM_ENTROPY
|
||||
POLARSSL_REMOVE_ARC4_CIPHERSUITES
|
||||
POLARSSL_SSL_HW_RECORD_ACCEL
|
||||
POLARSSL_X509_ALLOW_EXTENSIONS_NON_V3
|
||||
POLARSSL_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
|
||||
POLARSSL_ZLIB_SUPPORT
|
||||
POLARSSL_PKCS11_C
|
||||
MBEDTLS_DEPRECATED_REMOVED
|
||||
MBEDTLS_HAVE_INT8
|
||||
MBEDTLS_HAVE_INT16
|
||||
MBEDTLS_HAVE_SSE2
|
||||
MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
|
||||
MBEDTLS_ECP_DP_M221_ENABLED
|
||||
MBEDTLS_ECP_DP_M383_ENABLED
|
||||
MBEDTLS_ECP_DP_M511_ENABLED
|
||||
MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
|
||||
MBEDTLS_NO_PLATFORM_ENTROPY
|
||||
MBEDTLS_REMOVE_ARC4_CIPHERSUITES
|
||||
MBEDTLS_SSL_HW_RECORD_ACCEL
|
||||
MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3
|
||||
MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
|
||||
MBEDTLS_ZLIB_SUPPORT
|
||||
MBEDTLS_PKCS11_C
|
||||
_ALT\s*$
|
||||
);
|
||||
|
||||
|
@ -20,24 +20,24 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#if !defined(POLARSSL_CONFIG_FILE)
|
||||
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||
#include "mbedtls/config.h"
|
||||
#else
|
||||
#include POLARSSL_CONFIG_FILE
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_ERROR_C) || defined(POLARSSL_ERROR_STRERROR_DUMMY)
|
||||
#if defined(MBEDTLS_ERROR_C) || defined(MBEDTLS_ERROR_STRERROR_DUMMY)
|
||||
#include "mbedtls/error.h"
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_PLATFORM_C)
|
||||
#if defined(MBEDTLS_PLATFORM_C)
|
||||
#include "mbedtls/platform.h"
|
||||
#else
|
||||
#define polarssl_snprintf snprintf
|
||||
#define mbedtls_snprintf snprintf
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_ERROR_C)
|
||||
#if defined(MBEDTLS_ERROR_C)
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@ -47,7 +47,7 @@ HEADER_INCLUDED
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
void polarssl_strerror( int ret, char *buf, size_t buflen )
|
||||
void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
{
|
||||
size_t len;
|
||||
int use_ret;
|
||||
@ -73,7 +73,7 @@ HIGH_LEVEL_CODE_CHECKS
|
||||
// END generated code
|
||||
|
||||
if( strlen( buf ) == 0 )
|
||||
polarssl_snprintf( buf, buflen, "UNKNOWN ERROR CODE (%04X)", use_ret );
|
||||
mbedtls_snprintf( buf, buflen, "UNKNOWN ERROR CODE (%04X)", use_ret );
|
||||
}
|
||||
|
||||
use_ret = ret & ~0xFF80;
|
||||
@ -91,7 +91,7 @@ HIGH_LEVEL_CODE_CHECKS
|
||||
if( buflen - len < 5 )
|
||||
return;
|
||||
|
||||
polarssl_snprintf( buf + len, buflen - len, " : " );
|
||||
mbedtls_snprintf( buf + len, buflen - len, " : " );
|
||||
|
||||
buf += len + 3;
|
||||
buflen -= len + 3;
|
||||
@ -106,17 +106,17 @@ LOW_LEVEL_CODE_CHECKS
|
||||
if( strlen( buf ) != 0 )
|
||||
return;
|
||||
|
||||
polarssl_snprintf( buf, buflen, "UNKNOWN ERROR CODE (%04X)", use_ret );
|
||||
mbedtls_snprintf( buf, buflen, "UNKNOWN ERROR CODE (%04X)", use_ret );
|
||||
}
|
||||
|
||||
#else /* POLARSSL_ERROR_C */
|
||||
#else /* MBEDTLS_ERROR_C */
|
||||
|
||||
#if defined(POLARSSL_ERROR_STRERROR_DUMMY)
|
||||
#if defined(MBEDTLS_ERROR_STRERROR_DUMMY)
|
||||
|
||||
/*
|
||||
* Provide an non-function in case POLARSSL_ERROR_C is not defined
|
||||
* Provide an non-function in case MBEDTLS_ERROR_C is not defined
|
||||
*/
|
||||
void polarssl_strerror( int ret, char *buf, size_t buflen )
|
||||
void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
{
|
||||
((void) ret);
|
||||
|
||||
@ -124,6 +124,6 @@ void polarssl_strerror( int ret, char *buf, size_t buflen )
|
||||
buf[0] = '\0';
|
||||
}
|
||||
|
||||
#endif /* POLARSSL_ERROR_STRERROR_DUMMY */
|
||||
#endif /* MBEDTLS_ERROR_STRERROR_DUMMY */
|
||||
|
||||
#endif /* POLARSSL_ERROR_C */
|
||||
#endif /* MBEDTLS_ERROR_C */
|
||||
|
@ -20,13 +20,13 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#if !defined(POLARSSL_CONFIG_FILE)
|
||||
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||
#include "mbedtls/config.h"
|
||||
#else
|
||||
#include POLARSSL_CONFIG_FILE
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_VERSION_C)
|
||||
#if defined(MBEDTLS_VERSION_C)
|
||||
|
||||
#include "mbedtls/version.h"
|
||||
|
||||
@ -38,13 +38,13 @@
|
||||
#endif
|
||||
|
||||
static const char *features[] = {
|
||||
#if defined(POLARSSL_VERSION_FEATURES)
|
||||
#if defined(MBEDTLS_VERSION_FEATURES)
|
||||
FEATURE_DEFINES
|
||||
#endif /* POLARSSL_VERSION_FEATURES */
|
||||
#endif /* MBEDTLS_VERSION_FEATURES */
|
||||
NULL
|
||||
};
|
||||
|
||||
int version_check_feature( const char *feature )
|
||||
int mbedtls_version_check_feature( const char *feature )
|
||||
{
|
||||
const char **idx = features;
|
||||
|
||||
@ -63,4 +63,4 @@ int version_check_feature( const char *feature )
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
#endif /* POLARSSL_VERSION_C */
|
||||
#endif /* MBEDTLS_VERSION_C */
|
||||
|
@ -30,37 +30,37 @@ CONFIG_BAK=${CONFIG_H}.bak
|
||||
cp $CONFIG_H $CONFIG_BAK
|
||||
|
||||
cat << EOF >$CONFIG_H
|
||||
#define POLARSSL_PLATFORM_C
|
||||
#define POLARSSL_PLATFORM_MEMORY
|
||||
#define POLARSSL_MEMORY_BUFFER_ALLOC_C
|
||||
#define POLARSSL_MEMORY_DEBUG
|
||||
#define MBEDTLS_PLATFORM_C
|
||||
#define MBEDTLS_PLATFORM_MEMORY
|
||||
#define MBEDTLS_MEMORY_BUFFER_ALLOC_C
|
||||
#define MBEDTLS_MEMORY_DEBUG
|
||||
|
||||
#define POLARSSL_TIMING_C
|
||||
#define MBEDTLS_TIMING_C
|
||||
|
||||
#define POLARSSL_BIGNUM_C
|
||||
#define POLARSSL_ECP_C
|
||||
#define POLARSSL_ASN1_PARSE_C
|
||||
#define POLARSSL_ASN1_WRITE_C
|
||||
#define POLARSSL_ECDSA_C
|
||||
#define POLARSSL_ECDH_C
|
||||
#define MBEDTLS_BIGNUM_C
|
||||
#define MBEDTLS_ECP_C
|
||||
#define MBEDTLS_ASN1_PARSE_C
|
||||
#define MBEDTLS_ASN1_WRITE_C
|
||||
#define MBEDTLS_ECDSA_C
|
||||
#define MBEDTLS_ECDH_C
|
||||
|
||||
#define POLARSSL_ECP_DP_SECP192R1_ENABLED
|
||||
#define POLARSSL_ECP_DP_SECP224R1_ENABLED
|
||||
#define POLARSSL_ECP_DP_SECP256R1_ENABLED
|
||||
#define POLARSSL_ECP_DP_SECP384R1_ENABLED
|
||||
#define POLARSSL_ECP_DP_SECP521R1_ENABLED
|
||||
#define POLARSSL_ECP_DP_M255_ENABLED
|
||||
#define MBEDTLS_ECP_DP_SECP192R1_ENABLED
|
||||
#define MBEDTLS_ECP_DP_SECP224R1_ENABLED
|
||||
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
|
||||
#define MBEDTLS_ECP_DP_SECP384R1_ENABLED
|
||||
#define MBEDTLS_ECP_DP_SECP521R1_ENABLED
|
||||
#define MBEDTLS_ECP_DP_M255_ENABLED
|
||||
|
||||
#include "check_config.h"
|
||||
|
||||
//#define POLARSSL_ECP_WINDOW_SIZE 6
|
||||
//#define POLARSSL_ECP_FIXED_POINT_OPTIM 1
|
||||
//#define MBEDTLS_ECP_WINDOW_SIZE 6
|
||||
//#define MBEDTLS_ECP_FIXED_POINT_OPTIM 1
|
||||
EOF
|
||||
|
||||
for F in 0 1; do
|
||||
for W in 2 3 4 5 6; do
|
||||
scripts/config.pl set POLARSSL_ECP_WINDOW_SIZE $W
|
||||
scripts/config.pl set POLARSSL_ECP_FIXED_POINT_OPTIM $F
|
||||
scripts/config.pl set MBEDTLS_ECP_WINDOW_SIZE $W
|
||||
scripts/config.pl set MBEDTLS_ECP_FIXED_POINT_OPTIM $F
|
||||
make benchmark >/dev/null 2>&1
|
||||
echo "fixed point optim = $F, max window size = $W"
|
||||
echo "--------------------------------------------"
|
||||
|
@ -2,8 +2,8 @@
|
||||
expression x, y;
|
||||
statement S;
|
||||
@@
|
||||
x = polarssl_malloc(...);
|
||||
y = polarssl_malloc(...);
|
||||
x = mbedtls_malloc(...);
|
||||
y = mbedtls_malloc(...);
|
||||
...
|
||||
* if (x == NULL || y == NULL)
|
||||
S
|
||||
@ -13,8 +13,8 @@ expression x, y;
|
||||
statement S;
|
||||
@@
|
||||
if (
|
||||
* (x = polarssl_malloc(...)) == NULL
|
||||
* (x = mbedtls_malloc(...)) == NULL
|
||||
||
|
||||
* (y = polarssl_malloc(...)) == NULL
|
||||
* (y = mbedtls_malloc(...)) == NULL
|
||||
)
|
||||
S
|
||||
|
@ -46,7 +46,7 @@ close(FORMAT_FILE);
|
||||
|
||||
$/ = $line_separator;
|
||||
|
||||
open(GREP, "grep \"define POLARSSL_ERR_\" $include_dir/* |") || die("Failure when calling grep: $!");
|
||||
open(GREP, "grep \"define MBEDTLS_ERR_\" $include_dir/* |") || die("Failure when calling grep: $!");
|
||||
|
||||
my $ll_old_define = "";
|
||||
my $hl_old_define = "";
|
||||
@ -61,7 +61,7 @@ my %error_codes_seen;
|
||||
while (my $line = <GREP>)
|
||||
{
|
||||
next if ($line =~ /compat-1.2.h/);
|
||||
my ($error_name, $error_code) = $line =~ /(POLARSSL_ERR_\w+)\s+\-(0x\w+)/;
|
||||
my ($error_name, $error_code) = $line =~ /(MBEDTLS_ERR_\w+)\s+\-(0x\w+)/;
|
||||
my ($description) = $line =~ /\/\*\*< (.*?)\.? \*\//;
|
||||
|
||||
die "Duplicated error code: $error_code ($error_name)\n"
|
||||
@ -73,7 +73,7 @@ while (my $line = <GREP>)
|
||||
warn "Missing description for $error_name\n";
|
||||
}
|
||||
|
||||
my ($module_name) = $error_name =~ /^POLARSSL_ERR_([^_]+)/;
|
||||
my ($module_name) = $error_name =~ /^MBEDTLS_ERR_([^_]+)/;
|
||||
|
||||
# Fix faulty ones
|
||||
$module_name = "BIGNUM" if ($module_name eq "MPI");
|
||||
@ -94,7 +94,7 @@ while (my $line = <GREP>)
|
||||
my $found_hl = grep $_ eq $module_name, @high_level_modules;
|
||||
if (!$found_ll && !$found_hl)
|
||||
{
|
||||
polarssl_printf("Error: Do not know how to handle: $module_name\n");
|
||||
mbedtls_printf("Error: Do not know how to handle: $module_name\n");
|
||||
exit 1;
|
||||
}
|
||||
|
||||
@ -125,7 +125,7 @@ while (my $line = <GREP>)
|
||||
foreach my $dep (split(/,/, ${$old_define}))
|
||||
{
|
||||
${$code_check} .= " || " if ($first++);
|
||||
${$code_check} .= "POLARSSL_${dep}_C";
|
||||
${$code_check} .= "MBEDTLS_${dep}_C";
|
||||
}
|
||||
${$code_check} .= " */\n\n";
|
||||
}
|
||||
@ -138,8 +138,8 @@ while (my $line = <GREP>)
|
||||
${$code_check} .= " || " if ($first);
|
||||
$headers .= " || " if ($first++);
|
||||
|
||||
${$code_check} .= "defined(POLARSSL_${dep}_C)";
|
||||
$headers .= "defined(POLARSSL_${dep}_C)" if
|
||||
${$code_check} .= "defined(MBEDTLS_${dep}_C)";
|
||||
$headers .= "defined(MBEDTLS_${dep}_C)" if
|
||||
($include_name ne "");
|
||||
}
|
||||
${$code_check} .= "\n";
|
||||
@ -148,28 +148,28 @@ while (my $line = <GREP>)
|
||||
${$old_define} = $define_name;
|
||||
}
|
||||
|
||||
if ($error_name eq "POLARSSL_ERR_SSL_FATAL_ALERT_MESSAGE")
|
||||
if ($error_name eq "MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE")
|
||||
{
|
||||
${$code_check} .= "${white_space}if( use_ret == -($error_name) )\n".
|
||||
"${white_space}\{\n".
|
||||
"${white_space} polarssl_snprintf( buf, buflen, \"$module_name - $description\" );\n".
|
||||
"${white_space} mbedtls_snprintf( buf, buflen, \"$module_name - $description\" );\n".
|
||||
"${white_space} return;\n".
|
||||
"${white_space}}\n"
|
||||
}
|
||||
else
|
||||
{
|
||||
${$code_check} .= "${white_space}if( use_ret == -($error_name) )\n".
|
||||
"${white_space} polarssl_snprintf( buf, buflen, \"$module_name - $description\" );\n"
|
||||
"${white_space} mbedtls_snprintf( buf, buflen, \"$module_name - $description\" );\n"
|
||||
}
|
||||
};
|
||||
|
||||
if ($ll_old_define ne "")
|
||||
{
|
||||
$ll_code_check .= "#endif /* POLARSSL_${ll_old_define}_C */\n";
|
||||
$ll_code_check .= "#endif /* MBEDTLS_${ll_old_define}_C */\n";
|
||||
}
|
||||
if ($hl_old_define ne "")
|
||||
{
|
||||
$hl_code_check .= "#endif /* POLARSSL_${hl_old_define}_C */\n";
|
||||
$hl_code_check .= "#endif /* MBEDTLS_${hl_old_define}_C */\n";
|
||||
}
|
||||
|
||||
$error_format =~ s/HEADER_INCLUDED\n/$headers/g;
|
||||
|
@ -48,13 +48,13 @@ while (my $file = shift @ARGV)
|
||||
open my $fh, "<", $file or die "read $file failed: $!\n";
|
||||
while (<$fh>)
|
||||
{
|
||||
if( /polarssl_malloc\(/ ) {
|
||||
if( /$id\s*=.*polarssl_malloc\(/ ) {
|
||||
if( /mbedtls_malloc\(/ ) {
|
||||
if( /$id\s*=.*mbedtls_malloc\(/ ) {
|
||||
push @bad, "$file:$line:$name" if $name;
|
||||
$name = $1;
|
||||
$line = $.;
|
||||
} else {
|
||||
push @bad, "$file:$.:???" unless /return polarssl_malloc/;
|
||||
push @bad, "$file:$.:???" unless /return mbedtls_malloc/;
|
||||
}
|
||||
} elsif( $name && /(?:$inits)\($prefix\Q$name\E\b/ ) {
|
||||
undef $name;
|
||||
|
@ -46,7 +46,7 @@ do_config()
|
||||
echo ""
|
||||
echo "config-$NAME:"
|
||||
cp configs/config-$NAME.h $CONFIG_H
|
||||
scripts/config.pl unset POLARSSL_SSL_SRV_C
|
||||
scripts/config.pl unset MBEDTLS_SSL_SRV_C
|
||||
|
||||
for FLAG in $UNSET_LIST; do
|
||||
scripts/config.pl unset $FLAG
|
||||
@ -112,7 +112,7 @@ do_config "ccm-psk-tls1_2" \
|
||||
"psk=000102030405060708090A0B0C0D0E0F"
|
||||
|
||||
do_config "suite-b" \
|
||||
"POLARSSL_BASE64_C POLARSSL_PEM_PARSE_C POLARSSL_CERTS_C" \
|
||||
"MBEDTLS_BASE64_C MBEDTLS_PEM_PARSE_C MBEDTLS_CERTS_C" \
|
||||
""
|
||||
|
||||
# cleanup
|
||||
|
@ -15,8 +15,8 @@ use utf8;
|
||||
use open qw(:std utf8);
|
||||
|
||||
# exclude functions that are ok:
|
||||
# - mpi_write_hlp: bounded by size of mpi, a compile-time constant
|
||||
# - x509_crt_verify_child: bounded by POLARSSL_X509_MAX_INTERMEDIATE_CA
|
||||
# - mpi_write_hlp: bounded by size of mbedtls_mpi, a compile-time constant
|
||||
# - x509_crt_verify_child: bounded by MBEDTLS_X509_MAX_INTERMEDIATE_CA
|
||||
my $known_ok = qr/mpi_write_hlp|x509_crt_verify_child/;
|
||||
|
||||
my $cur_name;
|
||||
|
@ -4,4 +4,4 @@ type T;
|
||||
@@
|
||||
x =
|
||||
- (T *)
|
||||
polarssl_malloc(n)
|
||||
mbedtls_malloc(n)
|
||||
|
Reference in New Issue
Block a user