Feature/mbedtls (#84)
* try to import mbedtls and build it * add stubs socket class * some boilterplate, read and write function implemented * more boilterplate / current error in handshake because no CA cert is setup * add something so skip ca verification, can ws curl https://google.com ! * cleanup / close implemented * tweak CMakefiles * typo in include * update readme * disable unittests
This commit is contained in:
committed by
GitHub
parent
ba4a9e1586
commit
06cbebe22e
405
third_party/mbedtls/scripts/abi_check.py
vendored
Executable file
405
third_party/mbedtls/scripts/abi_check.py
vendored
Executable file
@ -0,0 +1,405 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
|
||||
Copyright (c) 2018, Arm Limited, All Rights Reserved
|
||||
|
||||
Purpose
|
||||
|
||||
This script is a small wrapper around the abi-compliance-checker and
|
||||
abi-dumper tools, applying them to compare the ABI and API of the library
|
||||
files from two different Git revisions within an Mbed TLS repository.
|
||||
The results of the comparison are either formatted as HTML and stored at
|
||||
a configurable location, or are given as a brief list of problems.
|
||||
Returns 0 on success, 1 on ABI/API non-compliance, and 2 if there is an error
|
||||
while running the script. Note: must be run from Mbed TLS root.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import traceback
|
||||
import shutil
|
||||
import subprocess
|
||||
import argparse
|
||||
import logging
|
||||
import tempfile
|
||||
import fnmatch
|
||||
from types import SimpleNamespace
|
||||
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
|
||||
class AbiChecker(object):
|
||||
"""API and ABI checker."""
|
||||
|
||||
def __init__(self, old_version, new_version, configuration):
|
||||
"""Instantiate the API/ABI checker.
|
||||
|
||||
old_version: RepoVersion containing details to compare against
|
||||
new_version: RepoVersion containing details to check
|
||||
configuration.report_dir: directory for output files
|
||||
configuration.keep_all_reports: if false, delete old reports
|
||||
configuration.brief: if true, output shorter report to stdout
|
||||
configuration.skip_file: path to file containing symbols and types to skip
|
||||
"""
|
||||
self.repo_path = "."
|
||||
self.log = None
|
||||
self.verbose = configuration.verbose
|
||||
self._setup_logger()
|
||||
self.report_dir = os.path.abspath(configuration.report_dir)
|
||||
self.keep_all_reports = configuration.keep_all_reports
|
||||
self.can_remove_report_dir = not (os.path.exists(self.report_dir) or
|
||||
self.keep_all_reports)
|
||||
self.old_version = old_version
|
||||
self.new_version = new_version
|
||||
self.skip_file = configuration.skip_file
|
||||
self.brief = configuration.brief
|
||||
self.git_command = "git"
|
||||
self.make_command = "make"
|
||||
|
||||
@staticmethod
|
||||
def check_repo_path():
|
||||
current_dir = os.path.realpath('.')
|
||||
root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
||||
if current_dir != root_dir:
|
||||
raise Exception("Must be run from Mbed TLS root")
|
||||
|
||||
def _setup_logger(self):
|
||||
self.log = logging.getLogger()
|
||||
if self.verbose:
|
||||
self.log.setLevel(logging.DEBUG)
|
||||
else:
|
||||
self.log.setLevel(logging.INFO)
|
||||
self.log.addHandler(logging.StreamHandler())
|
||||
|
||||
@staticmethod
|
||||
def check_abi_tools_are_installed():
|
||||
for command in ["abi-dumper", "abi-compliance-checker"]:
|
||||
if not shutil.which(command):
|
||||
raise Exception("{} not installed, aborting".format(command))
|
||||
|
||||
def _get_clean_worktree_for_git_revision(self, version):
|
||||
"""Make a separate worktree with version.revision checked out.
|
||||
Do not modify the current worktree."""
|
||||
git_worktree_path = tempfile.mkdtemp()
|
||||
if version.repository:
|
||||
self.log.debug(
|
||||
"Checking out git worktree for revision {} from {}".format(
|
||||
version.revision, version.repository
|
||||
)
|
||||
)
|
||||
fetch_output = subprocess.check_output(
|
||||
[self.git_command, "fetch",
|
||||
version.repository, version.revision],
|
||||
cwd=self.repo_path,
|
||||
stderr=subprocess.STDOUT
|
||||
)
|
||||
self.log.debug(fetch_output.decode("utf-8"))
|
||||
worktree_rev = "FETCH_HEAD"
|
||||
else:
|
||||
self.log.debug("Checking out git worktree for revision {}".format(
|
||||
version.revision
|
||||
))
|
||||
worktree_rev = version.revision
|
||||
worktree_output = subprocess.check_output(
|
||||
[self.git_command, "worktree", "add", "--detach",
|
||||
git_worktree_path, worktree_rev],
|
||||
cwd=self.repo_path,
|
||||
stderr=subprocess.STDOUT
|
||||
)
|
||||
self.log.debug(worktree_output.decode("utf-8"))
|
||||
return git_worktree_path
|
||||
|
||||
def _update_git_submodules(self, git_worktree_path, version):
|
||||
"""If the crypto submodule is present, initialize it.
|
||||
if version.crypto_revision exists, update it to that revision,
|
||||
otherwise update it to the default revision"""
|
||||
update_output = subprocess.check_output(
|
||||
[self.git_command, "submodule", "update", "--init", '--recursive'],
|
||||
cwd=git_worktree_path,
|
||||
stderr=subprocess.STDOUT
|
||||
)
|
||||
self.log.debug(update_output.decode("utf-8"))
|
||||
if not (os.path.exists(os.path.join(git_worktree_path, "crypto"))
|
||||
and version.crypto_revision):
|
||||
return
|
||||
|
||||
if version.crypto_repository:
|
||||
fetch_output = subprocess.check_output(
|
||||
[self.git_command, "fetch", version.crypto_repository,
|
||||
version.crypto_revision],
|
||||
cwd=os.path.join(git_worktree_path, "crypto"),
|
||||
stderr=subprocess.STDOUT
|
||||
)
|
||||
self.log.debug(fetch_output.decode("utf-8"))
|
||||
crypto_rev = "FETCH_HEAD"
|
||||
else:
|
||||
crypto_rev = version.crypto_revision
|
||||
|
||||
checkout_output = subprocess.check_output(
|
||||
[self.git_command, "checkout", crypto_rev],
|
||||
cwd=os.path.join(git_worktree_path, "crypto"),
|
||||
stderr=subprocess.STDOUT
|
||||
)
|
||||
self.log.debug(checkout_output.decode("utf-8"))
|
||||
|
||||
def _build_shared_libraries(self, git_worktree_path, version):
|
||||
"""Build the shared libraries in the specified worktree."""
|
||||
my_environment = os.environ.copy()
|
||||
my_environment["CFLAGS"] = "-g -Og"
|
||||
my_environment["SHARED"] = "1"
|
||||
if os.path.exists(os.path.join(git_worktree_path, "crypto")):
|
||||
my_environment["USE_CRYPTO_SUBMODULE"] = "1"
|
||||
make_output = subprocess.check_output(
|
||||
[self.make_command, "lib"],
|
||||
env=my_environment,
|
||||
cwd=git_worktree_path,
|
||||
stderr=subprocess.STDOUT
|
||||
)
|
||||
self.log.debug(make_output.decode("utf-8"))
|
||||
for root, _dirs, files in os.walk(git_worktree_path):
|
||||
for file in fnmatch.filter(files, "*.so"):
|
||||
version.modules[os.path.splitext(file)[0]] = (
|
||||
os.path.join(root, file)
|
||||
)
|
||||
|
||||
def _get_abi_dumps_from_shared_libraries(self, version):
|
||||
"""Generate the ABI dumps for the specified git revision.
|
||||
The shared libraries must have been built and the module paths
|
||||
present in version.modules."""
|
||||
for mbed_module, module_path in version.modules.items():
|
||||
output_path = os.path.join(
|
||||
self.report_dir, "{}-{}-{}.dump".format(
|
||||
mbed_module, version.revision, version.version
|
||||
)
|
||||
)
|
||||
abi_dump_command = [
|
||||
"abi-dumper",
|
||||
module_path,
|
||||
"-o", output_path,
|
||||
"-lver", version.revision
|
||||
]
|
||||
abi_dump_output = subprocess.check_output(
|
||||
abi_dump_command,
|
||||
stderr=subprocess.STDOUT
|
||||
)
|
||||
self.log.debug(abi_dump_output.decode("utf-8"))
|
||||
version.abi_dumps[mbed_module] = output_path
|
||||
|
||||
def _cleanup_worktree(self, git_worktree_path):
|
||||
"""Remove the specified git worktree."""
|
||||
shutil.rmtree(git_worktree_path)
|
||||
worktree_output = subprocess.check_output(
|
||||
[self.git_command, "worktree", "prune"],
|
||||
cwd=self.repo_path,
|
||||
stderr=subprocess.STDOUT
|
||||
)
|
||||
self.log.debug(worktree_output.decode("utf-8"))
|
||||
|
||||
def _get_abi_dump_for_ref(self, version):
|
||||
"""Generate the ABI dumps for the specified git revision."""
|
||||
git_worktree_path = self._get_clean_worktree_for_git_revision(version)
|
||||
self._update_git_submodules(git_worktree_path, version)
|
||||
self._build_shared_libraries(git_worktree_path, version)
|
||||
self._get_abi_dumps_from_shared_libraries(version)
|
||||
self._cleanup_worktree(git_worktree_path)
|
||||
|
||||
def _remove_children_with_tag(self, parent, tag):
|
||||
children = parent.getchildren()
|
||||
for child in children:
|
||||
if child.tag == tag:
|
||||
parent.remove(child)
|
||||
else:
|
||||
self._remove_children_with_tag(child, tag)
|
||||
|
||||
def _remove_extra_detail_from_report(self, report_root):
|
||||
for tag in ['test_info', 'test_results', 'problem_summary',
|
||||
'added_symbols', 'removed_symbols', 'affected']:
|
||||
self._remove_children_with_tag(report_root, tag)
|
||||
|
||||
for report in report_root:
|
||||
for problems in report.getchildren()[:]:
|
||||
if not problems.getchildren():
|
||||
report.remove(problems)
|
||||
|
||||
def get_abi_compatibility_report(self):
|
||||
"""Generate a report of the differences between the reference ABI
|
||||
and the new ABI. ABI dumps from self.old_version and self.new_version
|
||||
must be available."""
|
||||
compatibility_report = ""
|
||||
compliance_return_code = 0
|
||||
shared_modules = list(set(self.old_version.modules.keys()) &
|
||||
set(self.new_version.modules.keys()))
|
||||
for mbed_module in shared_modules:
|
||||
output_path = os.path.join(
|
||||
self.report_dir, "{}-{}-{}.html".format(
|
||||
mbed_module, self.old_version.revision,
|
||||
self.new_version.revision
|
||||
)
|
||||
)
|
||||
abi_compliance_command = [
|
||||
"abi-compliance-checker",
|
||||
"-l", mbed_module,
|
||||
"-old", self.old_version.abi_dumps[mbed_module],
|
||||
"-new", self.new_version.abi_dumps[mbed_module],
|
||||
"-strict",
|
||||
"-report-path", output_path,
|
||||
]
|
||||
if self.skip_file:
|
||||
abi_compliance_command += ["-skip-symbols", self.skip_file,
|
||||
"-skip-types", self.skip_file]
|
||||
if self.brief:
|
||||
abi_compliance_command += ["-report-format", "xml",
|
||||
"-stdout"]
|
||||
try:
|
||||
subprocess.check_output(
|
||||
abi_compliance_command,
|
||||
stderr=subprocess.STDOUT
|
||||
)
|
||||
except subprocess.CalledProcessError as err:
|
||||
if err.returncode == 1:
|
||||
compliance_return_code = 1
|
||||
if self.brief:
|
||||
self.log.info(
|
||||
"Compatibility issues found for {}".format(mbed_module)
|
||||
)
|
||||
report_root = ET.fromstring(err.output.decode("utf-8"))
|
||||
self._remove_extra_detail_from_report(report_root)
|
||||
self.log.info(ET.tostring(report_root).decode("utf-8"))
|
||||
else:
|
||||
self.can_remove_report_dir = False
|
||||
compatibility_report += (
|
||||
"Compatibility issues found for {}, "
|
||||
"for details see {}\n".format(mbed_module, output_path)
|
||||
)
|
||||
else:
|
||||
raise err
|
||||
else:
|
||||
compatibility_report += (
|
||||
"No compatibility issues for {}\n".format(mbed_module)
|
||||
)
|
||||
if not (self.keep_all_reports or self.brief):
|
||||
os.remove(output_path)
|
||||
os.remove(self.old_version.abi_dumps[mbed_module])
|
||||
os.remove(self.new_version.abi_dumps[mbed_module])
|
||||
if self.can_remove_report_dir:
|
||||
os.rmdir(self.report_dir)
|
||||
self.log.info(compatibility_report)
|
||||
return compliance_return_code
|
||||
|
||||
def check_for_abi_changes(self):
|
||||
"""Generate a report of ABI differences
|
||||
between self.old_rev and self.new_rev."""
|
||||
self.check_repo_path()
|
||||
self.check_abi_tools_are_installed()
|
||||
self._get_abi_dump_for_ref(self.old_version)
|
||||
self._get_abi_dump_for_ref(self.new_version)
|
||||
return self.get_abi_compatibility_report()
|
||||
|
||||
|
||||
def run_main():
|
||||
try:
|
||||
parser = argparse.ArgumentParser(
|
||||
description=(
|
||||
"""This script is a small wrapper around the
|
||||
abi-compliance-checker and abi-dumper tools, applying them
|
||||
to compare the ABI and API of the library files from two
|
||||
different Git revisions within an Mbed TLS repository.
|
||||
The results of the comparison are either formatted as HTML and
|
||||
stored at a configurable location, or are given as a brief list
|
||||
of problems. Returns 0 on success, 1 on ABI/API non-compliance,
|
||||
and 2 if there is an error while running the script.
|
||||
Note: must be run from Mbed TLS root."""
|
||||
)
|
||||
)
|
||||
parser.add_argument(
|
||||
"-v", "--verbose", action="store_true",
|
||||
help="set verbosity level",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-r", "--report-dir", type=str, default="reports",
|
||||
help="directory where reports are stored, default is reports",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-k", "--keep-all-reports", action="store_true",
|
||||
help="keep all reports, even if there are no compatibility issues",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-o", "--old-rev", type=str, help="revision for old version.",
|
||||
required=True,
|
||||
)
|
||||
parser.add_argument(
|
||||
"-or", "--old-repo", type=str, help="repository for old version."
|
||||
)
|
||||
parser.add_argument(
|
||||
"-oc", "--old-crypto-rev", type=str,
|
||||
help="revision for old crypto submodule."
|
||||
)
|
||||
parser.add_argument(
|
||||
"-ocr", "--old-crypto-repo", type=str,
|
||||
help="repository for old crypto submodule."
|
||||
)
|
||||
parser.add_argument(
|
||||
"-n", "--new-rev", type=str, help="revision for new version",
|
||||
required=True,
|
||||
)
|
||||
parser.add_argument(
|
||||
"-nr", "--new-repo", type=str, help="repository for new version."
|
||||
)
|
||||
parser.add_argument(
|
||||
"-nc", "--new-crypto-rev", type=str,
|
||||
help="revision for new crypto version"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-ncr", "--new-crypto-repo", type=str,
|
||||
help="repository for new crypto submodule."
|
||||
)
|
||||
parser.add_argument(
|
||||
"-s", "--skip-file", type=str,
|
||||
help="path to file containing symbols and types to skip"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-b", "--brief", action="store_true",
|
||||
help="output only the list of issues to stdout, instead of a full report",
|
||||
)
|
||||
abi_args = parser.parse_args()
|
||||
if os.path.isfile(abi_args.report_dir):
|
||||
print("Error: {} is not a directory".format(abi_args.report_dir))
|
||||
parser.exit()
|
||||
old_version = SimpleNamespace(
|
||||
version="old",
|
||||
repository=abi_args.old_repo,
|
||||
revision=abi_args.old_rev,
|
||||
crypto_repository=abi_args.old_crypto_repo,
|
||||
crypto_revision=abi_args.old_crypto_rev,
|
||||
abi_dumps={},
|
||||
modules={}
|
||||
)
|
||||
new_version = SimpleNamespace(
|
||||
version="new",
|
||||
repository=abi_args.new_repo,
|
||||
revision=abi_args.new_rev,
|
||||
crypto_repository=abi_args.new_crypto_repo,
|
||||
crypto_revision=abi_args.new_crypto_rev,
|
||||
abi_dumps={},
|
||||
modules={}
|
||||
)
|
||||
configuration = SimpleNamespace(
|
||||
verbose=abi_args.verbose,
|
||||
report_dir=abi_args.report_dir,
|
||||
keep_all_reports=abi_args.keep_all_reports,
|
||||
brief=abi_args.brief,
|
||||
skip_file=abi_args.skip_file
|
||||
)
|
||||
abi_check = AbiChecker(old_version, new_version, configuration)
|
||||
return_code = abi_check.check_for_abi_changes()
|
||||
sys.exit(return_code)
|
||||
except Exception: # pylint: disable=broad-except
|
||||
# Print the backtrace and exit explicitly so as to exit with
|
||||
# status 2, not 1.
|
||||
traceback.print_exc()
|
||||
sys.exit(2)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_main()
|
25
third_party/mbedtls/scripts/apidoc_full.sh
vendored
Executable file
25
third_party/mbedtls/scripts/apidoc_full.sh
vendored
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Generate doxygen documentation with a full config.h (this ensures that every
|
||||
# available flag is documented, and avoids warnings about documentation
|
||||
# without a corresponding #define).
|
||||
#
|
||||
# /!\ This must not be a Makefile target, as it would create a race condition
|
||||
# when multiple targets are invoked in the same parallel build.
|
||||
|
||||
set -eu
|
||||
|
||||
CONFIG_H='include/mbedtls/config.h'
|
||||
|
||||
if [ -r $CONFIG_H ]; then :; else
|
||||
echo "$CONFIG_H not found" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CONFIG_BAK=${CONFIG_H}.bak
|
||||
cp -p $CONFIG_H $CONFIG_BAK
|
||||
|
||||
scripts/config.pl realfull
|
||||
make apidoc
|
||||
|
||||
mv $CONFIG_BAK $CONFIG_H
|
143
third_party/mbedtls/scripts/bump_version.sh
vendored
Executable file
143
third_party/mbedtls/scripts/bump_version.sh
vendored
Executable file
@ -0,0 +1,143 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This file is part of mbed TLS (https://tls.mbed.org)
|
||||
#
|
||||
# Copyright (c) 2012-2016, ARM Limited, All Rights Reserved
|
||||
#
|
||||
# Purpose
|
||||
#
|
||||
# Sets the version numbers in the source code to those given.
|
||||
#
|
||||
# Usage: bump_version.sh [ --version <version> ] [ --so-crypto <version>]
|
||||
# [ --so-x509 <version> ] [ --so-tls <version> ]
|
||||
# [ -v | --verbose ] [ -h | --help ]
|
||||
#
|
||||
|
||||
VERSION=""
|
||||
SOVERSION=""
|
||||
|
||||
# Parse arguments
|
||||
#
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
case "$1" in
|
||||
--version)
|
||||
# Version to use
|
||||
shift
|
||||
VERSION=$1
|
||||
;;
|
||||
--so-crypto)
|
||||
shift
|
||||
SO_CRYPTO=$1
|
||||
;;
|
||||
--so-x509)
|
||||
shift
|
||||
SO_X509=$1
|
||||
;;
|
||||
--so-tls)
|
||||
shift
|
||||
SO_TLS=$1
|
||||
;;
|
||||
-v|--verbose)
|
||||
# Be verbose
|
||||
VERBOSE="1"
|
||||
;;
|
||||
-h|--help)
|
||||
# print help
|
||||
echo "Usage: $0"
|
||||
echo -e " -h|--help\t\tPrint this help."
|
||||
echo -e " --version <version>\tVersion to bump to."
|
||||
echo -e " --so-crypto <version>\tSO version to bump libmbedcrypto to."
|
||||
echo -e " --so-x509 <version>\tSO version to bump libmbedx509 to."
|
||||
echo -e " --so-tls <version>\tSO version to bump libmbedtls to."
|
||||
echo -e " -v|--verbose\t\tVerbose."
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
# print error
|
||||
echo "Unknown argument: '$1'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ "X" = "X$VERSION" ];
|
||||
then
|
||||
echo "No version specified. Unable to continue."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[ $VERBOSE ] && echo "Bumping VERSION in library/CMakeLists.txt"
|
||||
sed -e "s/ VERSION [0-9.]\{1,\}/ VERSION $VERSION/g" < library/CMakeLists.txt > tmp
|
||||
mv tmp library/CMakeLists.txt
|
||||
|
||||
if [ "X" != "X$SO_CRYPTO" ];
|
||||
then
|
||||
[ $VERBOSE ] && echo "Bumping SOVERSION for libmbedcrypto in library/CMakeLists.txt"
|
||||
sed -e "/mbedcrypto/ s/ SOVERSION [0-9]\{1,\}/ SOVERSION $SO_CRYPTO/g" < library/CMakeLists.txt > tmp
|
||||
mv tmp library/CMakeLists.txt
|
||||
|
||||
[ $VERBOSE ] && echo "Bumping SOVERSION for libmbedcrypto in library/Makefile"
|
||||
sed -e "s/SOEXT_CRYPTO=so.[0-9]\{1,\}/SOEXT_CRYPTO=so.$SO_CRYPTO/g" < library/Makefile > tmp
|
||||
mv tmp library/Makefile
|
||||
fi
|
||||
|
||||
if [ "X" != "X$SO_X509" ];
|
||||
then
|
||||
[ $VERBOSE ] && echo "Bumping SOVERSION for libmbedx509 in library/CMakeLists.txt"
|
||||
sed -e "/mbedx509/ s/ SOVERSION [0-9]\{1,\}/ SOVERSION $SO_X509/g" < library/CMakeLists.txt > tmp
|
||||
mv tmp library/CMakeLists.txt
|
||||
|
||||
[ $VERBOSE ] && echo "Bumping SOVERSION for libmbedx509 in library/Makefile"
|
||||
sed -e "s/SOEXT_X509=so.[0-9]\{1,\}/SOEXT_X509=so.$SO_X509/g" < library/Makefile > tmp
|
||||
mv tmp library/Makefile
|
||||
fi
|
||||
|
||||
if [ "X" != "X$SO_TLS" ];
|
||||
then
|
||||
[ $VERBOSE ] && echo "Bumping SOVERSION for libmbedtls in library/CMakeLists.txt"
|
||||
sed -e "/mbedtls/ s/ SOVERSION [0-9]\{1,\}/ SOVERSION $SO_TLS/g" < library/CMakeLists.txt > tmp
|
||||
mv tmp library/CMakeLists.txt
|
||||
|
||||
[ $VERBOSE ] && echo "Bumping SOVERSION for libmbedtls in library/Makefile"
|
||||
sed -e "s/SOEXT_TLS=so.[0-9]\{1,\}/SOEXT_TLS=so.$SO_TLS/g" < library/Makefile > tmp
|
||||
mv tmp library/Makefile
|
||||
fi
|
||||
|
||||
[ $VERBOSE ] && echo "Bumping VERSION in include/mbedtls/version.h"
|
||||
read MAJOR MINOR PATCH <<<$(IFS="."; echo $VERSION)
|
||||
VERSION_NR="$( printf "0x%02X%02X%02X00" $MAJOR $MINOR $PATCH )"
|
||||
cat include/mbedtls/version.h | \
|
||||
sed -e "s/_VERSION_MAJOR .\{1,\}/_VERSION_MAJOR $MAJOR/" | \
|
||||
sed -e "s/_VERSION_MINOR .\{1,\}/_VERSION_MINOR $MINOR/" | \
|
||||
sed -e "s/_VERSION_PATCH .\{1,\}/_VERSION_PATCH $PATCH/" | \
|
||||
sed -e "s/_VERSION_NUMBER .\{1,\}/_VERSION_NUMBER $VERSION_NR/" | \
|
||||
sed -e "s/_VERSION_STRING .\{1,\}/_VERSION_STRING \"$VERSION\"/" | \
|
||||
sed -e "s/_VERSION_STRING_FULL .\{1,\}/_VERSION_STRING_FULL \"mbed TLS $VERSION\"/" \
|
||||
> tmp
|
||||
mv tmp include/mbedtls/version.h
|
||||
|
||||
[ $VERBOSE ] && echo "Bumping version in tests/suites/test_suite_version.data"
|
||||
sed -e "s/version:\".\{1,\}/version:\"$VERSION\"/g" < tests/suites/test_suite_version.data > tmp
|
||||
mv tmp tests/suites/test_suite_version.data
|
||||
|
||||
[ $VERBOSE ] && echo "Bumping PROJECT_NAME in doxygen/mbedtls.doxyfile and doxygen/input/doc_mainpage.h"
|
||||
for i in doxygen/mbedtls.doxyfile doxygen/input/doc_mainpage.h;
|
||||
do
|
||||
sed -e "s/mbed TLS v[0-9\.]\{1,\}/mbed TLS v$VERSION/g" < $i > tmp
|
||||
mv tmp $i
|
||||
done
|
||||
|
||||
[ $VERBOSE ] && echo "Re-generating library/error.c"
|
||||
scripts/generate_errors.pl
|
||||
|
||||
[ $VERBOSE ] && echo "Re-generating programs/ssl/query_config.c"
|
||||
scripts/generate_query_config.pl
|
||||
|
||||
[ $VERBOSE ] && echo "Re-generating library/version_features.c"
|
||||
scripts/generate_features.pl
|
||||
|
||||
[ $VERBOSE ] && echo "Re-generating visualc files"
|
||||
scripts/generate_visualc_files.pl
|
||||
|
307
third_party/mbedtls/scripts/config.pl
vendored
Executable file
307
third_party/mbedtls/scripts/config.pl
vendored
Executable file
@ -0,0 +1,307 @@
|
||||
#!/usr/bin/env perl
|
||||
#
|
||||
# This file is part of mbed TLS (https://tls.mbed.org)
|
||||
#
|
||||
# Copyright (c) 2014-2016, ARM Limited, All Rights Reserved
|
||||
#
|
||||
# Purpose
|
||||
#
|
||||
# Comments and uncomments #define lines in the given header file and optionally
|
||||
# sets their value or can get the value. This is to provide scripting control of
|
||||
# what preprocessor symbols, and therefore what build time configuration flags
|
||||
# are set in the 'config.h' file.
|
||||
#
|
||||
# Usage: config.pl [-f <file> | --file <file>] [-o | --force]
|
||||
# [set <symbol> <value> | unset <symbol> | get <symbol> |
|
||||
# full | realfull]
|
||||
#
|
||||
# Full usage description provided below.
|
||||
#
|
||||
# The following options are disabled instead of enabled with "full".
|
||||
#
|
||||
# MBEDTLS_TEST_NULL_ENTROPY
|
||||
# MBEDTLS_DEPRECATED_REMOVED
|
||||
# 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_REMOVE_3DES_CIPHERSUITES
|
||||
# MBEDTLS_SSL_HW_RECORD_ACCEL
|
||||
# MBEDTLS_RSA_NO_CRT
|
||||
# MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3
|
||||
# MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
|
||||
# - this could be enabled if the respective tests were adapted
|
||||
# MBEDTLS_ZLIB_SUPPORT
|
||||
# MBEDTLS_PKCS11_C
|
||||
# MBEDTLS_PSA_CRYPTO_SPM
|
||||
# MBEDTLS_PSA_INJECT_ENTROPY
|
||||
# MBEDTLS_ECP_RESTARTABLE
|
||||
# and any symbol beginning _ALT
|
||||
#
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
my $config_file = "include/mbedtls/config.h";
|
||||
my $usage = <<EOU;
|
||||
$0 [-f <file> | --file <file>] [-o | --force]
|
||||
[set <symbol> <value> | unset <symbol> | get <symbol> |
|
||||
full | realfull | baremetal]
|
||||
|
||||
Commands
|
||||
set <symbol> [<value>] - Uncomments or adds a #define for the <symbol> to
|
||||
the configuration file, and optionally making it
|
||||
of <value>.
|
||||
If the symbol isn't present in the file an error
|
||||
is returned.
|
||||
unset <symbol> - Comments out the #define for the given symbol if
|
||||
present in the configuration file.
|
||||
get <symbol> - Finds the #define for the given symbol, returning
|
||||
an exitcode of 0 if the symbol is found, and 1 if
|
||||
not. The value of the symbol is output if one is
|
||||
specified in the configuration file.
|
||||
full - Uncomments all #define's in the configuration file
|
||||
excluding some reserved symbols, until the
|
||||
'Module configuration options' section
|
||||
realfull - Uncomments all #define's with no exclusions
|
||||
baremetal - Sets full configuration suitable for baremetal build.
|
||||
|
||||
Options
|
||||
-f | --file <filename> - The file or file path for the configuration file
|
||||
to edit. When omitted, the following default is
|
||||
used:
|
||||
$config_file
|
||||
-o | --force - If the symbol isn't present in the configuration
|
||||
file when setting its value, a #define is
|
||||
appended to the end of the file.
|
||||
|
||||
EOU
|
||||
|
||||
my @excluded = qw(
|
||||
MBEDTLS_TEST_NULL_ENTROPY
|
||||
MBEDTLS_DEPRECATED_REMOVED
|
||||
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_RSA_NO_CRT
|
||||
MBEDTLS_REMOVE_ARC4_CIPHERSUITES
|
||||
MBEDTLS_REMOVE_3DES_CIPHERSUITES
|
||||
MBEDTLS_SSL_HW_RECORD_ACCEL
|
||||
MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3
|
||||
MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
|
||||
MBEDTLS_ZLIB_SUPPORT
|
||||
MBEDTLS_PKCS11_C
|
||||
MBEDTLS_NO_UDBL_DIVISION
|
||||
MBEDTLS_NO_64BIT_MULTIPLICATION
|
||||
MBEDTLS_PSA_CRYPTO_SPM
|
||||
MBEDTLS_PSA_INJECT_ENTROPY
|
||||
MBEDTLS_ECP_RESTARTABLE
|
||||
_ALT\s*$
|
||||
);
|
||||
|
||||
# Things that should be disabled in "baremetal"
|
||||
my @excluded_baremetal = qw(
|
||||
MBEDTLS_NET_C
|
||||
MBEDTLS_TIMING_C
|
||||
MBEDTLS_FS_IO
|
||||
MBEDTLS_ENTROPY_NV_SEED
|
||||
MBEDTLS_HAVE_TIME
|
||||
MBEDTLS_HAVE_TIME_DATE
|
||||
MBEDTLS_DEPRECATED_WARNING
|
||||
MBEDTLS_HAVEGE_C
|
||||
MBEDTLS_THREADING_C
|
||||
MBEDTLS_THREADING_PTHREAD
|
||||
MBEDTLS_MEMORY_BACKTRACE
|
||||
MBEDTLS_MEMORY_BUFFER_ALLOC_C
|
||||
MBEDTLS_PLATFORM_TIME_ALT
|
||||
MBEDTLS_PLATFORM_FPRINTF_ALT
|
||||
MBEDTLS_PSA_ITS_FILE_C
|
||||
MBEDTLS_PSA_CRYPTO_STORAGE_C
|
||||
);
|
||||
|
||||
# Things that should be enabled in "full" even if they match @excluded
|
||||
my @non_excluded = qw(
|
||||
PLATFORM_[A-Z0-9]+_ALT
|
||||
);
|
||||
|
||||
# Things that should be enabled in "baremetal"
|
||||
my @non_excluded_baremetal = qw(
|
||||
MBEDTLS_NO_PLATFORM_ENTROPY
|
||||
);
|
||||
|
||||
# Process the command line arguments
|
||||
|
||||
my $force_option = 0;
|
||||
|
||||
my ($arg, $name, $value, $action);
|
||||
|
||||
while ($arg = shift) {
|
||||
|
||||
# Check if the argument is an option
|
||||
if ($arg eq "-f" || $arg eq "--file") {
|
||||
$config_file = shift;
|
||||
|
||||
-f $config_file or die "No such file: $config_file\n";
|
||||
|
||||
}
|
||||
elsif ($arg eq "-o" || $arg eq "--force") {
|
||||
$force_option = 1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
# ...else assume it's a command
|
||||
$action = $arg;
|
||||
|
||||
if ($action eq "full" || $action eq "realfull" || $action eq "baremetal" ) {
|
||||
# No additional parameters
|
||||
die $usage if @ARGV;
|
||||
|
||||
}
|
||||
elsif ($action eq "unset" || $action eq "get") {
|
||||
die $usage unless @ARGV;
|
||||
$name = shift;
|
||||
|
||||
}
|
||||
elsif ($action eq "set") {
|
||||
die $usage unless @ARGV;
|
||||
$name = shift;
|
||||
$value = shift if @ARGV;
|
||||
|
||||
}
|
||||
else {
|
||||
die "Command '$action' not recognised.\n\n".$usage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# If no command was specified, exit...
|
||||
if ( not defined($action) ){ die $usage; }
|
||||
|
||||
# Check the config file is present
|
||||
if (! -f $config_file) {
|
||||
|
||||
chdir '..' or die;
|
||||
|
||||
# Confirm this is the project root directory and try again
|
||||
if ( !(-d 'scripts' && -d 'include' && -d 'library' && -f $config_file) ) {
|
||||
die "If no file specified, must be run from the project root or scripts directory.\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Now read the file and process the contents
|
||||
|
||||
open my $config_read, '<', $config_file or die "read $config_file: $!\n";
|
||||
my @config_lines = <$config_read>;
|
||||
close $config_read;
|
||||
|
||||
# Add required baremetal symbols to the list that is included.
|
||||
if ( $action eq "baremetal" ) {
|
||||
@non_excluded = ( @non_excluded, @non_excluded_baremetal );
|
||||
}
|
||||
|
||||
my ($exclude_re, $no_exclude_re, $exclude_baremetal_re);
|
||||
if ($action eq "realfull") {
|
||||
$exclude_re = qr/^$/;
|
||||
$no_exclude_re = qr/./;
|
||||
} else {
|
||||
$exclude_re = join '|', @excluded;
|
||||
$no_exclude_re = join '|', @non_excluded;
|
||||
}
|
||||
if ( $action eq "baremetal" ) {
|
||||
$exclude_baremetal_re = join '|', @excluded_baremetal;
|
||||
}
|
||||
|
||||
my $config_write = undef;
|
||||
if ($action ne "get") {
|
||||
open $config_write, '>', $config_file or die "write $config_file: $!\n";
|
||||
}
|
||||
|
||||
my $done;
|
||||
for my $line (@config_lines) {
|
||||
if ($action eq "full" || $action eq "realfull" || $action eq "baremetal" ) {
|
||||
if ($line =~ /name SECTION: Module configuration options/) {
|
||||
$done = 1;
|
||||
}
|
||||
|
||||
if (!$done && $line =~ m!^//\s?#define! &&
|
||||
( $line !~ /$exclude_re/ || $line =~ /$no_exclude_re/ ) &&
|
||||
( $action ne "baremetal" || ( $line !~ /$exclude_baremetal_re/ ) ) ) {
|
||||
$line =~ s!^//\s?!!;
|
||||
}
|
||||
if (!$done && $line =~ m!^\s?#define! &&
|
||||
! ( ( $line !~ /$exclude_re/ || $line =~ /$no_exclude_re/ ) &&
|
||||
( $action ne "baremetal" || ( $line !~ /$exclude_baremetal_re/ ) ) ) ) {
|
||||
$line =~ s!^!//!;
|
||||
}
|
||||
} elsif ($action eq "unset") {
|
||||
if (!$done && $line =~ /^\s*#define\s*$name\b/) {
|
||||
$line = '//' . $line;
|
||||
$done = 1;
|
||||
}
|
||||
} elsif (!$done && $action eq "set") {
|
||||
if ($line =~ m!^(?://)?\s*#define\s*$name\b!) {
|
||||
$line = "#define $name";
|
||||
$line .= " $value" if defined $value && $value ne "";
|
||||
$line .= "\n";
|
||||
$done = 1;
|
||||
}
|
||||
} elsif (!$done && $action eq "get") {
|
||||
if ($line =~ /^\s*#define\s*$name(?:\s+(.*?))\s*(?:$|\/\*|\/\/)/) {
|
||||
$value = $1;
|
||||
$done = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (defined $config_write) {
|
||||
print $config_write $line or die "write $config_file: $!\n";
|
||||
}
|
||||
}
|
||||
|
||||
# Did the set command work?
|
||||
if ($action eq "set" && $force_option && !$done) {
|
||||
|
||||
# If the force option was set, append the symbol to the end of the file
|
||||
my $line = "#define $name";
|
||||
$line .= " $value" if defined $value && $value ne "";
|
||||
$line .= "\n";
|
||||
$done = 1;
|
||||
|
||||
print $config_write $line or die "write $config_file: $!\n";
|
||||
}
|
||||
|
||||
if (defined $config_write) {
|
||||
close $config_write or die "close $config_file: $!\n";
|
||||
}
|
||||
|
||||
if ($action eq "get") {
|
||||
if ($done) {
|
||||
if ($value ne '') {
|
||||
print "$value\n";
|
||||
}
|
||||
exit 0;
|
||||
} else {
|
||||
# If the symbol was not found, return an error
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($action eq "full" && !$done) {
|
||||
die "Configuration section was not found in $config_file\n";
|
||||
|
||||
}
|
||||
|
||||
if ($action ne "full" && $action ne "unset" && !$done) {
|
||||
die "A #define for the symbol $name was not found in $config_file\n";
|
||||
}
|
||||
|
||||
__END__
|
123
third_party/mbedtls/scripts/data_files/error.fmt
vendored
Normal file
123
third_party/mbedtls/scripts/data_files/error.fmt
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Error message information
|
||||
*
|
||||
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is part of mbed TLS (https://tls.mbed.org)
|
||||
*/
|
||||
|
||||
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||
#include "mbedtls/config.h"
|
||||
#else
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ERROR_C) || defined(MBEDTLS_ERROR_STRERROR_DUMMY)
|
||||
#include "mbedtls/error.h"
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_PLATFORM_C)
|
||||
#include "mbedtls/platform.h"
|
||||
#else
|
||||
#define mbedtls_snprintf snprintf
|
||||
#define mbedtls_time_t time_t
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ERROR_C)
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
HEADER_INCLUDED
|
||||
|
||||
void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
{
|
||||
size_t len;
|
||||
int use_ret;
|
||||
|
||||
if( buflen == 0 )
|
||||
return;
|
||||
|
||||
memset( buf, 0x00, buflen );
|
||||
|
||||
if( ret < 0 )
|
||||
ret = -ret;
|
||||
|
||||
if( ret & 0xFF80 )
|
||||
{
|
||||
use_ret = ret & 0xFF80;
|
||||
|
||||
// High level error codes
|
||||
//
|
||||
// BEGIN generated code
|
||||
HIGH_LEVEL_CODE_CHECKS
|
||||
// END generated code
|
||||
|
||||
if( strlen( buf ) == 0 )
|
||||
mbedtls_snprintf( buf, buflen, "UNKNOWN ERROR CODE (%04X)", use_ret );
|
||||
}
|
||||
|
||||
use_ret = ret & ~0xFF80;
|
||||
|
||||
if( use_ret == 0 )
|
||||
return;
|
||||
|
||||
// If high level code is present, make a concatenation between both
|
||||
// error strings.
|
||||
//
|
||||
len = strlen( buf );
|
||||
|
||||
if( len > 0 )
|
||||
{
|
||||
if( buflen - len < 5 )
|
||||
return;
|
||||
|
||||
mbedtls_snprintf( buf + len, buflen - len, " : " );
|
||||
|
||||
buf += len + 3;
|
||||
buflen -= len + 3;
|
||||
}
|
||||
|
||||
// Low level error codes
|
||||
//
|
||||
// BEGIN generated code
|
||||
LOW_LEVEL_CODE_CHECKS
|
||||
// END generated code
|
||||
|
||||
if( strlen( buf ) != 0 )
|
||||
return;
|
||||
|
||||
mbedtls_snprintf( buf, buflen, "UNKNOWN ERROR CODE (%04X)", use_ret );
|
||||
}
|
||||
|
||||
#else /* MBEDTLS_ERROR_C */
|
||||
|
||||
#if defined(MBEDTLS_ERROR_STRERROR_DUMMY)
|
||||
|
||||
/*
|
||||
* Provide an non-function in case MBEDTLS_ERROR_C is not defined
|
||||
*/
|
||||
void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
{
|
||||
((void) ret);
|
||||
|
||||
if( buflen > 0 )
|
||||
buf[0] = '\0';
|
||||
}
|
||||
|
||||
#endif /* MBEDTLS_ERROR_STRERROR_DUMMY */
|
||||
|
||||
#endif /* MBEDTLS_ERROR_C */
|
139
third_party/mbedtls/scripts/data_files/query_config.fmt
vendored
Normal file
139
third_party/mbedtls/scripts/data_files/query_config.fmt
vendored
Normal file
@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Query Mbed TLS compile time configurations from config.h
|
||||
*
|
||||
* Copyright (C) 2018, Arm Limited, All Rights Reserved
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
*/
|
||||
|
||||
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||
#include "mbedtls/config.h"
|
||||
#else
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_PLATFORM_C)
|
||||
#include "mbedtls/platform.h"
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#define mbedtls_printf printf
|
||||
#endif /* MBEDTLS_PLATFORM_C */
|
||||
|
||||
/*
|
||||
* Include all the headers with public APIs in case they define a macro to its
|
||||
* default value when that configuration is not set in the config.h.
|
||||
*/
|
||||
#include "mbedtls/aes.h"
|
||||
#include "mbedtls/aesni.h"
|
||||
#include "mbedtls/arc4.h"
|
||||
#include "mbedtls/aria.h"
|
||||
#include "mbedtls/asn1.h"
|
||||
#include "mbedtls/asn1write.h"
|
||||
#include "mbedtls/base64.h"
|
||||
#include "mbedtls/bignum.h"
|
||||
#include "mbedtls/blowfish.h"
|
||||
#include "mbedtls/camellia.h"
|
||||
#include "mbedtls/ccm.h"
|
||||
#include "mbedtls/certs.h"
|
||||
#include "mbedtls/chacha20.h"
|
||||
#include "mbedtls/chachapoly.h"
|
||||
#include "mbedtls/cipher.h"
|
||||
#include "mbedtls/cmac.h"
|
||||
#include "mbedtls/ctr_drbg.h"
|
||||
#include "mbedtls/debug.h"
|
||||
#include "mbedtls/des.h"
|
||||
#include "mbedtls/dhm.h"
|
||||
#include "mbedtls/ecdh.h"
|
||||
#include "mbedtls/ecdsa.h"
|
||||
#include "mbedtls/ecjpake.h"
|
||||
#include "mbedtls/ecp.h"
|
||||
#include "mbedtls/entropy.h"
|
||||
#include "mbedtls/entropy_poll.h"
|
||||
#include "mbedtls/error.h"
|
||||
#include "mbedtls/gcm.h"
|
||||
#include "mbedtls/havege.h"
|
||||
#include "mbedtls/hkdf.h"
|
||||
#include "mbedtls/hmac_drbg.h"
|
||||
#include "mbedtls/md.h"
|
||||
#include "mbedtls/md2.h"
|
||||
#include "mbedtls/md4.h"
|
||||
#include "mbedtls/md5.h"
|
||||
#include "mbedtls/memory_buffer_alloc.h"
|
||||
#include "mbedtls/net_sockets.h"
|
||||
#include "mbedtls/nist_kw.h"
|
||||
#include "mbedtls/oid.h"
|
||||
#include "mbedtls/padlock.h"
|
||||
#include "mbedtls/pem.h"
|
||||
#include "mbedtls/pk.h"
|
||||
#include "mbedtls/pkcs11.h"
|
||||
#include "mbedtls/pkcs12.h"
|
||||
#include "mbedtls/pkcs5.h"
|
||||
#include "mbedtls/platform_time.h"
|
||||
#include "mbedtls/platform_util.h"
|
||||
#include "mbedtls/poly1305.h"
|
||||
#include "mbedtls/ripemd160.h"
|
||||
#include "mbedtls/rsa.h"
|
||||
#include "mbedtls/sha1.h"
|
||||
#include "mbedtls/sha256.h"
|
||||
#include "mbedtls/sha512.h"
|
||||
#include "mbedtls/ssl.h"
|
||||
#include "mbedtls/ssl_cache.h"
|
||||
#include "mbedtls/ssl_ciphersuites.h"
|
||||
#include "mbedtls/ssl_cookie.h"
|
||||
#include "mbedtls/ssl_internal.h"
|
||||
#include "mbedtls/ssl_ticket.h"
|
||||
#include "mbedtls/threading.h"
|
||||
#include "mbedtls/timing.h"
|
||||
#include "mbedtls/version.h"
|
||||
#include "mbedtls/x509.h"
|
||||
#include "mbedtls/x509_crl.h"
|
||||
#include "mbedtls/x509_crt.h"
|
||||
#include "mbedtls/x509_csr.h"
|
||||
#include "mbedtls/xtea.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* Helper macros to convert a macro or its expansion into a string
|
||||
* WARNING: This does not work for expanding function-like macros. However,
|
||||
* Mbed TLS does not currently have configuration options used in this fashion.
|
||||
*/
|
||||
#define MACRO_EXPANSION_TO_STR(macro) MACRO_NAME_TO_STR(macro)
|
||||
#define MACRO_NAME_TO_STR(macro) \
|
||||
mbedtls_printf( "%s", strlen( #macro "" ) > 0 ? #macro "\n" : "" )
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
/*
|
||||
* Visual Studio throws the warning 4003 because many Mbed TLS feature macros
|
||||
* are defined empty. This means that from the preprocessor's point of view
|
||||
* the macro MBEDTLS_EXPANSION_TO_STR is being invoked without arguments as
|
||||
* some macros expand to nothing. We suppress that specific warning to get a
|
||||
* clean build and to ensure that tests treating warnings as errors do not
|
||||
* fail.
|
||||
*/
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4003)
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
int query_config( const char *config )
|
||||
{
|
||||
CHECK_CONFIG /* If the symbol is not found, return an error */
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#endif /* _MSC_VER */
|
2174
third_party/mbedtls/scripts/data_files/rename-1.3-2.0.txt
vendored
Normal file
2174
third_party/mbedtls/scripts/data_files/rename-1.3-2.0.txt
vendored
Normal file
File diff suppressed because it is too large
Load Diff
60
third_party/mbedtls/scripts/data_files/version_features.fmt
vendored
Normal file
60
third_party/mbedtls/scripts/data_files/version_features.fmt
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Version feature information
|
||||
*
|
||||
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is part of mbed TLS (https://tls.mbed.org)
|
||||
*/
|
||||
|
||||
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||
#include "mbedtls/config.h"
|
||||
#else
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_VERSION_C)
|
||||
|
||||
#include "mbedtls/version.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static const char *features[] = {
|
||||
#if defined(MBEDTLS_VERSION_FEATURES)
|
||||
FEATURE_DEFINES
|
||||
#endif /* MBEDTLS_VERSION_FEATURES */
|
||||
NULL
|
||||
};
|
||||
|
||||
int mbedtls_version_check_feature( const char *feature )
|
||||
{
|
||||
const char **idx = features;
|
||||
|
||||
if( *idx == NULL )
|
||||
return( -2 );
|
||||
|
||||
if( feature == NULL )
|
||||
return( -1 );
|
||||
|
||||
while( *idx != NULL )
|
||||
{
|
||||
if( !strcmp( *idx, feature ) )
|
||||
return( 0 );
|
||||
idx++;
|
||||
}
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
#endif /* MBEDTLS_VERSION_C */
|
181
third_party/mbedtls/scripts/data_files/vs2010-app-template.vcxproj
vendored
Normal file
181
third_party/mbedtls/scripts/data_files/vs2010-app-template.vcxproj
vendored
Normal file
@ -0,0 +1,181 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<SOURCES>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="mbedTLS.vcxproj">
|
||||
<Project>{46cf2d25-6a36-4189-b59c-e4815388e554}</Project>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid><GUID></ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace><APPNAME></RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>Windows7.1SDK</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IntDir>$(Configuration)\$(TargetName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IntDir>$(Configuration)\$(TargetName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IntDir>$(Configuration)\$(TargetName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IntDir>$(Configuration)\$(TargetName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>
|
||||
INCLUDE_DIRECTORIES
|
||||
</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ShowProgress>NotSet</ShowProgress>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>Debug</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>
|
||||
INCLUDE_DIRECTORIES
|
||||
</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ShowProgress>NotSet</ShowProgress>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>Debug</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>
|
||||
INCLUDE_DIRECTORIES
|
||||
</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>Release</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>
|
||||
INCLUDE_DIRECTORIES
|
||||
</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>Release</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies);</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
165
third_party/mbedtls/scripts/data_files/vs2010-main-template.vcxproj
vendored
Normal file
165
third_party/mbedtls/scripts/data_files/vs2010-main-template.vcxproj
vendored
Normal file
@ -0,0 +1,165 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{46CF2D25-6A36-4189-B59C-E4815388E554}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>mbedTLS</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>Windows7.1SDK</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IntDir>$(Configuration)\$(TargetName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IntDir>$(Configuration)\$(TargetName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IntDir>$(Configuration)\$(TargetName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IntDir>$(Configuration)\$(TargetName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MBEDTLS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>
|
||||
INCLUDE_DIRECTORIES
|
||||
</AdditionalIncludeDirectories>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MBEDTLS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>
|
||||
INCLUDE_DIRECTORIES
|
||||
</AdditionalIncludeDirectories>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MBEDTLS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>
|
||||
INCLUDE_DIRECTORIES
|
||||
</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;_USRDLL;MBEDTLS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>
|
||||
INCLUDE_DIRECTORIES
|
||||
</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
HEADER_ENTRIES
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
SOURCE_ENTRIES
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
28
third_party/mbedtls/scripts/data_files/vs2010-sln-template.sln
vendored
Normal file
28
third_party/mbedtls/scripts/data_files/vs2010-sln-template.sln
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual C++ Express 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mbedTLS", "mbedTLS.vcxproj", "{46CF2D25-6A36-4189-B59C-E4815388E554}"
|
||||
EndProject
|
||||
APP_ENTRIES
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{46CF2D25-6A36-4189-B59C-E4815388E554}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{46CF2D25-6A36-4189-B59C-E4815388E554}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{46CF2D25-6A36-4189-B59C-E4815388E554}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{46CF2D25-6A36-4189-B59C-E4815388E554}.Debug|x64.Build.0 = Debug|x64
|
||||
{46CF2D25-6A36-4189-B59C-E4815388E554}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{46CF2D25-6A36-4189-B59C-E4815388E554}.Release|Win32.Build.0 = Release|Win32
|
||||
{46CF2D25-6A36-4189-B59C-E4815388E554}.Release|x64.ActiveCfg = Release|x64
|
||||
{46CF2D25-6A36-4189-B59C-E4815388E554}.Release|x64.Build.0 = Release|x64
|
||||
CONF_ENTRIES
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
101
third_party/mbedtls/scripts/data_files/vs6-app-template.dsp
vendored
Normal file
101
third_party/mbedtls/scripts/data_files/vs6-app-template.dsp
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
# Microsoft Developer Studio Project File - Name="<APPNAME>" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=<APPNAME> - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "<APPNAME>.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "<APPNAME>.mak" CFG="<APPNAME> - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "<APPNAME> - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "<APPNAME> - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "<APPNAME> - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir ""
|
||||
# PROP BASE Intermediate_Dir "temp"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir "temp"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x40c /d "NDEBUG"
|
||||
# ADD RSC /l 0x40c /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "<APPNAME> - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir ""
|
||||
# PROP BASE Intermediate_Dir "temp"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir "temp"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x40c /d "_DEBUG"
|
||||
# ADD RSC /l 0x40c /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "<APPNAME> - Win32 Release"
|
||||
# Name "<APPNAME> - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\programs\<PATHNAME>.c
|
||||
# ADD CPP /I "../../include"
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
94
third_party/mbedtls/scripts/data_files/vs6-main-template.dsp
vendored
Normal file
94
third_party/mbedtls/scripts/data_files/vs6-main-template.dsp
vendored
Normal file
@ -0,0 +1,94 @@
|
||||
# Microsoft Developer Studio Project File - Name="mbedtls" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=mbedtls - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "mbedtls.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "mbedtls.mak" CFG="mbedtls - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "mbedtls - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "mbedtls - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "mbedtls - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir ""
|
||||
# PROP BASE Intermediate_Dir "temp"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir "temp"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x40c /d "NDEBUG"
|
||||
# ADD RSC /l 0x40c /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "mbedtls - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir ""
|
||||
# PROP BASE Intermediate_Dir "temp"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir "temp"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /GX /Z7 /Od /I "../../include" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x40c /d "_DEBUG"
|
||||
# ADD RSC /l 0x40c /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "mbedtls - Win32 Release"
|
||||
# Name "mbedtls - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
SOURCE_ENTRIES
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
HEADER_ENTRIES
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
18
third_party/mbedtls/scripts/data_files/vs6-workspace-template.dsw
vendored
Normal file
18
third_party/mbedtls/scripts/data_files/vs6-workspace-template.dsw
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
APP_ENTRIES
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
74
third_party/mbedtls/scripts/ecc-heap.sh
vendored
Executable file
74
third_party/mbedtls/scripts/ecc-heap.sh
vendored
Executable file
@ -0,0 +1,74 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Measure heap usage (and performance) of ECC operations with various values of
|
||||
# the relevant tunable compile-time parameters.
|
||||
#
|
||||
# Usage (preferably on a 32-bit platform):
|
||||
# cmake -D CMAKE_BUILD_TYPE=Release .
|
||||
# scripts/ecc-heap.sh | tee ecc-heap.log
|
||||
|
||||
set -eu
|
||||
|
||||
CONFIG_H='include/mbedtls/config.h'
|
||||
|
||||
if [ -r $CONFIG_H ]; then :; else
|
||||
echo "$CONFIG_H not found" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep -i cmake Makefile >/dev/null; then :; else
|
||||
echo "Needs Cmake" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if git status | grep -F $CONFIG_H >/dev/null 2>&1; then
|
||||
echo "config.h not clean" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CONFIG_BAK=${CONFIG_H}.bak
|
||||
cp $CONFIG_H $CONFIG_BAK
|
||||
|
||||
cat << EOF >$CONFIG_H
|
||||
#define MBEDTLS_PLATFORM_C
|
||||
#define MBEDTLS_PLATFORM_MEMORY
|
||||
#define MBEDTLS_MEMORY_BUFFER_ALLOC_C
|
||||
#define MBEDTLS_MEMORY_DEBUG
|
||||
|
||||
#define MBEDTLS_TIMING_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 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_CURVE25519_ENABLED
|
||||
|
||||
#include "check_config.h"
|
||||
|
||||
//#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 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 "--------------------------------------------"
|
||||
programs/test/benchmark
|
||||
done
|
||||
done
|
||||
|
||||
# cleanup
|
||||
|
||||
mv $CONFIG_BAK $CONFIG_H
|
||||
make clean
|
20
third_party/mbedtls/scripts/find-mem-leak.cocci
vendored
Normal file
20
third_party/mbedtls/scripts/find-mem-leak.cocci
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
@@
|
||||
expression x, y;
|
||||
statement S;
|
||||
@@
|
||||
x = mbedtls_calloc(...);
|
||||
y = mbedtls_calloc(...);
|
||||
...
|
||||
* if (x == NULL || y == NULL)
|
||||
S
|
||||
|
||||
@@
|
||||
expression x, y;
|
||||
statement S;
|
||||
@@
|
||||
if (
|
||||
* (x = mbedtls_calloc(...)) == NULL
|
||||
||
|
||||
* (y = mbedtls_calloc(...)) == NULL
|
||||
)
|
||||
S
|
109
third_party/mbedtls/scripts/footprint.sh
vendored
Executable file
109
third_party/mbedtls/scripts/footprint.sh
vendored
Executable file
@ -0,0 +1,109 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This file is part of mbed TLS (https://tls.mbed.org)
|
||||
#
|
||||
# Copyright (c) 2015-2016, ARM Limited, All Rights Reserved
|
||||
#
|
||||
# Purpose
|
||||
#
|
||||
# This script determines ROM size (or code size) for the standard mbed TLS
|
||||
# configurations, when built for a Cortex M3/M4 target.
|
||||
#
|
||||
# Configurations included:
|
||||
# default include/mbedtls/config.h
|
||||
# thread configs/config-thread.h
|
||||
# suite-b configs/config-suite-b.h
|
||||
# psk configs/config-ccm-psk-tls1_2.h
|
||||
#
|
||||
# Usage: footprint.sh
|
||||
#
|
||||
set -eu
|
||||
|
||||
CONFIG_H='include/mbedtls/config.h'
|
||||
|
||||
if [ -r $CONFIG_H ]; then :; else
|
||||
echo "$CONFIG_H not found" >&2
|
||||
echo "This script needs to be run from the root of" >&2
|
||||
echo "a git checkout or uncompressed tarball" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep -i cmake Makefile >/dev/null; then
|
||||
echo "Not compatible with CMake" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if which arm-none-eabi-gcc >/dev/null 2>&1; then :; else
|
||||
echo "You need the ARM-GCC toolchain in your path" >&2
|
||||
echo "See https://launchpad.net/gcc-arm-embedded/" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ARMGCC_FLAGS='-Os -march=armv7-m -mthumb'
|
||||
OUTFILE='00-footprint-summary.txt'
|
||||
|
||||
log()
|
||||
{
|
||||
echo "$@"
|
||||
echo "$@" >> "$OUTFILE"
|
||||
}
|
||||
|
||||
doit()
|
||||
{
|
||||
NAME="$1"
|
||||
FILE="$2"
|
||||
|
||||
log ""
|
||||
log "$NAME ($FILE):"
|
||||
|
||||
cp $CONFIG_H ${CONFIG_H}.bak
|
||||
if [ "$FILE" != $CONFIG_H ]; then
|
||||
cp "$FILE" $CONFIG_H
|
||||
fi
|
||||
|
||||
{
|
||||
scripts/config.pl unset MBEDTLS_NET_C || true
|
||||
scripts/config.pl unset MBEDTLS_TIMING_C || true
|
||||
scripts/config.pl unset MBEDTLS_FS_IO || true
|
||||
scripts/config.pl --force set MBEDTLS_NO_PLATFORM_ENTROPY || true
|
||||
} >/dev/null 2>&1
|
||||
|
||||
make clean >/dev/null
|
||||
CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld \
|
||||
CFLAGS="$ARMGCC_FLAGS" make lib >/dev/null
|
||||
|
||||
OUT="size-${NAME}.txt"
|
||||
arm-none-eabi-size -t library/libmbed*.a > "$OUT"
|
||||
log "$( head -n1 "$OUT" )"
|
||||
log "$( tail -n1 "$OUT" )"
|
||||
|
||||
cp ${CONFIG_H}.bak $CONFIG_H
|
||||
}
|
||||
|
||||
# truncate the file just this time
|
||||
echo "(generated by $0)" > "$OUTFILE"
|
||||
echo "" >> "$OUTFILE"
|
||||
|
||||
log "Footprint of standard configurations (minus net_sockets.c, timing.c, fs_io)"
|
||||
log "for bare-metal ARM Cortex-M3/M4 microcontrollers."
|
||||
|
||||
VERSION_H="include/mbedtls/version.h"
|
||||
MBEDTLS_VERSION=$( sed -n 's/.*VERSION_STRING *"\(.*\)"/\1/p' $VERSION_H )
|
||||
if git rev-parse HEAD >/dev/null; then
|
||||
GIT_HEAD=$( git rev-parse HEAD | head -c 10 )
|
||||
GIT_VERSION=" (git head: $GIT_HEAD)"
|
||||
else
|
||||
GIT_VERSION=""
|
||||
fi
|
||||
|
||||
log ""
|
||||
log "mbed TLS $MBEDTLS_VERSION$GIT_VERSION"
|
||||
log "$( arm-none-eabi-gcc --version | head -n1 )"
|
||||
log "CFLAGS=$ARMGCC_FLAGS"
|
||||
|
||||
doit default include/mbedtls/config.h
|
||||
doit thread configs/config-thread.h
|
||||
doit suite-b configs/config-suite-b.h
|
||||
doit psk configs/config-ccm-psk-tls1_2.h
|
||||
|
||||
zip mbedtls-footprint.zip "$OUTFILE" size-*.txt >/dev/null
|
225
third_party/mbedtls/scripts/generate_errors.pl
vendored
Executable file
225
third_party/mbedtls/scripts/generate_errors.pl
vendored
Executable file
@ -0,0 +1,225 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
# Generate error.c
|
||||
#
|
||||
# Usage: ./generate_errors.pl or scripts/generate_errors.pl without arguments,
|
||||
# or generate_errors.pl include_dir data_dir error_file include_crypto
|
||||
# include_crypto can be either 0 (don't include) or 1 (include). On by default.
|
||||
|
||||
use strict;
|
||||
|
||||
my ($include_dir, $data_dir, $error_file, $include_crypto);
|
||||
my $crypto_dir = "crypto";
|
||||
|
||||
if( @ARGV ) {
|
||||
die "Invalid number of arguments" if scalar @ARGV != 4;
|
||||
($include_dir, $data_dir, $error_file, $include_crypto) = @ARGV;
|
||||
|
||||
-d $include_dir or die "No such directory: $include_dir\n";
|
||||
-d $data_dir or die "No such directory: $data_dir\n";
|
||||
} else {
|
||||
$include_dir = 'include/mbedtls';
|
||||
$data_dir = 'scripts/data_files';
|
||||
$error_file = 'library/error.c';
|
||||
$include_crypto = 1;
|
||||
|
||||
unless( -d $include_dir && -d $data_dir ) {
|
||||
chdir '..' or die;
|
||||
-d $include_dir && -d $data_dir
|
||||
or die "Without arguments, must be run from root or scripts\n"
|
||||
}
|
||||
}
|
||||
|
||||
if( $include_crypto ) {
|
||||
-d $crypto_dir or die "Crypto submodule not present\n";
|
||||
}
|
||||
|
||||
my $error_format_file = $data_dir.'/error.fmt';
|
||||
|
||||
my @low_level_modules = qw( AES ARC4 ARIA ASN1 BASE64 BIGNUM BLOWFISH
|
||||
CAMELLIA CCM CHACHA20 CHACHAPOLY CMAC CTR_DRBG DES
|
||||
ENTROPY GCM HKDF HMAC_DRBG MD2 MD4 MD5
|
||||
NET OID PADLOCK PBKDF2 PLATFORM POLY1305 RIPEMD160
|
||||
SHA1 SHA256 SHA512 THREADING XTEA );
|
||||
my @high_level_modules = qw( CIPHER DHM ECP MD
|
||||
PEM PK PKCS12 PKCS5
|
||||
RSA SSL X509 );
|
||||
|
||||
my $line_separator = $/;
|
||||
undef $/;
|
||||
|
||||
open(FORMAT_FILE, "$error_format_file") or die "Opening error format file '$error_format_file': $!";
|
||||
my $error_format = <FORMAT_FILE>;
|
||||
close(FORMAT_FILE);
|
||||
|
||||
$/ = $line_separator;
|
||||
|
||||
my @headers = ();
|
||||
if ($include_crypto) {
|
||||
@headers = <$crypto_dir/$include_dir/*.h>;
|
||||
foreach my $header (<$include_dir/*.h>) {
|
||||
my $basename = $header; $basename =~ s!.*/!!;
|
||||
push @headers, $header unless -e "$crypto_dir/$include_dir/$basename";
|
||||
}
|
||||
} else {
|
||||
@headers = <$include_dir/*.h>;
|
||||
}
|
||||
|
||||
my @matches;
|
||||
foreach my $file (@headers) {
|
||||
open(FILE, "$file");
|
||||
my @grep_res = grep(/^\s*#define\s+MBEDTLS_ERR_\w+\s+\-0x[0-9A-Fa-f]+/, <FILE>);
|
||||
push(@matches, @grep_res);
|
||||
close FILE;
|
||||
}
|
||||
|
||||
my $ll_old_define = "";
|
||||
my $hl_old_define = "";
|
||||
|
||||
my $ll_code_check = "";
|
||||
my $hl_code_check = "";
|
||||
|
||||
my $headers = "";
|
||||
|
||||
my %error_codes_seen;
|
||||
|
||||
|
||||
foreach my $line (@matches)
|
||||
{
|
||||
next if ($line =~ /compat-1.2.h/);
|
||||
my ($error_name, $error_code) = $line =~ /(MBEDTLS_ERR_\w+)\s+\-(0x\w+)/;
|
||||
my ($description) = $line =~ /\/\*\*< (.*?)\.? \*\//;
|
||||
|
||||
if( $error_codes_seen{$error_code}++ ) {
|
||||
die "Duplicated error code: $error_code ($error_name)\n";
|
||||
}
|
||||
|
||||
$description =~ s/\\/\\\\/g;
|
||||
if ($description eq "") {
|
||||
$description = "DESCRIPTION MISSING";
|
||||
warn "Missing description for $error_name\n";
|
||||
}
|
||||
|
||||
my ($module_name) = $error_name =~ /^MBEDTLS_ERR_([^_]+)/;
|
||||
|
||||
# Fix faulty ones
|
||||
$module_name = "BIGNUM" if ($module_name eq "MPI");
|
||||
$module_name = "CTR_DRBG" if ($module_name eq "CTR");
|
||||
$module_name = "HMAC_DRBG" if ($module_name eq "HMAC");
|
||||
|
||||
my $define_name = $module_name;
|
||||
$define_name = "X509_USE,X509_CREATE" if ($define_name eq "X509");
|
||||
$define_name = "ASN1_PARSE" if ($define_name eq "ASN1");
|
||||
$define_name = "SSL_TLS" if ($define_name eq "SSL");
|
||||
$define_name = "PEM_PARSE,PEM_WRITE" if ($define_name eq "PEM");
|
||||
|
||||
my $include_name = $module_name;
|
||||
$include_name =~ tr/A-Z/a-z/;
|
||||
$include_name = "" if ($include_name eq "asn1");
|
||||
|
||||
# Fix faulty ones
|
||||
$include_name = "net_sockets" if ($module_name eq "NET");
|
||||
|
||||
my $found_ll = grep $_ eq $module_name, @low_level_modules;
|
||||
my $found_hl = grep $_ eq $module_name, @high_level_modules;
|
||||
if (!$found_ll && !$found_hl)
|
||||
{
|
||||
printf("Error: Do not know how to handle: $module_name\n");
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $code_check;
|
||||
my $old_define;
|
||||
my $white_space;
|
||||
my $first;
|
||||
|
||||
if ($found_ll)
|
||||
{
|
||||
$code_check = \$ll_code_check;
|
||||
$old_define = \$ll_old_define;
|
||||
$white_space = ' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$code_check = \$hl_code_check;
|
||||
$old_define = \$hl_old_define;
|
||||
$white_space = ' ';
|
||||
}
|
||||
|
||||
if ($define_name ne ${$old_define})
|
||||
{
|
||||
if (${$old_define} ne "")
|
||||
{
|
||||
${$code_check} .= "#endif /* ";
|
||||
$first = 0;
|
||||
foreach my $dep (split(/,/, ${$old_define}))
|
||||
{
|
||||
${$code_check} .= " || " if ($first++);
|
||||
${$code_check} .= "MBEDTLS_${dep}_C";
|
||||
}
|
||||
${$code_check} .= " */\n\n";
|
||||
}
|
||||
|
||||
${$code_check} .= "#if ";
|
||||
$headers .= "#if " if ($include_name ne "");
|
||||
$first = 0;
|
||||
foreach my $dep (split(/,/, ${define_name}))
|
||||
{
|
||||
${$code_check} .= " || " if ($first);
|
||||
$headers .= " || " if ($first++);
|
||||
|
||||
${$code_check} .= "defined(MBEDTLS_${dep}_C)";
|
||||
$headers .= "defined(MBEDTLS_${dep}_C)" if
|
||||
($include_name ne "");
|
||||
}
|
||||
${$code_check} .= "\n";
|
||||
$headers .= "\n#include \"mbedtls/${include_name}.h\"\n".
|
||||
"#endif\n\n" if ($include_name ne "");
|
||||
${$old_define} = $define_name;
|
||||
}
|
||||
|
||||
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} 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} mbedtls_snprintf( buf, buflen, \"$module_name - $description\" );\n"
|
||||
}
|
||||
};
|
||||
|
||||
if ($ll_old_define ne "")
|
||||
{
|
||||
$ll_code_check .= "#endif /* ";
|
||||
my $first = 0;
|
||||
foreach my $dep (split(/,/, $ll_old_define))
|
||||
{
|
||||
$ll_code_check .= " || " if ($first++);
|
||||
$ll_code_check .= "MBEDTLS_${dep}_C";
|
||||
}
|
||||
$ll_code_check .= " */\n";
|
||||
}
|
||||
if ($hl_old_define ne "")
|
||||
{
|
||||
$hl_code_check .= "#endif /* ";
|
||||
my $first = 0;
|
||||
foreach my $dep (split(/,/, $hl_old_define))
|
||||
{
|
||||
$hl_code_check .= " || " if ($first++);
|
||||
$hl_code_check .= "MBEDTLS_${dep}_C";
|
||||
}
|
||||
$hl_code_check .= " */\n";
|
||||
}
|
||||
|
||||
$error_format =~ s/HEADER_INCLUDED\n/$headers/g;
|
||||
$error_format =~ s/LOW_LEVEL_CODE_CHECKS\n/$ll_code_check/g;
|
||||
$error_format =~ s/HIGH_LEVEL_CODE_CHECKS\n/$hl_code_check/g;
|
||||
|
||||
open(ERROR_FILE, ">$error_file") or die "Opening destination file '$error_file': $!";
|
||||
print ERROR_FILE $error_format;
|
||||
close(ERROR_FILE);
|
74
third_party/mbedtls/scripts/generate_features.pl
vendored
Executable file
74
third_party/mbedtls/scripts/generate_features.pl
vendored
Executable file
@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env perl
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
||||
my ($include_dir, $data_dir, $feature_file);
|
||||
|
||||
if( @ARGV ) {
|
||||
die "Invalid number of arguments" if scalar @ARGV != 3;
|
||||
($include_dir, $data_dir, $feature_file) = @ARGV;
|
||||
|
||||
-d $include_dir or die "No such directory: $include_dir\n";
|
||||
-d $data_dir or die "No such directory: $data_dir\n";
|
||||
} else {
|
||||
$include_dir = 'include/mbedtls';
|
||||
$data_dir = 'scripts/data_files';
|
||||
$feature_file = 'library/version_features.c';
|
||||
|
||||
unless( -d $include_dir && -d $data_dir ) {
|
||||
chdir '..' or die;
|
||||
-d $include_dir && -d $data_dir
|
||||
or die "Without arguments, must be run from root or scripts\n"
|
||||
}
|
||||
}
|
||||
|
||||
my $feature_format_file = $data_dir.'/version_features.fmt';
|
||||
|
||||
my @sections = ( "System support", "mbed TLS modules",
|
||||
"mbed TLS feature support" );
|
||||
|
||||
my $line_separator = $/;
|
||||
undef $/;
|
||||
|
||||
open(FORMAT_FILE, "$feature_format_file") or die "Opening feature format file '$feature_format_file': $!";
|
||||
my $feature_format = <FORMAT_FILE>;
|
||||
close(FORMAT_FILE);
|
||||
|
||||
$/ = $line_separator;
|
||||
|
||||
open(CONFIG_H, "$include_dir/config.h") || die("Failure when opening config.h: $!");
|
||||
|
||||
my $feature_defines = "";
|
||||
my $in_section = 0;
|
||||
|
||||
while (my $line = <CONFIG_H>)
|
||||
{
|
||||
next if ($in_section && $line !~ /#define/ && $line !~ /SECTION/);
|
||||
next if (!$in_section && $line !~ /SECTION/);
|
||||
|
||||
if ($in_section) {
|
||||
if ($line =~ /SECTION/) {
|
||||
$in_section = 0;
|
||||
next;
|
||||
}
|
||||
|
||||
my ($define) = $line =~ /#define (\w+)/;
|
||||
$feature_defines .= "#if defined(${define})\n";
|
||||
$feature_defines .= " \"${define}\",\n";
|
||||
$feature_defines .= "#endif /* ${define} */\n";
|
||||
}
|
||||
|
||||
if (!$in_section) {
|
||||
my ($section_name) = $line =~ /SECTION: ([\w ]+)/;
|
||||
my $found_section = grep $_ eq $section_name, @sections;
|
||||
|
||||
$in_section = 1 if ($found_section);
|
||||
}
|
||||
};
|
||||
|
||||
$feature_format =~ s/FEATURE_DEFINES\n/$feature_defines/g;
|
||||
|
||||
open(ERROR_FILE, ">$feature_file") or die "Opening destination file '$feature_file': $!";
|
||||
print ERROR_FILE $feature_format;
|
||||
close(ERROR_FILE);
|
75
third_party/mbedtls/scripts/generate_query_config.pl
vendored
Executable file
75
third_party/mbedtls/scripts/generate_query_config.pl
vendored
Executable file
@ -0,0 +1,75 @@
|
||||
#! /usr/bin/env perl
|
||||
|
||||
# Generate query_config.c
|
||||
#
|
||||
# The file query_config.c contains a C function that can be used to check if
|
||||
# a configuration macro is defined and to retrieve its expansion in string
|
||||
# form (if any). This facilitates querying the compile time configuration of
|
||||
# the library, for example, for testing.
|
||||
#
|
||||
# The query_config.c is generated from the current configuration at
|
||||
# include/mbedtls/config.h. The idea is that the config.h contains ALL the
|
||||
# compile time configurations available in Mbed TLS (commented or uncommented).
|
||||
# This script extracts the configuration macros from the config.h and this
|
||||
# information is used to automatically generate the body of the query_config()
|
||||
# function by using the template in scripts/data_files/query_config.fmt.
|
||||
#
|
||||
# Usage: ./scripts/generate_query_config.pl without arguments
|
||||
|
||||
use strict;
|
||||
|
||||
my $config_file = "./include/mbedtls/config.h";
|
||||
|
||||
my $query_config_format_file = "./scripts/data_files/query_config.fmt";
|
||||
my $query_config_file = "./programs/ssl/query_config.c";
|
||||
|
||||
# Excluded macros from the generated query_config.c. For example, macros that
|
||||
# have commas or function-like macros cannot be transformed into strings easily
|
||||
# using the preprocessor, so they should be excluded or the preprocessor will
|
||||
# throw errors.
|
||||
my @excluded = qw(
|
||||
MBEDTLS_SSL_CIPHERSUITES
|
||||
MBEDTLS_PARAM_FAILED
|
||||
);
|
||||
my $excluded_re = join '|', @excluded;
|
||||
|
||||
open(CONFIG_FILE, "$config_file") or die "Opening config file '$config_file': $!";
|
||||
|
||||
# This variable will contain the string to replace in the CHECK_CONFIG of the
|
||||
# format file
|
||||
my $config_check = "";
|
||||
|
||||
while (my $line = <CONFIG_FILE>) {
|
||||
if ($line =~ /^(\/\/)?\s*#\s*define\s+(MBEDTLS_\w+).*/) {
|
||||
my $name = $2;
|
||||
|
||||
# Skip over the macro that prevents multiple inclusion
|
||||
next if "MBEDTLS_CONFIG_H" eq $name;
|
||||
|
||||
# Skip over the macro if it is in the ecluded list
|
||||
next if $name =~ /$excluded_re/;
|
||||
|
||||
$config_check .= "#if defined($name)\n";
|
||||
$config_check .= " if( strcmp( \"$name\", config ) == 0 )\n";
|
||||
$config_check .= " {\n";
|
||||
$config_check .= " MACRO_EXPANSION_TO_STR( $name );\n";
|
||||
$config_check .= " return( 0 );\n";
|
||||
$config_check .= " }\n";
|
||||
$config_check .= "#endif /* $name */\n";
|
||||
$config_check .= "\n";
|
||||
}
|
||||
}
|
||||
|
||||
# Read the full format file into a string
|
||||
local $/;
|
||||
open(FORMAT_FILE, "$query_config_format_file") or die "Opening query config format file '$query_config_format_file': $!";
|
||||
my $query_config_format = <FORMAT_FILE>;
|
||||
close(FORMAT_FILE);
|
||||
|
||||
# Replace the body of the query_config() function with the code we just wrote
|
||||
$query_config_format =~ s/CHECK_CONFIG/$config_check/g;
|
||||
|
||||
# Rewrite the query_config.c file
|
||||
open(QUERY_CONFIG_FILE, ">$query_config_file") or die "Opening destination file '$query_config_file': $!";
|
||||
print QUERY_CONFIG_FILE $query_config_format;
|
||||
close(QUERY_CONFIG_FILE);
|
245
third_party/mbedtls/scripts/generate_visualc_files.pl
vendored
Executable file
245
third_party/mbedtls/scripts/generate_visualc_files.pl
vendored
Executable file
@ -0,0 +1,245 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
# Generate main file, individual apps and solution files for MS Visual Studio
|
||||
# 2010
|
||||
#
|
||||
# Must be run from mbedTLS root or scripts directory.
|
||||
# Takes "include_crypto" as an argument that can be either 0 (don't include) or
|
||||
# 1 (include). On by default.
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
use Digest::MD5 'md5_hex';
|
||||
|
||||
my $vsx_dir = "visualc/VS2010";
|
||||
my $vsx_ext = "vcxproj";
|
||||
my $vsx_app_tpl_file = "scripts/data_files/vs2010-app-template.$vsx_ext";
|
||||
my $vsx_main_tpl_file = "scripts/data_files/vs2010-main-template.$vsx_ext";
|
||||
my $vsx_main_file = "$vsx_dir/mbedTLS.$vsx_ext";
|
||||
my $vsx_sln_tpl_file = "scripts/data_files/vs2010-sln-template.sln";
|
||||
my $vsx_sln_file = "$vsx_dir/mbedTLS.sln";
|
||||
|
||||
my $include_crypto = 1;
|
||||
if( @ARGV ) {
|
||||
die "Invalid number of arguments" if scalar @ARGV != 1;
|
||||
($include_crypto) = @ARGV;
|
||||
}
|
||||
|
||||
my $programs_dir = 'programs';
|
||||
my $header_dir = 'include/mbedtls';
|
||||
my $crypto_headers_dir = 'include/psa';
|
||||
my $source_dir = 'library';
|
||||
my $crypto_dir = 'crypto';
|
||||
|
||||
# Need windows line endings!
|
||||
my $include_directories = <<EOT;
|
||||
../../include\r
|
||||
EOT
|
||||
|
||||
if ($include_crypto) {
|
||||
$include_directories = <<EOT;
|
||||
../../include;../../crypto/include\r
|
||||
EOT
|
||||
}
|
||||
|
||||
my $vsx_hdr_tpl = <<EOT;
|
||||
<ClInclude Include="..\\..\\{NAME}" />\r
|
||||
EOT
|
||||
my $vsx_src_tpl = <<EOT;
|
||||
<ClCompile Include="..\\..\\{NAME}" />\r
|
||||
EOT
|
||||
|
||||
my $vsx_sln_app_entry_tpl = <<EOT;
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "{APPNAME}", "{APPNAME}.vcxproj", "{GUID}"\r
|
||||
ProjectSection(ProjectDependencies) = postProject\r
|
||||
{46CF2D25-6A36-4189-B59C-E4815388E554} = {46CF2D25-6A36-4189-B59C-E4815388E554}\r
|
||||
EndProjectSection\r
|
||||
EndProject\r
|
||||
EOT
|
||||
|
||||
my $vsx_sln_conf_entry_tpl = <<EOT;
|
||||
{GUID}.Debug|Win32.ActiveCfg = Debug|Win32\r
|
||||
{GUID}.Debug|Win32.Build.0 = Debug|Win32\r
|
||||
{GUID}.Debug|x64.ActiveCfg = Debug|x64\r
|
||||
{GUID}.Debug|x64.Build.0 = Debug|x64\r
|
||||
{GUID}.Release|Win32.ActiveCfg = Release|Win32\r
|
||||
{GUID}.Release|Win32.Build.0 = Release|Win32\r
|
||||
{GUID}.Release|x64.ActiveCfg = Release|x64\r
|
||||
{GUID}.Release|x64.Build.0 = Release|x64\r
|
||||
EOT
|
||||
|
||||
exit( main() );
|
||||
|
||||
sub check_dirs {
|
||||
return -d $vsx_dir
|
||||
&& -d $header_dir
|
||||
&& -d $source_dir
|
||||
&& -d $programs_dir
|
||||
&& -d $crypto_dir
|
||||
&& -d "$crypto_dir/$crypto_headers_dir";
|
||||
}
|
||||
|
||||
sub slurp_file {
|
||||
my ($filename) = @_;
|
||||
|
||||
local $/ = undef;
|
||||
open my $fh, '<', $filename or die "Could not read $filename\n";
|
||||
my $content = <$fh>;
|
||||
close $fh;
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
sub content_to_file {
|
||||
my ($content, $filename) = @_;
|
||||
|
||||
open my $fh, '>', $filename or die "Could not write to $filename\n";
|
||||
print $fh $content;
|
||||
close $fh;
|
||||
}
|
||||
|
||||
sub gen_app_guid {
|
||||
my ($path) = @_;
|
||||
|
||||
my $guid = md5_hex( "mbedTLS:$path" );
|
||||
$guid =~ s/(.{8})(.{4})(.{4})(.{4})(.{12})/\U{$1-$2-$3-$4-$5}/;
|
||||
|
||||
return $guid;
|
||||
}
|
||||
|
||||
sub gen_app {
|
||||
my ($path, $template, $dir, $ext) = @_;
|
||||
|
||||
my $guid = gen_app_guid( $path );
|
||||
$path =~ s!/!\\!g;
|
||||
(my $appname = $path) =~ s/.*\\//;
|
||||
|
||||
my $srcs = "\n <ClCompile Include=\"..\\..\\programs\\$path.c\" \/>\r";
|
||||
if( $appname eq "ssl_client2" or $appname eq "ssl_server2" or
|
||||
$appname eq "query_compile_time_config" ) {
|
||||
$srcs .= "\n <ClCompile Include=\"..\\..\\programs\\ssl\\query_config.c\" \/>\r";
|
||||
}
|
||||
|
||||
my $content = $template;
|
||||
$content =~ s/<SOURCES>/$srcs/g;
|
||||
$content =~ s/<APPNAME>/$appname/g;
|
||||
$content =~ s/<GUID>/$guid/g;
|
||||
$content =~ s/INCLUDE_DIRECTORIES\r\n/$include_directories/g;
|
||||
|
||||
content_to_file( $content, "$dir/$appname.$ext" );
|
||||
}
|
||||
|
||||
sub get_app_list {
|
||||
my $app_list = `cd $programs_dir && make list`;
|
||||
die "make list failed: $!\n" if $?;
|
||||
|
||||
return split /\s+/, $app_list;
|
||||
}
|
||||
|
||||
sub gen_app_files {
|
||||
my @app_list = @_;
|
||||
|
||||
my $vsx_tpl = slurp_file( $vsx_app_tpl_file );
|
||||
|
||||
for my $app ( @app_list ) {
|
||||
gen_app( $app, $vsx_tpl, $vsx_dir, $vsx_ext );
|
||||
}
|
||||
}
|
||||
|
||||
sub gen_entry_list {
|
||||
my ($tpl, @names) = @_;
|
||||
|
||||
my $entries;
|
||||
for my $name (@names) {
|
||||
(my $entry = $tpl) =~ s/{NAME}/$name/g;
|
||||
$entries .= $entry;
|
||||
}
|
||||
|
||||
return $entries;
|
||||
}
|
||||
|
||||
sub gen_main_file {
|
||||
my ($headers, $sources, $hdr_tpl, $src_tpl, $main_tpl, $main_out) = @_;
|
||||
|
||||
my $header_entries = gen_entry_list( $hdr_tpl, @$headers );
|
||||
my $source_entries = gen_entry_list( $src_tpl, @$sources );
|
||||
|
||||
my $out = slurp_file( $main_tpl );
|
||||
$out =~ s/SOURCE_ENTRIES\r\n/$source_entries/m;
|
||||
$out =~ s/HEADER_ENTRIES\r\n/$header_entries/m;
|
||||
$out =~ s/INCLUDE_DIRECTORIES\r\n/$include_directories/g;
|
||||
|
||||
content_to_file( $out, $main_out );
|
||||
}
|
||||
|
||||
sub gen_vsx_solution {
|
||||
my (@app_names) = @_;
|
||||
|
||||
my ($app_entries, $conf_entries);
|
||||
for my $path (@app_names) {
|
||||
my $guid = gen_app_guid( $path );
|
||||
(my $appname = $path) =~ s!.*/!!;
|
||||
|
||||
my $app_entry = $vsx_sln_app_entry_tpl;
|
||||
$app_entry =~ s/{APPNAME}/$appname/g;
|
||||
$app_entry =~ s/{GUID}/$guid/g;
|
||||
|
||||
$app_entries .= $app_entry;
|
||||
|
||||
my $conf_entry = $vsx_sln_conf_entry_tpl;
|
||||
$conf_entry =~ s/{GUID}/$guid/g;
|
||||
|
||||
$conf_entries .= $conf_entry;
|
||||
}
|
||||
|
||||
my $out = slurp_file( $vsx_sln_tpl_file );
|
||||
$out =~ s/APP_ENTRIES\r\n/$app_entries/m;
|
||||
$out =~ s/CONF_ENTRIES\r\n/$conf_entries/m;
|
||||
|
||||
content_to_file( $out, $vsx_sln_file );
|
||||
}
|
||||
|
||||
sub del_vsx_files {
|
||||
unlink glob "'$vsx_dir/*.$vsx_ext'";
|
||||
unlink $vsx_main_file;
|
||||
unlink $vsx_sln_file;
|
||||
}
|
||||
|
||||
sub main {
|
||||
if( ! check_dirs() ) {
|
||||
chdir '..' or die;
|
||||
check_dirs or die "Must but run from mbedTLS root or scripts dir\n";
|
||||
}
|
||||
|
||||
# Remove old files to ensure that, for example, project files from deleted
|
||||
# apps are not kept
|
||||
del_vsx_files();
|
||||
|
||||
my @app_list = get_app_list();
|
||||
my @headers = <$header_dir/*.h>;
|
||||
|
||||
my @sources = ();
|
||||
if ($include_crypto) {
|
||||
@sources = <$crypto_dir/$source_dir/*.c>;
|
||||
foreach my $file (<$source_dir/*.c>) {
|
||||
my $basename = $file; $basename =~ s!.*/!!;
|
||||
push @sources, $file unless -e "$crypto_dir/$source_dir/$basename";
|
||||
}
|
||||
push @headers, <$crypto_dir/$crypto_headers_dir/*.h>;
|
||||
} else {
|
||||
@sources = <$source_dir/*.c>;
|
||||
}
|
||||
|
||||
map { s!/!\\!g } @headers;
|
||||
map { s!/!\\!g } @sources;
|
||||
|
||||
gen_app_files( @app_list );
|
||||
|
||||
gen_main_file( \@headers, \@sources,
|
||||
$vsx_hdr_tpl, $vsx_src_tpl,
|
||||
$vsx_main_tpl_file, $vsx_main_file );
|
||||
|
||||
gen_vsx_solution( @app_list );
|
||||
|
||||
return 0;
|
||||
}
|
33
third_party/mbedtls/scripts/massif_max.pl
vendored
Executable file
33
third_party/mbedtls/scripts/massif_max.pl
vendored
Executable file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
# Parse a massif.out.xxx file and output peak total memory usage
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use utf8;
|
||||
use open qw(:std utf8);
|
||||
|
||||
die unless @ARGV == 1;
|
||||
|
||||
my @snaps;
|
||||
open my $fh, '<', $ARGV[0] or die;
|
||||
{ local $/ = 'snapshot='; @snaps = <$fh>; }
|
||||
close $fh or die;
|
||||
|
||||
my ($max, $max_heap, $max_he, $max_stack) = (0, 0, 0, 0);
|
||||
for (@snaps)
|
||||
{
|
||||
my ($heap, $heap_extra, $stack) = m{
|
||||
mem_heap_B=(\d+)\n
|
||||
mem_heap_extra_B=(\d+)\n
|
||||
mem_stacks_B=(\d+)
|
||||
}xm;
|
||||
next unless defined $heap;
|
||||
my $total = $heap + $heap_extra + $stack;
|
||||
if( $total > $max ) {
|
||||
($max, $max_heap, $max_he, $max_stack) = ($total, $heap, $heap_extra, $stack);
|
||||
}
|
||||
}
|
||||
|
||||
printf "$max (heap $max_heap+$max_he, stack $max_stack)\n";
|
126
third_party/mbedtls/scripts/memory.sh
vendored
Executable file
126
third_party/mbedtls/scripts/memory.sh
vendored
Executable file
@ -0,0 +1,126 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Measure memory usage of a minimal client using a small configuration
|
||||
# Currently hardwired to ccm-psk and suite-b, may be expanded later
|
||||
#
|
||||
# Use different build options for measuring executable size and memory usage,
|
||||
# since for memory we want debug information.
|
||||
|
||||
set -eu
|
||||
|
||||
CONFIG_H='include/mbedtls/config.h'
|
||||
|
||||
CLIENT='mini_client'
|
||||
|
||||
CFLAGS_EXEC='-fno-asynchronous-unwind-tables -Wl,--gc-section -ffunction-sections -fdata-sections'
|
||||
CFLAGS_MEM=-g3
|
||||
|
||||
if [ -r $CONFIG_H ]; then :; else
|
||||
echo "$CONFIG_H not found" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep -i cmake Makefile >/dev/null; then
|
||||
echo "Not compatible with CMake" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $( uname ) != Linux ]; then
|
||||
echo "Only work on Linux" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if git status | grep -F $CONFIG_H >/dev/null 2>&1; then
|
||||
echo "config.h not clean" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# make measurements with one configuration
|
||||
# usage: do_config <name> <unset-list> <server-args>
|
||||
do_config()
|
||||
{
|
||||
NAME=$1
|
||||
UNSET_LIST=$2
|
||||
SERVER_ARGS=$3
|
||||
|
||||
echo ""
|
||||
echo "config-$NAME:"
|
||||
cp configs/config-$NAME.h $CONFIG_H
|
||||
scripts/config.pl unset MBEDTLS_SSL_SRV_C
|
||||
|
||||
for FLAG in $UNSET_LIST; do
|
||||
scripts/config.pl unset $FLAG
|
||||
done
|
||||
|
||||
grep -F SSL_MAX_CONTENT_LEN $CONFIG_H || echo 'SSL_MAX_CONTENT_LEN=16384'
|
||||
|
||||
printf " Executable size... "
|
||||
|
||||
make clean
|
||||
CFLAGS=$CFLAGS_EXEC make OFLAGS=-Os lib >/dev/null 2>&1
|
||||
cd programs
|
||||
CFLAGS=$CFLAGS_EXEC make OFLAGS=-Os ssl/$CLIENT >/dev/null
|
||||
strip ssl/$CLIENT
|
||||
stat -c '%s' ssl/$CLIENT
|
||||
cd ..
|
||||
|
||||
printf " Peak ram usage... "
|
||||
|
||||
make clean
|
||||
CFLAGS=$CFLAGS_MEM make OFLAGS=-Os lib >/dev/null 2>&1
|
||||
cd programs
|
||||
CFLAGS=$CFLAGS_MEM make OFLAGS=-Os ssl/$CLIENT >/dev/null
|
||||
cd ..
|
||||
|
||||
./ssl_server2 $SERVER_ARGS >/dev/null &
|
||||
SRV_PID=$!
|
||||
sleep 1;
|
||||
|
||||
if valgrind --tool=massif --stacks=yes programs/ssl/$CLIENT >/dev/null 2>&1
|
||||
then
|
||||
FAILED=0
|
||||
else
|
||||
echo "client failed" >&2
|
||||
FAILED=1
|
||||
fi
|
||||
|
||||
kill $SRV_PID
|
||||
wait $SRV_PID
|
||||
|
||||
scripts/massif_max.pl massif.out.*
|
||||
mv massif.out.* massif-$NAME.$$
|
||||
}
|
||||
|
||||
# preparation
|
||||
|
||||
CONFIG_BAK=${CONFIG_H}.bak
|
||||
cp $CONFIG_H $CONFIG_BAK
|
||||
|
||||
rm -f massif.out.*
|
||||
|
||||
printf "building server... "
|
||||
|
||||
make clean
|
||||
make lib >/dev/null 2>&1
|
||||
(cd programs && make ssl/ssl_server2) >/dev/null
|
||||
cp programs/ssl/ssl_server2 .
|
||||
|
||||
echo "done"
|
||||
|
||||
# actual measurements
|
||||
|
||||
do_config "ccm-psk-tls1_2" \
|
||||
"" \
|
||||
"psk=000102030405060708090A0B0C0D0E0F"
|
||||
|
||||
do_config "suite-b" \
|
||||
"MBEDTLS_BASE64_C MBEDTLS_PEM_PARSE_C MBEDTLS_CERTS_C" \
|
||||
""
|
||||
|
||||
# cleanup
|
||||
|
||||
mv $CONFIG_BAK $CONFIG_H
|
||||
make clean
|
||||
rm ssl_server2
|
||||
|
||||
exit $FAILED
|
121
third_party/mbedtls/scripts/output_env.sh
vendored
Executable file
121
third_party/mbedtls/scripts/output_env.sh
vendored
Executable file
@ -0,0 +1,121 @@
|
||||
#! /usr/bin/env sh
|
||||
|
||||
# output_env.sh
|
||||
#
|
||||
# This file is part of mbed TLS (https://tls.mbed.org)
|
||||
#
|
||||
# Copyright (c) 2016, ARM Limited, All Rights Reserved
|
||||
#
|
||||
# Purpose
|
||||
#
|
||||
# To print out all the relevant information about the development environment.
|
||||
#
|
||||
# This includes:
|
||||
# - architecture of the system
|
||||
# - type and version of the operating system
|
||||
# - version of armcc, clang, gcc-arm and gcc compilers
|
||||
# - version of libc, clang, asan and valgrind if installed
|
||||
# - version of gnuTLS and OpenSSL
|
||||
|
||||
print_version()
|
||||
{
|
||||
BIN="$1"
|
||||
shift
|
||||
ARGS="$1"
|
||||
shift
|
||||
FAIL_MSG="$1"
|
||||
shift
|
||||
|
||||
if ! `type "$BIN" > /dev/null 2>&1`; then
|
||||
echo "* $FAIL_MSG"
|
||||
return 0
|
||||
fi
|
||||
|
||||
BIN=`which "$BIN"`
|
||||
VERSION_STR=`$BIN $ARGS 2>&1`
|
||||
|
||||
# Apply all filters
|
||||
while [ $# -gt 0 ]; do
|
||||
FILTER="$1"
|
||||
shift
|
||||
VERSION_STR=`echo "$VERSION_STR" | $FILTER`
|
||||
done
|
||||
|
||||
echo "* ${BIN##*/}: $BIN: $VERSION_STR"
|
||||
}
|
||||
|
||||
print_version "uname" "-a" ""
|
||||
echo
|
||||
|
||||
if [ "${RUN_ARMCC:-1}" -ne 0 ]; then
|
||||
: "${ARMC5_CC:=armcc}"
|
||||
print_version "$ARMC5_CC" "--vsn" "armcc not found!" "head -n 2"
|
||||
echo
|
||||
|
||||
: "${ARMC6_CC:=armclang}"
|
||||
print_version "$ARMC6_CC" "--vsn" "armclang not found!" "head -n 2"
|
||||
echo
|
||||
fi
|
||||
|
||||
print_version "arm-none-eabi-gcc" "--version" "gcc-arm not found!" "head -n 1"
|
||||
echo
|
||||
|
||||
print_version "gcc" "--version" "gcc not found!" "head -n 1"
|
||||
echo
|
||||
|
||||
print_version "clang" "--version" "clang not found" "head -n 2"
|
||||
echo
|
||||
|
||||
print_version "ldd" "--version" \
|
||||
"No ldd present: can't determine libc version!" \
|
||||
"head -n 1"
|
||||
echo
|
||||
|
||||
print_version "valgrind" "--version" "valgrind not found!"
|
||||
echo
|
||||
|
||||
: ${OPENSSL:=openssl}
|
||||
print_version "$OPENSSL" "version" "openssl not found!"
|
||||
echo
|
||||
|
||||
if [ -n "${OPENSSL_LEGACY+set}" ]; then
|
||||
print_version "$OPENSSL_LEGACY" "version" "openssl legacy version not found!"
|
||||
echo
|
||||
fi
|
||||
|
||||
if [ -n "${OPENSSL_NEXT+set}" ]; then
|
||||
print_version "$OPENSSL_NEXT" "version" "openssl next version not found!"
|
||||
echo
|
||||
fi
|
||||
|
||||
: ${GNUTLS_CLI:=gnutls-cli}
|
||||
print_version "$GNUTLS_CLI" "--version" "gnuTLS client not found!" "head -n 1"
|
||||
echo
|
||||
|
||||
: ${GNUTLS_SERV:=gnutls-serv}
|
||||
print_version "$GNUTLS_SERV" "--version" "gnuTLS server not found!" "head -n 1"
|
||||
echo
|
||||
|
||||
if [ -n "${GNUTLS_LEGACY_CLI+set}" ]; then
|
||||
print_version "$GNUTLS_LEGACY_CLI" "--version" \
|
||||
"gnuTLS client legacy version not found!" \
|
||||
"head -n 1"
|
||||
echo
|
||||
fi
|
||||
|
||||
if [ -n "${GNUTLS_LEGACY_SERV+set}" ]; then
|
||||
print_version "$GNUTLS_LEGACY_SERV" "--version" \
|
||||
"gnuTLS server legacy version not found!" \
|
||||
"head -n 1"
|
||||
echo
|
||||
fi
|
||||
|
||||
if `hash dpkg > /dev/null 2>&1`; then
|
||||
echo "* asan:"
|
||||
dpkg -s libasan2 2> /dev/null | grep -i version
|
||||
dpkg -s libasan1 2> /dev/null | grep -i version
|
||||
dpkg -s libasan0 2> /dev/null | grep -i version
|
||||
else
|
||||
echo "* No dpkg present: can't determine asan version!"
|
||||
fi
|
||||
echo
|
122
third_party/mbedtls/scripts/rename.pl
vendored
Executable file
122
third_party/mbedtls/scripts/rename.pl
vendored
Executable file
@ -0,0 +1,122 @@
|
||||
#!/usr/bin/env perl
|
||||
#
|
||||
# This file is part of mbed TLS (https://tls.mbed.org)
|
||||
#
|
||||
# Copyright (c) 2015-2016, ARM Limited, All Rights Reserved
|
||||
#
|
||||
# Purpose
|
||||
#
|
||||
# This script migrates application source code from the mbed TLS 1.3 API to the
|
||||
# mbed TLS 2.0 API.
|
||||
#
|
||||
# The script processes the given source code and renames identifiers - functions
|
||||
# types, enums etc, as
|
||||
#
|
||||
# Usage: rename.pl [-f datafile] [-s] [--] [filenames...]
|
||||
#
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use utf8;
|
||||
use Path::Class;
|
||||
use open qw(:std utf8);
|
||||
|
||||
my $usage = "Usage: $0 [-f datafile] [-s] [--] [filenames...]\n";
|
||||
|
||||
(my $datafile = $0) =~ s/rename.pl$/data_files\/rename-1.3-2.0.txt/;
|
||||
my $do_strings = 0;
|
||||
|
||||
while( @ARGV && $ARGV[0] =~ /^-/ ) {
|
||||
my $opt = shift;
|
||||
if( $opt eq '--' ) {
|
||||
last;
|
||||
} elsif( $opt eq '-f' ) {
|
||||
$datafile = shift;
|
||||
} elsif( $opt eq '-s' ) {
|
||||
$do_strings = 1; shift;
|
||||
} else {
|
||||
die $usage;
|
||||
}
|
||||
}
|
||||
|
||||
my %subst;
|
||||
open my $nfh, '<', $datafile or die "Could not read $datafile\n";
|
||||
my $ident = qr/[_A-Za-z][_A-Za-z0-9]*/;
|
||||
while( my $line = <$nfh> ) {
|
||||
chomp $line;
|
||||
my ( $old, $new ) = ( $line =~ /^($ident)\s+($ident)$/ );
|
||||
if( ! $old || ! $new ) {
|
||||
die "$0: $datafile:$.: bad input '$line'\n";
|
||||
}
|
||||
$subst{$old} = $new;
|
||||
}
|
||||
close $nfh or die;
|
||||
|
||||
my $string = qr/"(?:\\.|[^\\"])*"/;
|
||||
my $space = qr/\s+/;
|
||||
my $idnum = qr/[a-zA-Z0-9_]+/;
|
||||
my $symbols = qr/[-!#\$%&'()*+,.\/:;<=>?@[\\\]^_`{|}~]+|"/;
|
||||
|
||||
my $lib_include_dir = dir($0)->parent->parent->subdir('include', 'mbedtls');
|
||||
my $lib_source_dir = dir($0)->parent->parent->subdir('library');
|
||||
|
||||
# if we replace inside strings, we don't consider them a token
|
||||
my $token = $do_strings ? qr/$space|$idnum|$symbols/
|
||||
: qr/$string|$space|$idnum|$symbols/;
|
||||
|
||||
my %warnings;
|
||||
|
||||
# If no files were passed, exit...
|
||||
if ( not defined($ARGV[0]) ){ die $usage; }
|
||||
|
||||
while( my $filename = shift )
|
||||
{
|
||||
print STDERR "$filename... ";
|
||||
|
||||
if( dir($filename)->parent eq $lib_include_dir ||
|
||||
dir($filename)->parent eq $lib_source_dir )
|
||||
{
|
||||
die "Script cannot be executed on the mbed TLS library itself.";
|
||||
}
|
||||
|
||||
if( -d $filename ) { print STDERR "skip (directory)\n"; next }
|
||||
|
||||
open my $rfh, '<', $filename or die;
|
||||
my @lines = <$rfh>;
|
||||
close $rfh or die;
|
||||
|
||||
my @out;
|
||||
for my $line (@lines) {
|
||||
if( $line =~ /#include/ ) {
|
||||
$line =~ s/polarssl/mbedtls/;
|
||||
$line =~ s/POLARSSL/MBEDTLS/;
|
||||
push( @out, $line );
|
||||
next;
|
||||
}
|
||||
|
||||
my @words = ($line =~ /$token/g);
|
||||
my $checkline = join '', @words;
|
||||
if( $checkline eq $line ) {
|
||||
my @new = map { exists $subst{$_} ? $subst{$_} : $_ } @words;
|
||||
push( @out, join '', @new );
|
||||
} else {
|
||||
$warnings{$filename} = [] unless $warnings{$filename};
|
||||
push @{ $warnings{$filename} }, $line;
|
||||
push( @out, $line );
|
||||
}
|
||||
}
|
||||
|
||||
open my $wfh, '>', $filename or die;
|
||||
print $wfh $_ for @out;
|
||||
close $wfh or die;
|
||||
print STDERR "done\n";
|
||||
}
|
||||
|
||||
if( %warnings ) {
|
||||
print "\nWarning: lines skipped due to unexpected characters:\n";
|
||||
for my $filename (sort keys %warnings) {
|
||||
print "in $filename:\n";
|
||||
print for @{ $warnings{$filename} };
|
||||
}
|
||||
}
|
7
third_party/mbedtls/scripts/rm-calloc-cast.cocci
vendored
Normal file
7
third_party/mbedtls/scripts/rm-calloc-cast.cocci
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
@rm_calloc_cast@
|
||||
expression x, n, m;
|
||||
type T;
|
||||
@@
|
||||
x =
|
||||
- (T *)
|
||||
mbedtls_calloc(n, m)
|
44
third_party/mbedtls/scripts/tmp_ignore_makefiles.sh
vendored
Executable file
44
third_party/mbedtls/scripts/tmp_ignore_makefiles.sh
vendored
Executable file
@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Temporarily (de)ignore Makefiles generated by CMake to allow easier
|
||||
# git development
|
||||
|
||||
IGNORE=""
|
||||
|
||||
# Parse arguments
|
||||
#
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
case "$1" in
|
||||
-u|--undo)
|
||||
IGNORE="0"
|
||||
;;
|
||||
-v|--verbose)
|
||||
# Be verbose
|
||||
VERBOSE="1"
|
||||
;;
|
||||
-h|--help)
|
||||
# print help
|
||||
echo "Usage: $0"
|
||||
echo -e " -h|--help\t\tPrint this help."
|
||||
echo -e " -u|--undo\t\tRemove ignores and continue tracking."
|
||||
echo -e " -v|--verbose\t\tVerbose."
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
# print error
|
||||
echo "Unknown argument: '$1'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ "X" = "X$IGNORE" ];
|
||||
then
|
||||
[ $VERBOSE ] && echo "Ignoring Makefiles"
|
||||
git update-index --assume-unchanged Makefile library/Makefile programs/Makefile tests/Makefile
|
||||
else
|
||||
[ $VERBOSE ] && echo "Tracking Makefiles"
|
||||
git update-index --no-assume-unchanged Makefile library/Makefile programs/Makefile tests/Makefile
|
||||
fi
|
Reference in New Issue
Block a user