mbed TLS upgraded to 2.6.0
Fork of mbedtls by
scripts/generate_features.pl@2:bbdeda018a3c, 2017-09-29 (annotated)
- Committer:
- Jasper Wallace
- Date:
- Fri Sep 29 19:50:30 2017 +0100
- Revision:
- 2:bbdeda018a3c
- Parent:
- 1:9ebc941037d5
Update to mbedtls 2.6.0, many changes.
Changes to mbedtls sources made:
in include/mbedtls/config.h comment out:
#define MBEDTLS_FS_IO
#define MBEDTLS_NET_C
#define MBEDTLS_TIMING_C
uncomment:
#define MBEDTLS_NO_PLATFORM_ENTROPY
remove the following directorys:
programs
yotta
visualc
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jasper Wallace |
1:9ebc941037d5 | 1 | #!/usr/bin/perl |
Jasper Wallace |
1:9ebc941037d5 | 2 | # |
Jasper Wallace |
1:9ebc941037d5 | 3 | |
Jasper Wallace |
1:9ebc941037d5 | 4 | use strict; |
Jasper Wallace |
1:9ebc941037d5 | 5 | |
Jasper Wallace |
1:9ebc941037d5 | 6 | my ($include_dir, $data_dir, $feature_file); |
Jasper Wallace |
1:9ebc941037d5 | 7 | |
Jasper Wallace |
1:9ebc941037d5 | 8 | if( @ARGV ) { |
Jasper Wallace |
1:9ebc941037d5 | 9 | die "Invalid number of arguments" if scalar @ARGV != 3; |
Jasper Wallace |
1:9ebc941037d5 | 10 | ($include_dir, $data_dir, $feature_file) = @ARGV; |
Jasper Wallace |
1:9ebc941037d5 | 11 | |
Jasper Wallace |
1:9ebc941037d5 | 12 | -d $include_dir or die "No such directory: $include_dir\n"; |
Jasper Wallace |
1:9ebc941037d5 | 13 | -d $data_dir or die "No such directory: $data_dir\n"; |
Jasper Wallace |
1:9ebc941037d5 | 14 | } else { |
Jasper Wallace |
1:9ebc941037d5 | 15 | $include_dir = 'include/mbedtls'; |
Jasper Wallace |
1:9ebc941037d5 | 16 | $data_dir = 'scripts/data_files'; |
Jasper Wallace |
1:9ebc941037d5 | 17 | $feature_file = 'library/version_features.c'; |
Jasper Wallace |
1:9ebc941037d5 | 18 | |
Jasper Wallace |
1:9ebc941037d5 | 19 | unless( -d $include_dir && -d $data_dir ) { |
Jasper Wallace |
1:9ebc941037d5 | 20 | chdir '..' or die; |
Jasper Wallace |
1:9ebc941037d5 | 21 | -d $include_dir && -d $data_dir |
Jasper Wallace |
1:9ebc941037d5 | 22 | or die "Without arguments, must be run from root or scripts\n" |
Jasper Wallace |
1:9ebc941037d5 | 23 | } |
Jasper Wallace |
1:9ebc941037d5 | 24 | } |
Jasper Wallace |
1:9ebc941037d5 | 25 | |
Jasper Wallace |
1:9ebc941037d5 | 26 | my $feature_format_file = $data_dir.'/version_features.fmt'; |
Jasper Wallace |
1:9ebc941037d5 | 27 | |
Jasper Wallace |
1:9ebc941037d5 | 28 | my @sections = ( "System support", "mbed TLS modules", |
Jasper Wallace |
1:9ebc941037d5 | 29 | "mbed TLS feature support" ); |
Jasper Wallace |
1:9ebc941037d5 | 30 | |
Jasper Wallace |
1:9ebc941037d5 | 31 | my $line_separator = $/; |
Jasper Wallace |
1:9ebc941037d5 | 32 | undef $/; |
Jasper Wallace |
1:9ebc941037d5 | 33 | |
Jasper Wallace |
1:9ebc941037d5 | 34 | open(FORMAT_FILE, "$feature_format_file") or die "Opening feature format file '$feature_format_file': $!"; |
Jasper Wallace |
1:9ebc941037d5 | 35 | my $feature_format = <FORMAT_FILE>; |
Jasper Wallace |
1:9ebc941037d5 | 36 | close(FORMAT_FILE); |
Jasper Wallace |
1:9ebc941037d5 | 37 | |
Jasper Wallace |
1:9ebc941037d5 | 38 | $/ = $line_separator; |
Jasper Wallace |
1:9ebc941037d5 | 39 | |
Jasper Wallace |
1:9ebc941037d5 | 40 | open(CONFIG_H, "$include_dir/config.h") || die("Failure when opening config.h: $!"); |
Jasper Wallace |
1:9ebc941037d5 | 41 | |
Jasper Wallace |
1:9ebc941037d5 | 42 | my $feature_defines = ""; |
Jasper Wallace |
1:9ebc941037d5 | 43 | my $in_section = 0; |
Jasper Wallace |
1:9ebc941037d5 | 44 | |
Jasper Wallace |
1:9ebc941037d5 | 45 | while (my $line = <CONFIG_H>) |
Jasper Wallace |
1:9ebc941037d5 | 46 | { |
Jasper Wallace |
1:9ebc941037d5 | 47 | next if ($in_section && $line !~ /#define/ && $line !~ /SECTION/); |
Jasper Wallace |
1:9ebc941037d5 | 48 | next if (!$in_section && $line !~ /SECTION/); |
Jasper Wallace |
1:9ebc941037d5 | 49 | |
Jasper Wallace |
1:9ebc941037d5 | 50 | if ($in_section) { |
Jasper Wallace |
1:9ebc941037d5 | 51 | if ($line =~ /SECTION/) { |
Jasper Wallace |
1:9ebc941037d5 | 52 | $in_section = 0; |
Jasper Wallace |
1:9ebc941037d5 | 53 | next; |
Jasper Wallace |
1:9ebc941037d5 | 54 | } |
Jasper Wallace |
1:9ebc941037d5 | 55 | |
Jasper Wallace |
1:9ebc941037d5 | 56 | my ($define) = $line =~ /#define (\w+)/; |
Jasper Wallace |
1:9ebc941037d5 | 57 | $feature_defines .= "#if defined(${define})\n"; |
Jasper Wallace |
1:9ebc941037d5 | 58 | $feature_defines .= " \"${define}\",\n"; |
Jasper Wallace |
1:9ebc941037d5 | 59 | $feature_defines .= "#endif /* ${define} */\n"; |
Jasper Wallace |
1:9ebc941037d5 | 60 | } |
Jasper Wallace |
1:9ebc941037d5 | 61 | |
Jasper Wallace |
1:9ebc941037d5 | 62 | if (!$in_section) { |
Jasper Wallace |
1:9ebc941037d5 | 63 | my ($section_name) = $line =~ /SECTION: ([\w ]+)/; |
Jasper Wallace |
1:9ebc941037d5 | 64 | my $found_section = grep $_ eq $section_name, @sections; |
Jasper Wallace |
1:9ebc941037d5 | 65 | |
Jasper Wallace |
1:9ebc941037d5 | 66 | $in_section = 1 if ($found_section); |
Jasper Wallace |
1:9ebc941037d5 | 67 | } |
Jasper Wallace |
1:9ebc941037d5 | 68 | }; |
Jasper Wallace |
1:9ebc941037d5 | 69 | |
Jasper Wallace |
1:9ebc941037d5 | 70 | $feature_format =~ s/FEATURE_DEFINES\n/$feature_defines/g; |
Jasper Wallace |
1:9ebc941037d5 | 71 | |
Jasper Wallace |
1:9ebc941037d5 | 72 | open(ERROR_FILE, ">$feature_file") or die "Opening destination file '$feature_file': $!"; |
Jasper Wallace |
1:9ebc941037d5 | 73 | print ERROR_FILE $feature_format; |
Jasper Wallace |
1:9ebc941037d5 | 74 | close(ERROR_FILE); |