From 437d6216e21b21501ba19e579aed71b168dbff41 Mon Sep 17 00:00:00 2001 From: Kees Monshouwer Date: Fri, 11 Sep 2015 12:01:02 +0200 Subject: [PATCH] Update mbed TLS to version 2.1.0 (GPL) --- ext/mbedtls/.travis.yml | 15 +- ext/mbedtls/CMakeLists.txt | 14 +- ext/mbedtls/ChangeLog | 51 +++ ext/mbedtls/LICENSE | 341 +----------------- ext/mbedtls/Makefile.am | 2 +- ext/mbedtls/Makefile.dist | 10 +- ext/mbedtls/README.md | 172 +++++++++ ext/mbedtls/README.rst | 157 -------- ext/mbedtls/gpl-2.0.txt | 339 +++++++++++++++++ ext/mbedtls/include/mbedtls/aes.h | 7 +- ext/mbedtls/include/mbedtls/aesni.h | 7 +- ext/mbedtls/include/mbedtls/arc4.h | 7 +- ext/mbedtls/include/mbedtls/asn1.h | 7 +- ext/mbedtls/include/mbedtls/asn1write.h | 7 +- ext/mbedtls/include/mbedtls/base64.h | 7 +- ext/mbedtls/include/mbedtls/bignum.h | 7 +- ext/mbedtls/include/mbedtls/blowfish.h | 7 +- ext/mbedtls/include/mbedtls/bn_mul.h | 11 +- ext/mbedtls/include/mbedtls/camellia.h | 7 +- ext/mbedtls/include/mbedtls/ccm.h | 7 +- ext/mbedtls/include/mbedtls/certs.h | 7 +- ext/mbedtls/include/mbedtls/check_config.h | 12 +- ext/mbedtls/include/mbedtls/cipher.h | 11 +- ext/mbedtls/include/mbedtls/cipher_internal.h | 7 +- ext/mbedtls/include/mbedtls/compat-1.3.h | 9 +- ext/mbedtls/include/mbedtls/ctr_drbg.h | 7 +- ext/mbedtls/include/mbedtls/debug.h | 7 +- ext/mbedtls/include/mbedtls/des.h | 7 +- ext/mbedtls/include/mbedtls/dhm.h | 7 +- ext/mbedtls/include/mbedtls/ecdh.h | 7 +- ext/mbedtls/include/mbedtls/ecdsa.h | 7 +- ext/mbedtls/include/mbedtls/ecp.h | 7 +- ext/mbedtls/include/mbedtls/entropy.h | 7 +- ext/mbedtls/include/mbedtls/entropy_poll.h | 7 +- ext/mbedtls/include/mbedtls/error.h | 7 +- ext/mbedtls/include/mbedtls/gcm.h | 7 +- ext/mbedtls/include/mbedtls/havege.h | 7 +- ext/mbedtls/include/mbedtls/hmac_drbg.h | 7 +- ext/mbedtls/include/mbedtls/md.h | 7 +- ext/mbedtls/include/mbedtls/md2.h | 7 +- ext/mbedtls/include/mbedtls/md4.h | 7 +- ext/mbedtls/include/mbedtls/md5.h | 7 +- ext/mbedtls/include/mbedtls/md_internal.h | 5 +- .../include/mbedtls/memory_buffer_alloc.h | 7 +- ext/mbedtls/include/mbedtls/net.h | 7 +- ext/mbedtls/include/mbedtls/oid.h | 7 +- ext/mbedtls/include/mbedtls/padlock.h | 17 +- ext/mbedtls/include/mbedtls/pem.h | 7 +- ext/mbedtls/include/mbedtls/pk.h | 7 +- ext/mbedtls/include/mbedtls/pk_internal.h | 7 +- ext/mbedtls/include/mbedtls/pkcs11.h | 7 +- ext/mbedtls/include/mbedtls/pkcs12.h | 7 +- ext/mbedtls/include/mbedtls/pkcs5.h | 7 +- ext/mbedtls/include/mbedtls/platform.h | 7 +- ext/mbedtls/include/mbedtls/ripemd160.h | 7 +- ext/mbedtls/include/mbedtls/rsa.h | 7 +- ext/mbedtls/include/mbedtls/sha1.h | 7 +- ext/mbedtls/include/mbedtls/sha256.h | 7 +- ext/mbedtls/include/mbedtls/sha512.h | 7 +- ext/mbedtls/include/mbedtls/ssl.h | 52 ++- ext/mbedtls/include/mbedtls/ssl_cache.h | 7 +- .../include/mbedtls/ssl_ciphersuites.h | 7 +- ext/mbedtls/include/mbedtls/ssl_cookie.h | 7 +- ext/mbedtls/include/mbedtls/ssl_internal.h | 7 +- ext/mbedtls/include/mbedtls/ssl_ticket.h | 7 +- ext/mbedtls/include/mbedtls/threading.h | 7 +- ext/mbedtls/include/mbedtls/timing.h | 7 +- ext/mbedtls/include/mbedtls/version.h | 15 +- ext/mbedtls/include/mbedtls/x509.h | 7 +- ext/mbedtls/include/mbedtls/x509_crl.h | 7 +- ext/mbedtls/include/mbedtls/x509_crt.h | 7 +- ext/mbedtls/include/mbedtls/x509_csr.h | 7 +- ext/mbedtls/include/mbedtls/xtea.h | 7 +- ext/mbedtls/library/CMakeLists.txt | 8 +- ext/mbedtls/library/Makefile.dist | 18 +- ext/mbedtls/library/aes.c | 7 +- ext/mbedtls/library/aesni.c | 7 +- ext/mbedtls/library/arc4.c | 7 +- ext/mbedtls/library/asn1parse.c | 7 +- ext/mbedtls/library/asn1write.c | 7 +- ext/mbedtls/library/base64.c | 7 +- ext/mbedtls/library/bignum.c | 7 +- ext/mbedtls/library/blowfish.c | 7 +- ext/mbedtls/library/camellia.c | 7 +- ext/mbedtls/library/ccm.c | 7 +- ext/mbedtls/library/certs.c | 7 +- ext/mbedtls/library/cipher.c | 7 +- ext/mbedtls/library/cipher_wrap.c | 7 +- ext/mbedtls/library/ctr_drbg.c | 7 +- ext/mbedtls/library/debug.c | 56 ++- ext/mbedtls/library/des.c | 7 +- ext/mbedtls/library/dhm.c | 7 +- ext/mbedtls/library/ecdh.c | 7 +- ext/mbedtls/library/ecdsa.c | 7 +- ext/mbedtls/library/ecp.c | 7 +- ext/mbedtls/library/ecp_curves.c | 7 +- ext/mbedtls/library/entropy.c | 7 +- ext/mbedtls/library/entropy_poll.c | 13 +- ext/mbedtls/library/error.c | 7 +- ext/mbedtls/library/gcm.c | 7 +- ext/mbedtls/library/havege.c | 7 +- ext/mbedtls/library/hmac_drbg.c | 12 +- ext/mbedtls/library/md.c | 7 +- ext/mbedtls/library/md2.c | 11 +- ext/mbedtls/library/md4.c | 11 +- ext/mbedtls/library/md5.c | 11 +- ext/mbedtls/library/md_wrap.c | 9 +- ext/mbedtls/library/memory_buffer_alloc.c | 7 +- ext/mbedtls/library/net.c | 7 +- ext/mbedtls/library/oid.c | 7 +- ext/mbedtls/library/padlock.c | 7 +- ext/mbedtls/library/pem.c | 9 +- ext/mbedtls/library/pk.c | 7 +- ext/mbedtls/library/pk_wrap.c | 7 +- ext/mbedtls/library/pkcs11.c | 7 +- ext/mbedtls/library/pkcs12.c | 7 +- ext/mbedtls/library/pkcs5.c | 7 +- ext/mbedtls/library/pkparse.c | 7 +- ext/mbedtls/library/pkwrite.c | 7 +- ext/mbedtls/library/platform.c | 7 +- ext/mbedtls/library/ripemd160.c | 7 +- ext/mbedtls/library/rsa.c | 96 ++--- ext/mbedtls/library/sha1.c | 11 +- ext/mbedtls/library/sha256.c | 11 +- ext/mbedtls/library/sha512.c | 11 +- ext/mbedtls/library/ssl_cache.c | 7 +- ext/mbedtls/library/ssl_ciphersuites.c | 7 +- ext/mbedtls/library/ssl_cli.c | 33 +- ext/mbedtls/library/ssl_cookie.c | 7 +- ext/mbedtls/library/ssl_srv.c | 16 +- ext/mbedtls/library/ssl_ticket.c | 7 +- ext/mbedtls/library/ssl_tls.c | 104 ++++-- ext/mbedtls/library/threading.c | 7 +- ext/mbedtls/library/timing.c | 23 +- ext/mbedtls/library/version.c | 7 +- ext/mbedtls/library/version_features.c | 7 +- ext/mbedtls/library/x509.c | 9 +- ext/mbedtls/library/x509_create.c | 7 +- ext/mbedtls/library/x509_crl.c | 7 +- ext/mbedtls/library/x509_crt.c | 80 +++- ext/mbedtls/library/x509_csr.c | 7 +- ext/mbedtls/library/x509write_crt.c | 7 +- ext/mbedtls/library/x509write_csr.c | 7 +- ext/mbedtls/library/xtea.c | 7 +- 144 files changed, 1453 insertions(+), 1081 deletions(-) create mode 100644 ext/mbedtls/README.md delete mode 100644 ext/mbedtls/README.rst create mode 100644 ext/mbedtls/gpl-2.0.txt diff --git a/ext/mbedtls/.travis.yml b/ext/mbedtls/.travis.yml index a7b9a32ea..1259152ad 100644 --- a/ext/mbedtls/.travis.yml +++ b/ext/mbedtls/.travis.yml @@ -2,15 +2,21 @@ language: c compiler: - clang - gcc -before_install: sudo apt-get update -install: sudo apt-get install valgrind perl +sudo: false +cache: ccache script: +- tests/scripts/recursion.pl library/*.c +- tests/scripts/check-generated-files.sh +- tests/scripts/check-doxy-blocks.pl +- tests/scripts/check-names.sh - cmake -D CMAKE_BUILD_TYPE:String="Check" . - make - make test -- tests/compat.sh -- tests/ssl-opt.sh +- programs/test/selftest +- OSSL_NO_DTLS=1 tests/compat.sh +- tests/ssl-opt.sh -e '\(DTLS\|SCSV\).*openssl' - tests/scripts/test-ref-configs.pl +- tests/scripts/curves.pl env: global: secure: "barHldniAfXyoWOD/vcO+E6/Xm4fmcaUoC9BeKW+LwsHqlDMLvugaJnmLXkSpkbYhVL61Hzf3bo0KPJn88AFc5Rkf8oYHPjH4adMnVXkf3B9ghHCgznqHsAH3choo6tnPxaFgOwOYmLGb382nQxfE5lUdvnM/W/psQjWt66A1+k=" @@ -19,7 +25,6 @@ addons: coverity_scan: project: name: "ARMmbed/mbedtls" - description: "mbed TLS Open Source SSL Library" notification_email: p.j.bakker@polarssl.org build_command_prepend: build_command: make diff --git a/ext/mbedtls/CMakeLists.txt b/ext/mbedtls/CMakeLists.txt index 1f556f39d..094d9069b 100644 --- a/ext/mbedtls/CMakeLists.txt +++ b/ext/mbedtls/CMakeLists.txt @@ -21,7 +21,17 @@ set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} string(REGEX MATCH "Clang" CMAKE_COMPILER_IS_CLANG "${CMAKE_C_COMPILER_ID}") if(CMAKE_COMPILER_IS_GNUCC) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -W -Wdeclaration-after-statement -Wwrite-strings -Wlogical-op") + # some warnings we want are not available with old GCC versions + # note: starting with CMake 2.8 we could use CMAKE_C_COMPILER_VERSION + execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion + OUTPUT_VARIABLE GCC_VERSION) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -W -Wdeclaration-after-statement -Wwrite-strings") + if (GCC_VERSION VERSION_GREATER 4.5 OR GCC_VERSION VERSION_EQUAL 4.5) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wlogical-op") + endif() + if (GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wshadow") + endif() set(CMAKE_C_FLAGS_RELEASE "-O2") set(CMAKE_C_FLAGS_DEBUG "-O0 -g3") set(CMAKE_C_FLAGS_COVERAGE "-O0 -g3 --coverage") @@ -32,7 +42,7 @@ if(CMAKE_COMPILER_IS_GNUCC) endif(CMAKE_COMPILER_IS_GNUCC) if(CMAKE_COMPILER_IS_CLANG) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -W -Wdeclaration-after-statement -Wwrite-strings -Wpointer-arith") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -W -Wdeclaration-after-statement -Wwrite-strings -Wpointer-arith -Wimplicit-fallthrough -Wshadow") set(CMAKE_C_FLAGS_RELEASE "-O2") set(CMAKE_C_FLAGS_DEBUG "-O0 -g3") set(CMAKE_C_FLAGS_COVERAGE "-O0 -g3 --coverage") diff --git a/ext/mbedtls/ChangeLog b/ext/mbedtls/ChangeLog index 9b438b130..d3636f00a 100644 --- a/ext/mbedtls/ChangeLog +++ b/ext/mbedtls/ChangeLog @@ -1,5 +1,56 @@ mbed TLS ChangeLog (Sorted per branch, date) += mbed TLS 2.1.0 released 2015-09-04 + +Features + * Added support for yotta as a build system. + * Primary open source license changed to Apache 2.0 license. + +Bugfix + * Fix segfault in the benchmark program when benchmarking DHM. + * Fix build error with CMake and pre-4.5 versions of GCC (found by Hugo + Leisink). + * Fix bug when parsing a ServerHello without extensions (found by David + Sears). + * Fix bug in CMake lists that caused libmbedcrypto.a not to be installed + (found by Benoit Lecocq). + * Fix bug in Makefile that caused libmbedcrypto and libmbedx509 not to be + installed (found by Rawi666). + * Fix compile error with armcc 5 with --gnu option. + * Fix bug in Makefile that caused programs not to be installed correctly + (found by robotanarchy) (#232). + * Fix bug in Makefile that prevented from installing without building the + tests (found by robotanarchy) (#232). + * Fix missing -static-libgcc when building shared libraries for Windows + with make. + * Fix link error when building shared libraries for Windows with make. + * Fix error when loading libmbedtls.so. + * Fix bug in mbedtls_ssl_conf_default() that caused the default preset to + be always used (found by dcb314) (#235) + * Fix bug in mbedtls_rsa_public() and mbedtls_rsa_private() that could + result trying to unlock an unlocked mutex on invalid input (found by + Fredrik Axelsson) (#257) + * Fix -Wshadow warnings (found by hnrkp) (#240) + * Fix memory corruption on client with overlong PSK identity, around + SSL_MAX_CONTENT_LEN or higher - not triggerrable remotely (found by + Aleksandrs Saveljevs) (#238) + * Fix unused function warning when using MBEDTLS_MDx_ALT or + MBEDTLS_SHAxxx_ALT (found by Henrik) (#239) + * Fix memory corruption in pkey programs (found by yankuncheng) (#210) + +Changes + * The PEM parser now accepts a trailing space at end of lines (#226). + * It is now possible to #include a user-provided configuration file at the + end of the default config.h by defining MBEDTLS_USER_CONFIG_FILE on the + compiler's command line. + * When verifying a certificate chain, if an intermediate certificate is + trusted, no later cert is checked. (suggested by hannes-landeholm) + (#220). + * Prepend a "thread identifier" to debug messages (issue pointed out by + Hugo Leisink) (#210). + * Add mbedtls_ssl_get_max_frag_len() to query the current maximum fragment + length. + = mbed TLS 2.0.0 released 2015-07-13 Features diff --git a/ext/mbedtls/LICENSE b/ext/mbedtls/LICENSE index d511905c1..0a95e2963 100644 --- a/ext/mbedtls/LICENSE +++ b/ext/mbedtls/LICENSE @@ -1,339 +1,2 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. +This package of mbed TLS is specifically licensed under the GPL 2.0, +as can be found in: gpl-2.0.txt diff --git a/ext/mbedtls/Makefile.am b/ext/mbedtls/Makefile.am index 409b0efd1..e7adb7bd1 100644 --- a/ext/mbedtls/Makefile.am +++ b/ext/mbedtls/Makefile.am @@ -1,3 +1,3 @@ SUBDIRS = library -EXTRA_DIST = LICENSE README.rst include/mbedtls +EXTRA_DIST = LICENSE README.md include/mbedtls diff --git a/ext/mbedtls/Makefile.dist b/ext/mbedtls/Makefile.dist index 0c489f891..7f03115b0 100644 --- a/ext/mbedtls/Makefile.dist +++ b/ext/mbedtls/Makefile.dist @@ -20,12 +20,14 @@ tests: lib $(MAKE) -C tests ifndef WINDOWS -install: all +install: no_test mkdir -p $(DESTDIR)/include/mbedtls cp -r include/mbedtls $(DESTDIR)/include mkdir -p $(DESTDIR)/lib - cp -RP library/libmbedtls.* $(DESTDIR)/lib + cp -RP library/libmbedtls.* $(DESTDIR)/lib + cp -RP library/libmbedx509.* $(DESTDIR)/lib + cp -RP library/libmbedcrypto.* $(DESTDIR)/lib mkdir -p $(DESTDIR)/bin for p in programs/*/* ; do \ @@ -33,20 +35,20 @@ install: all then \ f=$(PREFIX)`basename $$p` ; \ cp $$p $(DESTDIR)/bin/$$f ; \ - ln -sf $$f $(DESTDIR)/bin/$$o ; \ fi \ done uninstall: rm -rf $(DESTDIR)/include/mbedtls rm -f $(DESTDIR)/lib/libmbedtls.* + rm -f $(DESTDIR)/lib/libmbedx509.* + rm -f $(DESTDIR)/lib/libmbedcrypto.* for p in programs/*/* ; do \ if [ -x $$p ] && [ ! -d $$p ] ; \ then \ f=$(PREFIX)`basename $$p` ; \ rm -f $(DESTDIR)/bin/$$f ; \ - rm -f $(DESTDIR)/bin/$$o ; \ fi \ done endif diff --git a/ext/mbedtls/README.md b/ext/mbedtls/README.md new file mode 100644 index 000000000..79943d10a --- /dev/null +++ b/ext/mbedtls/README.md @@ -0,0 +1,172 @@ +README for mbed TLS +=================== + +Configuration +------------- + +mbed TLS should build out of the box on most systems. Some platform specific options are available in the fully-documented configuration file `include/mbedtls/config.h`, which is also the place where features can be selected. This file can be edited manually, or in a more programmatic way using the Perl script `scripts/config.pl` (use `--help` for usage instructions). + +Compiler options can be set using standard variables such as `CC` and `CFLAGS` when using the Make and CMake build system (see below). + +Compiling +--------- + +There are currently four active build systems within the mbed TLS releases: + +- yotta +- Make +- CMake +- Microsoft Visual Studio (Visual Studio 6 and Visual Studio 2010) + +The main systems used for development are CMake and yotta. Those systems are always complete and up-to-date. The others should reflect all changes present in the CMake and yotta build system, but some features are not ported there by default. + +Please note that the yotta option is slightly different from the other build systems: + +- a more minimalistic configuration file is used by default +- depending on the yotta target, features of mbed OS will be used in examples and tests + +The Make and CMake build systems create three libraries: libmbedcrypto, libmbedx509, and libmbedtls. Note that libmbedtls depends on libmbedx509 and libmbedcrypto, and libmbedx509 depends on libmbedcrypto. As a result, some linkers will expect flags to be in a specific order, for example the GNU linker wants `-lmbedtls -lmbedx509 -lmbedcrypto`. Also, when loading shared libraries using dlopen(), you'll need to load libmbedcrypto first, then libmbedx509, before you can load libmbedtls. + +### Yotta + +[yotta](http://yottabuild.org) is a package manager and build system developped by mbed; it is the build system of mbed OS. To install it on your platform, please follow the yotta [installation instructions](http://docs.yottabuild.org/#installing). + +Once yotta is installed, you can use it to download the latest version of mbed TLS form the yotta registry with: + + yotta install mbedtls + +and build it with: + + yotta build + +If, on the other hand, you already have a copy of mbed TLS from a source other than the yotta registry, for example from cloning our github repository, or from downloading a tarball of the standalone edition, then you'll need first need to generate the yotta module by running: + + yotta/create-module.sh + +from the mbed TLS root directory. This will create the yotta module in the `yotta/module` directory. You can then change to that directory and build as usual: + + cd yotta/module + yotta build + +In any case, you'll probably want to set the yotta target before building unless it's already set globally; for more information on using yotta, please consult the [yotta documentation](http://docs.yottabuild.org/). + +The yotta edition of mbed TLS includes a few example programs, some of which demonstrate integration with mbed OS; for more details, please consult the [Readme at the root of the yotta module](https://github.com/ARMmbed/mbedtls/blob/development/yotta/data/README.md). + +### Make + +We intentionally only use the absolute minimum of `Make` functionality, as a lot of `Make` features are not supported on all different implementations of Make on different platforms. As such, the Makefiles sometimes require some handwork or export statements in order to work for your platform. + +In order to build the source using Make, just enter at the command line: + + make + +In order to run the tests, enter: + + make check + +The tests need Perl to be built and run. If you don't have Perl installed, you can skip buiding the tests with: + + make no_test + +You'll still be able to run a much smaller set of tests with: + + programs/test/selftest + +In order to build for a Windows platform, you should use `WINDOWS_BUILD=1` if the target is Windows but the build environment is Unix-like (for instance when cross-compiling, or compiling from an MSYS shell), and `WINDOWS=1` if the build environment is a Windows shell (for instance using mingw32-make) (in that case some targets will not be available). + +Setting the variable `SHARED` in your environment will build shared libraries in addition to the static libraries. Setting `DEBUG` gives you a debug build. You can override `CFLAGS` and `LDFLAGS` by setting them in your environment or on the make command line; if you do so, essential parts such as `-I` will still be preserved. Warning options may be overridden separately using `WARNING_CFLAGS`. + +Depending on your platform, you might run into some issues. Please check the Makefiles in `library/`, `programs/` and `tests/` for options to manually add or remove for specific platforms. You can also check [the mbed TLS Knowledge Base](https://tls.mbed.org/kb) for articles on your platform or issue. + +In case you find that you need to do something else as well, please let us know what, so we can add it to the KB. + +### CMake + +In order to build the source using CMake, just enter at the command line: + + cmake . + make + +In order to run the tests, enter: + + make test + +The test suites need Perl to be built. If you don't have Perl installed, you'll want to disable the test suites with: + + cmake -DENABLE_TESTING=Off . + +If you disabled the test suites, but kept the programs enabled, you can still run a much smaller set of tests with: + + programs/test/selftest + +To configure CMake for building shared libraries, use: + + cmake -DUSE_SHARED_MBEDTLS_LIBRARY=On . + +There are many different build modes available within the CMake buildsystem. Most of them are available for gcc and clang, though some are compiler-specific: + +- Release. This generates the default code without any unnecessary information in the binary files. +- Debug. This generates debug information and disables optimization of the code. +- Coverage. This generates code coverage information in addition to debug information. +- ASan. This instruments the code with AddressSanitizer to check for memory errors. (This includes LeakSanitizer, with recent version of gcc and clang.) (With recent version of clang, this mode also instruments the code with UndefinedSanitizer to check for undefined behaviour.) +- ASanDbg. Same as ASan but slower, with debug information and better stack traces. +- MemSan. This instruments the code with MemorySanitizer to check for uninitialised memory reads. Experimental, needs recent clang on Linux/x86\_64. +- MemSanDbg. Same as MemSan but slower, with debug information, better stack traces and origin tracking. +- Check. This activates the compiler warnings that depend on optimization and treats all warnings as errors. + +Switching build modes in CMake is simple. For debug mode, enter at the command line: + + cmake -D CMAKE_BUILD_TYPE=Debug . + +To list other available CMake options, use: + + cmake -LH + +Note that, with CMake, if you want to change the compiler or its options after you already ran CMake, you need to clear its cache first, eg (using GNU find): + + find . -iname '*cmake*' -not -name CMakeLists.txt -exec rm -rf {} + + CC=gcc CFLAGS='-fstack-protector-strong -Wa,--noexecstack' cmake . + +### Microsoft Visual Studio + +The build files for Microsoft Visual Studio are generated for Visual Studio 2010. + +The solution file `mbedTLS.sln` contains all the basic projects needed to build the library and all the programs. The files in tests are not generated and compiled, as these need a perl environment as well. However, the selftest program in `programs/test/` is still available. + +Example programs +---------------- + +We've included example programs for a lot of different features and uses in `programs/`. Most programs only focus on a single feature or usage scenario, so keep that in mind when copying parts of the code. + +Tests +----- + +mbed TLS includes an elaborate test suite in `tests/` that initially requires Perl to generate the tests files (e.g. `test\_suite\_mpi.c`). These files are generated from a `function file` (e.g. `suites/test\_suite\_mpi.function`) and a `data file` (e.g. `suites/test\_suite\_mpi.data`). The `function file` contains the test functions. The `data file` contains the test cases, specified as parameters that will be passed to the test function. + +For machines with a Unix shell and OpenSSL (and optionally GnuTLS) installed, additional test scripts are available: + +- `tests/ssl-opt.sh` runs integration tests for various TLS options (renegotiation, resumption, etc.) and tests interoperability of these options with other implementations. +- `tests/compat.sh` tests interoperability of every ciphersuite with other implementations. +- `tests/scripts/test-ref-configs.pl` test builds in various reduced configurations. +- `tests/scripts/all.sh` runs a combination of the above tests, plus some more, with various build options (such as ASan, full `config.h`, etc). + +Configurations +-------------- + +We provide some non-standard configurations focused on specific use cases in the `configs/` directory. You can read more about those in `configs/README.txt` + +Contributing +------------ + +We gratefully accept bug reports and contributions from the community. There are some requirements we need to fulfill in order to be able to integrate contributions: + +- Simple bug fixes to existing code do not contain copyright themselves and we can integrate without issue. The same is true of trivial contributions. +- For larger contributions, such as a new feature, the code can possibly fall under copyright law. We then need your consent to share in the ownership of the copyright. We have a form for this, which we will send to you in case you submit a contribution or pull request that we deem this necessary for. + +### Process + +1. [Check for open issues](https://github.com/ARMmbed/mbedtls/issues) or [start a discussion](https://tls.mbed.org/discussions) around a feature idea or a bug. +2. Fork the [mbed TLS repository on GitHub](https://github.com/ARMmbed/mbedtls) to start making your changes. As a general rule, you should use the "development" branch as a basis. +3. Write a test which shows that the bug was fixed or that the feature works as expected. +4. Send a pull request and bug us until it gets merged and published. We will include your name in the ChangeLog :) + diff --git a/ext/mbedtls/README.rst b/ext/mbedtls/README.rst deleted file mode 100644 index 0d9b614b4..000000000 --- a/ext/mbedtls/README.rst +++ /dev/null @@ -1,157 +0,0 @@ -=================== -README for mbed TLS -=================== - -Configuration -============= - -mbed TLS should build out of the box on most systems. Some platform specific options are available in the fully-documented configuration file *include/mbedtls/config.h*, which is also the place where features can be selected. -This file can be edited manually, or in a more programmatic way using the Perl -script *scripts/config.pl* (use *--help* for usage instructions). - -Compiler options can be set using standard variables such as *CC* and *CFLAGS* when using the Make and CMake build system (see below). - -Compiling -========= - -There are currently three active build systems within the mbed TLS releases: - -- Make -- CMake -- Microsoft Visual Studio (Visual Studio 6 and Visual Studio 2010) - -The main system used for development is CMake. That system is always the most up-to-date. The others should reflect all changes present in the CMake build system, but some features are not ported there by default. - -Make ----- - -We intentionally only use the absolute minimum of **Make** functionality, as we have discovered that a lot of **Make** features are not supported on all different implementations of Make on different platforms. As such, the Makefiles sometimes require some handwork or `export` statements in order to work for your platform. - -In order to build the source using Make, just enter at the command line:: - - make - -In order to run the tests, enter:: - - make check - -The tests need Perl to be built and run. If you don't have Perl installed, you can skip buiding the tests with:: - - make no_test - -You'll still be able to run a much smaller set of tests with:: - - programs/test/selftest - -In order to build for a Windows platform, you should use WINDOWS_BUILD=1 if the target is Windows but the build environment is Unix-like (for instance when cross-compiling, or compiling from an MSYS shell), and WINDOWS=1 if the build environment is a Windows shell (for instance using mingw32-make) (in that case some targets will not be available). - -Setting the variable SHARED in your environment will build a shared library in addition to the static library. Setting DEBUG gives you a debug build. You can override CFLAGS and LDFLAGS by setting them in your environment or on the make command line; if you do so, essential parts such as -I will still be preserved. Warning options may be overridden separately using WARNING_CFLAGS. - -Depending on your platform, you might run into some issues. Please check the Makefiles in *library/*, *programs/* and *tests/* for options to manually add or remove for specific platforms. You can also check `the mbed TLS Knowledge Base `_ for articles on your platform or issue. - -In case you find that you need to do something else as well, please let us know what, so we can add it to the KB. - -CMake ------ - -In order to build the source using CMake, just enter at the command line:: - - cmake . - - make - -The test suites need Perl to be built. If you don't have Perl installed, you'll want to disable the test suites with:: - - cmake -DENABLE_TESTING=Off . - -There are many different build modes available within the CMake buildsystem. Most of them are available for gcc and clang, though some are compiler-specific: - -- Release. - This generates the default code without any unnecessary information in the binary files. -- Debug. - This generates debug information and disables optimization of the code. -- Coverage. - This generates code coverage information in addition to debug information. -- ASan. - This instruments the code with AddressSanitizer to check for memory errors. - (This includes LeakSanitizer, with recent version of gcc and clang.) - (With recent version of clang, this mode also instruments the code with - UndefinedSanitizer to check for undefined behaviour.) -- ASanDbg. - Same as ASan but slower, with debug information and better stack traces. -- MemSan. - This instruments the code with MemorySanitizer to check for uninitialised - memory reads. Experimental, needs recent clang on Linux/x86_64. -- MemSanDbg. - Same as MemSan but slower, with debug information, better stack traces and - origin tracking. -- Check. - This activates the compiler warnings that depend on optimization and treats - all warnings as errors. - -Switching build modes in CMake is simple. For debug mode, enter at the command line: - - cmake -D CMAKE_BUILD_TYPE:String="Debug" . - -Note that, with CMake, if you want to change the compiler or its options after you already ran CMake, you need to clear its cache first, eg (using GNU find):: - - find . -iname '*cmake*' -not -name CMakeLists.txt -exec rm -rf {} + - CC=gcc CFLAGS='-fstack-protector-strong -Wa,--noexecstack' cmake . - -In order to run the tests, enter:: - - make test - -If you disabled the test suites, but kept the progams enabled, you can still run a much smaller set of tests with:: - - programs/test/selftest - -Microsoft Visual Studio ------------------------ - -The build files for Microsoft Visual Studio are generated for Visual Studio 2010. - -The solution file 'mbedTLS.sln' contains all the basic projects needed to build the library and all the programs. The files in tests are not generated and compiled, as these need a perl environment as well. However, the `selftest` program in *programs/test/* is still available. - -Example programs -================ - -We've included example programs for a lot of different features and uses in *programs/*. Most programs only focus on a single feature or usage scenario, so keep that in mind when copying parts of the code. - -Tests -===== - -mbed TLS includes an elaborate test suite in *tests/* that initially requires Perl to generate the tests files (e.g. *test_suite_mpi.c*). These files are generates from a **function file** (e.g. *suites/test_suite_mpi.function*) and a **data file** (e.g. *suites/test_suite_mpi.data*). The **function file** contains the test functions. The **data file** contains the test cases, specified as parameters that will be passed to the test function. - -For machines with a Unix shell and OpenSSL (and optionally GnuTLS) installed, additional test scripts are available: - -- *tests/ssl-opt.sh* runs integration tests for various TLS options (renegotiation, resumption, etc.) and tests interoperability of these options with other implementations. -- *tests/compat.sh* tests interoperability of every ciphersuite with other implementations. -- *tests/scripts/test-ref-configs.pl* test builds in various reduced configurations. -- *tests/scripts/all.sh* runs a combination of the above tests, plus some more, with various build options (such as ASan, full *config.h*, etc). - -Configurations -============== - -We provide some non-standard configurations focused on specific use cases in the configs/ directory. You can read more about those in configs/README.txt - -Contributing -============ - -We graciously accept bugs and contributions from the community. There are some requirements we need to fulfil in order to be able to integrate contributions in the main code. - -Simple bug fixes to existing code do not contain copyright themselves and we can integrate those without any issue. The same goes for trivial contributions. - -For larger contributions, e.g. a new feature, the code possible falls under copyright law. We then need your consent to share in the ownership of the copyright. We have a form for that, which we will mail to you in case you submit a contribution or pull request that we deem this necessary for. - -Process -------- -#. `Check for open issues `_ or - `start a discussion `_ around a feature - idea or a bug. -#. Fork the `mbed TLS repository on Github `_ - to start making your changes. -#. Write a test which shows that the bug was fixed or that the feature works - as expected. -#. Send a pull request and bug us until it gets merged and published. We will - include your name in the ChangeLog :) diff --git a/ext/mbedtls/gpl-2.0.txt b/ext/mbedtls/gpl-2.0.txt new file mode 100644 index 000000000..d159169d1 --- /dev/null +++ b/ext/mbedtls/gpl-2.0.txt @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/ext/mbedtls/include/mbedtls/aes.h b/ext/mbedtls/include/mbedtls/aes.h index fb97c7b75..f139c924d 100644 --- a/ext/mbedtls/include/mbedtls/aes.h +++ b/ext/mbedtls/include/mbedtls/aes.h @@ -3,9 +3,8 @@ * * \brief AES block cipher * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_AES_H #define MBEDTLS_AES_H diff --git a/ext/mbedtls/include/mbedtls/aesni.h b/ext/mbedtls/include/mbedtls/aesni.h index c5a102b2e..937f1e8f7 100644 --- a/ext/mbedtls/include/mbedtls/aesni.h +++ b/ext/mbedtls/include/mbedtls/aesni.h @@ -3,9 +3,8 @@ * * \brief AES-NI for hardware AES acceleration on some Intel processors * - * Copyright (C) 2013, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_AESNI_H #define MBEDTLS_AESNI_H diff --git a/ext/mbedtls/include/mbedtls/arc4.h b/ext/mbedtls/include/mbedtls/arc4.h index da7d97b90..13a0f869d 100644 --- a/ext/mbedtls/include/mbedtls/arc4.h +++ b/ext/mbedtls/include/mbedtls/arc4.h @@ -3,9 +3,8 @@ * * \brief The ARCFOUR stream cipher * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_ARC4_H #define MBEDTLS_ARC4_H diff --git a/ext/mbedtls/include/mbedtls/asn1.h b/ext/mbedtls/include/mbedtls/asn1.h index 675a8eb5c..bc6b48b8d 100644 --- a/ext/mbedtls/include/mbedtls/asn1.h +++ b/ext/mbedtls/include/mbedtls/asn1.h @@ -3,9 +3,8 @@ * * \brief Generic ASN.1 parsing * - * Copyright (C) 2006-2013, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_ASN1_H #define MBEDTLS_ASN1_H diff --git a/ext/mbedtls/include/mbedtls/asn1write.h b/ext/mbedtls/include/mbedtls/asn1write.h index 8bae13674..f37d77a59 100644 --- a/ext/mbedtls/include/mbedtls/asn1write.h +++ b/ext/mbedtls/include/mbedtls/asn1write.h @@ -3,9 +3,8 @@ * * \brief ASN.1 buffer writing functionality * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_ASN1_WRITE_H #define MBEDTLS_ASN1_WRITE_H diff --git a/ext/mbedtls/include/mbedtls/base64.h b/ext/mbedtls/include/mbedtls/base64.h index b7318853d..ab550ab6d 100644 --- a/ext/mbedtls/include/mbedtls/base64.h +++ b/ext/mbedtls/include/mbedtls/base64.h @@ -3,9 +3,8 @@ * * \brief RFC 1521 base64 encoding/decoding * - * Copyright (C) 2006-2013, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_BASE64_H #define MBEDTLS_BASE64_H diff --git a/ext/mbedtls/include/mbedtls/bignum.h b/ext/mbedtls/include/mbedtls/bignum.h index 3c9eeea5b..2ef98c1fa 100644 --- a/ext/mbedtls/include/mbedtls/bignum.h +++ b/ext/mbedtls/include/mbedtls/bignum.h @@ -3,9 +3,8 @@ * * \brief Multi-precision integer library * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_BIGNUM_H #define MBEDTLS_BIGNUM_H diff --git a/ext/mbedtls/include/mbedtls/blowfish.h b/ext/mbedtls/include/mbedtls/blowfish.h index a829d80d9..e0b537b54 100644 --- a/ext/mbedtls/include/mbedtls/blowfish.h +++ b/ext/mbedtls/include/mbedtls/blowfish.h @@ -3,9 +3,8 @@ * * \brief Blowfish block cipher * - * Copyright (C) 2012-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_BLOWFISH_H #define MBEDTLS_BLOWFISH_H diff --git a/ext/mbedtls/include/mbedtls/bn_mul.h b/ext/mbedtls/include/mbedtls/bn_mul.h index 188d7f3bb..03450b55c 100644 --- a/ext/mbedtls/include/mbedtls/bn_mul.h +++ b/ext/mbedtls/include/mbedtls/bn_mul.h @@ -3,9 +3,8 @@ * * \brief Multi-precision integer library * - * Copyright (C) 2006-2010, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * Multiply source vector [s] with b, add result @@ -46,7 +47,9 @@ #define asm __asm #endif -#if defined(__GNUC__) +/* armcc5 --gnu defines __GNUC__ but doesn't support GNU's extended asm */ +#if defined(__GNUC__) && \ + ( !defined(__ARMCC_VERSION) || __ARMCC_VERSION >= 6000000 ) #if defined(__i386__) #define MULADDC_INIT \ diff --git a/ext/mbedtls/include/mbedtls/camellia.h b/ext/mbedtls/include/mbedtls/camellia.h index 37675d11c..b2029813e 100644 --- a/ext/mbedtls/include/mbedtls/camellia.h +++ b/ext/mbedtls/include/mbedtls/camellia.h @@ -3,9 +3,8 @@ * * \brief Camellia block cipher * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_CAMELLIA_H #define MBEDTLS_CAMELLIA_H diff --git a/ext/mbedtls/include/mbedtls/ccm.h b/ext/mbedtls/include/mbedtls/ccm.h index a1dba4fda..39d78fa17 100644 --- a/ext/mbedtls/include/mbedtls/ccm.h +++ b/ext/mbedtls/include/mbedtls/ccm.h @@ -3,9 +3,8 @@ * * \brief Counter with CBC-MAC (CCM) for 128-bit block ciphers * - * Copyright (C) 2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_CCM_H #define MBEDTLS_CCM_H diff --git a/ext/mbedtls/include/mbedtls/certs.h b/ext/mbedtls/include/mbedtls/certs.h index d0aa555c9..cc1bd1ccc 100644 --- a/ext/mbedtls/include/mbedtls/certs.h +++ b/ext/mbedtls/include/mbedtls/certs.h @@ -3,9 +3,8 @@ * * \brief Sample certificates and DHM parameters for testing * - * Copyright (C) 2006-2010, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_CERTS_H #define MBEDTLS_CERTS_H diff --git a/ext/mbedtls/include/mbedtls/check_config.h b/ext/mbedtls/include/mbedtls/check_config.h index 87054c707..9047d4779 100644 --- a/ext/mbedtls/include/mbedtls/check_config.h +++ b/ext/mbedtls/include/mbedtls/check_config.h @@ -3,9 +3,8 @@ * * \brief Consistency checks for configuration options * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* @@ -52,6 +53,11 @@ #endif #endif /* _WIN32 */ +#if defined(TARGET_LIKE_MBED) && \ + ( defined(MBEDTLS_NET_C) || defined(MBEDTLS_TIMING_C) ) +#error "The NET and TIMING modules are not available for mbed OS - please use the network and timing functions provided by mbed OS" +#endif + #if defined(MBEDTLS_DEPRECATED_WARNING) && \ !defined(__GNUC__) && !defined(__clang__) #error "MBEDTLS_DEPRECATED_WARNING only works with GCC and Clang" diff --git a/ext/mbedtls/include/mbedtls/cipher.h b/ext/mbedtls/include/mbedtls/cipher.h index 7c2d303ad..723f781c8 100644 --- a/ext/mbedtls/include/mbedtls/cipher.h +++ b/ext/mbedtls/include/mbedtls/cipher.h @@ -5,9 +5,8 @@ * * \author Adriaan de Jong * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +21,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_CIPHER_H @@ -368,7 +369,7 @@ static inline int mbedtls_cipher_get_iv_size( const mbedtls_cipher_context_t *ct if( ctx->iv_size != 0 ) return (int) ctx->iv_size; - return ctx->cipher_info->iv_size; + return (int) ctx->cipher_info->iv_size; } /** @@ -416,7 +417,7 @@ static inline int mbedtls_cipher_get_key_bitlen( const mbedtls_cipher_context_t if( NULL == ctx || NULL == ctx->cipher_info ) return MBEDTLS_KEY_LENGTH_NONE; - return ctx->cipher_info->key_bitlen; + return (int) ctx->cipher_info->key_bitlen; } /** diff --git a/ext/mbedtls/include/mbedtls/cipher_internal.h b/ext/mbedtls/include/mbedtls/cipher_internal.h index 587e3eaf0..483090f48 100644 --- a/ext/mbedtls/include/mbedtls/cipher_internal.h +++ b/ext/mbedtls/include/mbedtls/cipher_internal.h @@ -5,9 +5,8 @@ * * \author Adriaan de Jong * - * Copyright (C) 2006-2013, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +21,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_CIPHER_WRAP_H #define MBEDTLS_CIPHER_WRAP_H diff --git a/ext/mbedtls/include/mbedtls/compat-1.3.h b/ext/mbedtls/include/mbedtls/compat-1.3.h index dae63c148..8c4065e28 100644 --- a/ext/mbedtls/include/mbedtls/compat-1.3.h +++ b/ext/mbedtls/include/mbedtls/compat-1.3.h @@ -5,9 +5,8 @@ * * \deprecated Use the new names directly instead * - * Copyright (C) 2015, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +21,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if ! defined(MBEDTLS_DEPRECATED_REMOVED) @@ -1993,7 +1994,7 @@ #define entropy_update_manual mbedtls_entropy_update_manual #define entropy_update_seed_file mbedtls_entropy_update_seed_file #define entropy_write_seed_file mbedtls_entropy_write_seed_file -#define error_strerror mbedtls_error_strerror +#define error_strerror mbedtls_strerror #define f_source_ptr mbedtls_entropy_f_source_ptr #define gcm_auth_decrypt mbedtls_gcm_auth_decrypt #define gcm_context mbedtls_gcm_context diff --git a/ext/mbedtls/include/mbedtls/ctr_drbg.h b/ext/mbedtls/include/mbedtls/ctr_drbg.h index cebf43b09..394780a46 100644 --- a/ext/mbedtls/include/mbedtls/ctr_drbg.h +++ b/ext/mbedtls/include/mbedtls/ctr_drbg.h @@ -3,9 +3,8 @@ * * \brief CTR_DRBG based on AES-256 (NIST SP 800-90) * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_CTR_DRBG_H #define MBEDTLS_CTR_DRBG_H diff --git a/ext/mbedtls/include/mbedtls/debug.h b/ext/mbedtls/include/mbedtls/debug.h index 6b44f1f4d..086e7c271 100644 --- a/ext/mbedtls/include/mbedtls/debug.h +++ b/ext/mbedtls/include/mbedtls/debug.h @@ -3,9 +3,8 @@ * * \brief Debug functions * - * Copyright (C) 2006-2011, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_DEBUG_H #define MBEDTLS_DEBUG_H diff --git a/ext/mbedtls/include/mbedtls/des.h b/ext/mbedtls/include/mbedtls/des.h index af89979c8..09e02b5dd 100644 --- a/ext/mbedtls/include/mbedtls/des.h +++ b/ext/mbedtls/include/mbedtls/des.h @@ -3,9 +3,8 @@ * * \brief DES block cipher * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_DES_H #define MBEDTLS_DES_H diff --git a/ext/mbedtls/include/mbedtls/dhm.h b/ext/mbedtls/include/mbedtls/dhm.h index 2de728b4f..438bb401f 100644 --- a/ext/mbedtls/include/mbedtls/dhm.h +++ b/ext/mbedtls/include/mbedtls/dhm.h @@ -3,9 +3,8 @@ * * \brief Diffie-Hellman-Merkle key exchange * - * Copyright (C) 2006-2013, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_DHM_H #define MBEDTLS_DHM_H diff --git a/ext/mbedtls/include/mbedtls/ecdh.h b/ext/mbedtls/include/mbedtls/ecdh.h index 53eb8d355..5894ef551 100644 --- a/ext/mbedtls/include/mbedtls/ecdh.h +++ b/ext/mbedtls/include/mbedtls/ecdh.h @@ -3,9 +3,8 @@ * * \brief Elliptic curve Diffie-Hellman * - * Copyright (C) 2006-2013, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_ECDH_H #define MBEDTLS_ECDH_H diff --git a/ext/mbedtls/include/mbedtls/ecdsa.h b/ext/mbedtls/include/mbedtls/ecdsa.h index 82921b324..ca3e2291a 100644 --- a/ext/mbedtls/include/mbedtls/ecdsa.h +++ b/ext/mbedtls/include/mbedtls/ecdsa.h @@ -3,9 +3,8 @@ * * \brief Elliptic curve DSA * - * Copyright (C) 2006-2013, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_ECDSA_H #define MBEDTLS_ECDSA_H diff --git a/ext/mbedtls/include/mbedtls/ecp.h b/ext/mbedtls/include/mbedtls/ecp.h index 2009a364a..e8335012a 100644 --- a/ext/mbedtls/include/mbedtls/ecp.h +++ b/ext/mbedtls/include/mbedtls/ecp.h @@ -3,9 +3,8 @@ * * \brief Elliptic curves over GF(p) * - * Copyright (C) 2006-2013, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_ECP_H #define MBEDTLS_ECP_H diff --git a/ext/mbedtls/include/mbedtls/entropy.h b/ext/mbedtls/include/mbedtls/entropy.h index 597f03d0b..cb8a8c3ab 100644 --- a/ext/mbedtls/include/mbedtls/entropy.h +++ b/ext/mbedtls/include/mbedtls/entropy.h @@ -3,9 +3,8 @@ * * \brief Entropy accumulator implementation * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_ENTROPY_H #define MBEDTLS_ENTROPY_H diff --git a/ext/mbedtls/include/mbedtls/entropy_poll.h b/ext/mbedtls/include/mbedtls/entropy_poll.h index 8ee1e1a25..200a5f5ed 100644 --- a/ext/mbedtls/include/mbedtls/entropy_poll.h +++ b/ext/mbedtls/include/mbedtls/entropy_poll.h @@ -3,9 +3,8 @@ * * \brief Platform-specific and custom entropy polling functions * - * Copyright (C) 2006-2011, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_ENTROPY_POLL_H #define MBEDTLS_ENTROPY_POLL_H diff --git a/ext/mbedtls/include/mbedtls/error.h b/ext/mbedtls/include/mbedtls/error.h index 81c358e43..4cc085328 100644 --- a/ext/mbedtls/include/mbedtls/error.h +++ b/ext/mbedtls/include/mbedtls/error.h @@ -3,9 +3,8 @@ * * \brief Error to string translation * - * Copyright (C) 2006-2013, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_ERROR_H #define MBEDTLS_ERROR_H diff --git a/ext/mbedtls/include/mbedtls/gcm.h b/ext/mbedtls/include/mbedtls/gcm.h index c6e9d26c5..40c16a869 100644 --- a/ext/mbedtls/include/mbedtls/gcm.h +++ b/ext/mbedtls/include/mbedtls/gcm.h @@ -3,9 +3,8 @@ * * \brief Galois/Counter mode for 128-bit block ciphers * - * Copyright (C) 2006-2013, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_GCM_H #define MBEDTLS_GCM_H diff --git a/ext/mbedtls/include/mbedtls/havege.h b/ext/mbedtls/include/mbedtls/havege.h index 76538e9f9..b97d3a97a 100644 --- a/ext/mbedtls/include/mbedtls/havege.h +++ b/ext/mbedtls/include/mbedtls/havege.h @@ -3,9 +3,8 @@ * * \brief HAVEGE: HArdware Volatile Entropy Gathering and Expansion * - * Copyright (C) 2006-2013, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_HAVEGE_H #define MBEDTLS_HAVEGE_H diff --git a/ext/mbedtls/include/mbedtls/hmac_drbg.h b/ext/mbedtls/include/mbedtls/hmac_drbg.h index eeac3e320..9bcf6f523 100644 --- a/ext/mbedtls/include/mbedtls/hmac_drbg.h +++ b/ext/mbedtls/include/mbedtls/hmac_drbg.h @@ -3,9 +3,8 @@ * * \brief HMAC_DRBG (NIST SP 800-90A) * - * Copyright (C) 2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_HMAC_DRBG_H #define MBEDTLS_HMAC_DRBG_H diff --git a/ext/mbedtls/include/mbedtls/md.h b/ext/mbedtls/include/mbedtls/md.h index 2a6cc0c7b..f83983412 100644 --- a/ext/mbedtls/include/mbedtls/md.h +++ b/ext/mbedtls/include/mbedtls/md.h @@ -6,8 +6,7 @@ * \author Adriaan de Jong * * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +21,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_MD_H #define MBEDTLS_MD_H @@ -154,7 +155,7 @@ int mbedtls_md_init_ctx( mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_ * * \param ctx Context to set up. * \param md_info Message digest to use. - * \param hmac 0 to save some meory is HMAC will not be use, + * \param hmac 0 to save some memory if HMAC will not be used, * non-zero is HMAC is going to be used with this context. * * \returns \c 0 on success, diff --git a/ext/mbedtls/include/mbedtls/md2.h b/ext/mbedtls/include/mbedtls/md2.h index 151a8f45d..8aa542dea 100644 --- a/ext/mbedtls/include/mbedtls/md2.h +++ b/ext/mbedtls/include/mbedtls/md2.h @@ -3,9 +3,8 @@ * * \brief MD2 message digest algorithm (hash function) * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_MD2_H #define MBEDTLS_MD2_H diff --git a/ext/mbedtls/include/mbedtls/md4.h b/ext/mbedtls/include/mbedtls/md4.h index fd756b91b..76831a470 100644 --- a/ext/mbedtls/include/mbedtls/md4.h +++ b/ext/mbedtls/include/mbedtls/md4.h @@ -3,9 +3,8 @@ * * \brief MD4 message digest algorithm (hash function) * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_MD4_H #define MBEDTLS_MD4_H diff --git a/ext/mbedtls/include/mbedtls/md5.h b/ext/mbedtls/include/mbedtls/md5.h index 40273d480..30b79349c 100644 --- a/ext/mbedtls/include/mbedtls/md5.h +++ b/ext/mbedtls/include/mbedtls/md5.h @@ -3,9 +3,8 @@ * * \brief MD5 message digest algorithm (hash function) * - * Copyright (C) 2006-2013, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_MD5_H #define MBEDTLS_MD5_H diff --git a/ext/mbedtls/include/mbedtls/md_internal.h b/ext/mbedtls/include/mbedtls/md_internal.h index f2a063251..0a8600b40 100644 --- a/ext/mbedtls/include/mbedtls/md_internal.h +++ b/ext/mbedtls/include/mbedtls/md_internal.h @@ -8,8 +8,7 @@ * \author Adriaan de Jong * * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,6 +23,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_MD_WRAP_H #define MBEDTLS_MD_WRAP_H diff --git a/ext/mbedtls/include/mbedtls/memory_buffer_alloc.h b/ext/mbedtls/include/mbedtls/memory_buffer_alloc.h index 5e14823b7..d8875f4a8 100644 --- a/ext/mbedtls/include/mbedtls/memory_buffer_alloc.h +++ b/ext/mbedtls/include/mbedtls/memory_buffer_alloc.h @@ -3,9 +3,8 @@ * * \brief Buffer-based memory allocator * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_MEMORY_BUFFER_ALLOC_H #define MBEDTLS_MEMORY_BUFFER_ALLOC_H diff --git a/ext/mbedtls/include/mbedtls/net.h b/ext/mbedtls/include/mbedtls/net.h index 1c49763ab..8d5f6bd6a 100644 --- a/ext/mbedtls/include/mbedtls/net.h +++ b/ext/mbedtls/include/mbedtls/net.h @@ -3,9 +3,8 @@ * * \brief Network communication functions * - * Copyright (C) 2006-2011, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_NET_H #define MBEDTLS_NET_H diff --git a/ext/mbedtls/include/mbedtls/oid.h b/ext/mbedtls/include/mbedtls/oid.h index 02921c41c..117ee4756 100644 --- a/ext/mbedtls/include/mbedtls/oid.h +++ b/ext/mbedtls/include/mbedtls/oid.h @@ -3,9 +3,8 @@ * * \brief Object Identifier (OID) database * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_OID_H #define MBEDTLS_OID_H diff --git a/ext/mbedtls/include/mbedtls/padlock.h b/ext/mbedtls/include/mbedtls/padlock.h index 6ef0d5a5e..0a5ebf726 100644 --- a/ext/mbedtls/include/mbedtls/padlock.h +++ b/ext/mbedtls/include/mbedtls/padlock.h @@ -4,9 +4,8 @@ * \brief VIA PadLock ACE for HW encryption/decryption supported by some * processors * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,6 +20,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PADLOCK_H #define MBEDTLS_PADLOCK_H @@ -29,7 +30,15 @@ #define MBEDTLS_ERR_PADLOCK_DATA_MISALIGNED -0x0030 /**< Input data should be aligned. */ -#if defined(MBEDTLS_HAVE_ASM) && defined(__GNUC__) && defined(__i386__) +#if defined(__has_feature) +#if __has_feature(address_sanitizer) +#define MBEDTLS_HAVE_ASAN +#endif +#endif + +/* Some versions of ASan result in errors about not enough registers */ +#if defined(MBEDTLS_HAVE_ASM) && defined(__GNUC__) && defined(__i386__) && \ + !defined(MBEDTLS_HAVE_ASAN) #ifndef MBEDTLS_HAVE_X86 #define MBEDTLS_HAVE_X86 diff --git a/ext/mbedtls/include/mbedtls/pem.h b/ext/mbedtls/include/mbedtls/pem.h index 8a5ed9079..fed5452d6 100644 --- a/ext/mbedtls/include/mbedtls/pem.h +++ b/ext/mbedtls/include/mbedtls/pem.h @@ -3,9 +3,8 @@ * * \brief Privacy Enhanced Mail (PEM) decoding * - * Copyright (C) 2006-2013, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PEM_H #define MBEDTLS_PEM_H diff --git a/ext/mbedtls/include/mbedtls/pk.h b/ext/mbedtls/include/mbedtls/pk.h index 1e2a29343..c92c5d05a 100644 --- a/ext/mbedtls/include/mbedtls/pk.h +++ b/ext/mbedtls/include/mbedtls/pk.h @@ -3,9 +3,8 @@ * * \brief Public Key abstraction layer * - * Copyright (C) 2006-2013, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PK_H diff --git a/ext/mbedtls/include/mbedtls/pk_internal.h b/ext/mbedtls/include/mbedtls/pk_internal.h index f2e0a772b..9eebaabe0 100644 --- a/ext/mbedtls/include/mbedtls/pk_internal.h +++ b/ext/mbedtls/include/mbedtls/pk_internal.h @@ -3,9 +3,8 @@ * * \brief Public Key abstraction layer: wrapper functions * - * Copyright (C) 2006-2013, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PK_WRAP_H diff --git a/ext/mbedtls/include/mbedtls/pkcs11.h b/ext/mbedtls/include/mbedtls/pkcs11.h index 05def7be9..8539f40cc 100644 --- a/ext/mbedtls/include/mbedtls/pkcs11.h +++ b/ext/mbedtls/include/mbedtls/pkcs11.h @@ -5,9 +5,8 @@ * * \author Adriaan de Jong * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +21,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PKCS11_H #define MBEDTLS_PKCS11_H diff --git a/ext/mbedtls/include/mbedtls/pkcs12.h b/ext/mbedtls/include/mbedtls/pkcs12.h index c5085da32..ea008c56b 100644 --- a/ext/mbedtls/include/mbedtls/pkcs12.h +++ b/ext/mbedtls/include/mbedtls/pkcs12.h @@ -3,9 +3,8 @@ * * \brief PKCS#12 Personal Information Exchange Syntax * - * Copyright (C) 2006-2013, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PKCS12_H #define MBEDTLS_PKCS12_H diff --git a/ext/mbedtls/include/mbedtls/pkcs5.h b/ext/mbedtls/include/mbedtls/pkcs5.h index cfd42a2f6..9378ca689 100644 --- a/ext/mbedtls/include/mbedtls/pkcs5.h +++ b/ext/mbedtls/include/mbedtls/pkcs5.h @@ -5,9 +5,8 @@ * * \author Mathias Olsson * - * Copyright (C) 2006-2013, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +21,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PKCS5_H #define MBEDTLS_PKCS5_H diff --git a/ext/mbedtls/include/mbedtls/platform.h b/ext/mbedtls/include/mbedtls/platform.h index 5dab974fd..c86d40956 100644 --- a/ext/mbedtls/include/mbedtls/platform.h +++ b/ext/mbedtls/include/mbedtls/platform.h @@ -3,9 +3,8 @@ * * \brief mbed TLS Platform abstraction layer * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PLATFORM_H #define MBEDTLS_PLATFORM_H diff --git a/ext/mbedtls/include/mbedtls/ripemd160.h b/ext/mbedtls/include/mbedtls/ripemd160.h index 9013f208e..b901a00f2 100644 --- a/ext/mbedtls/include/mbedtls/ripemd160.h +++ b/ext/mbedtls/include/mbedtls/ripemd160.h @@ -3,9 +3,8 @@ * * \brief RIPE MD-160 message digest * - * Copyright (C) 2014-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_RIPEMD160_H #define MBEDTLS_RIPEMD160_H diff --git a/ext/mbedtls/include/mbedtls/rsa.h b/ext/mbedtls/include/mbedtls/rsa.h index 3898687e0..b48eb49ae 100644 --- a/ext/mbedtls/include/mbedtls/rsa.h +++ b/ext/mbedtls/include/mbedtls/rsa.h @@ -3,9 +3,8 @@ * * \brief The RSA public-key cryptosystem * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_RSA_H #define MBEDTLS_RSA_H diff --git a/ext/mbedtls/include/mbedtls/sha1.h b/ext/mbedtls/include/mbedtls/sha1.h index e8bd65e38..e01b94fa5 100644 --- a/ext/mbedtls/include/mbedtls/sha1.h +++ b/ext/mbedtls/include/mbedtls/sha1.h @@ -3,9 +3,8 @@ * * \brief SHA-1 cryptographic hash function * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SHA1_H #define MBEDTLS_SHA1_H diff --git a/ext/mbedtls/include/mbedtls/sha256.h b/ext/mbedtls/include/mbedtls/sha256.h index 0dbc4b256..3f1f1fb7f 100644 --- a/ext/mbedtls/include/mbedtls/sha256.h +++ b/ext/mbedtls/include/mbedtls/sha256.h @@ -3,9 +3,8 @@ * * \brief SHA-224 and SHA-256 cryptographic hash function * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SHA256_H #define MBEDTLS_SHA256_H diff --git a/ext/mbedtls/include/mbedtls/sha512.h b/ext/mbedtls/include/mbedtls/sha512.h index 7e1bc1e33..72262f34b 100644 --- a/ext/mbedtls/include/mbedtls/sha512.h +++ b/ext/mbedtls/include/mbedtls/sha512.h @@ -3,9 +3,8 @@ * * \brief SHA-384 and SHA-512 cryptographic hash function * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SHA512_H #define MBEDTLS_SHA512_H diff --git a/ext/mbedtls/include/mbedtls/ssl.h b/ext/mbedtls/include/mbedtls/ssl.h index b7e361a72..ff2d77986 100644 --- a/ext/mbedtls/include/mbedtls/ssl.h +++ b/ext/mbedtls/include/mbedtls/ssl.h @@ -3,9 +3,8 @@ * * \brief SSL/TLS functions. * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SSL_H #define MBEDTLS_SSL_H @@ -220,7 +221,9 @@ #endif /* - * Size of the input / output buffer. + * Maxium fragment length in bytes, + * determines the size of each of the two internal I/O buffers. + * * Note: the RFC defines the default size of SSL / TLS messages. If you * change the value here, other clients / servers may not be able to * communicate with you anymore. Only change this value if you control @@ -2025,6 +2028,26 @@ const char *mbedtls_ssl_get_version( const mbedtls_ssl_context *ssl ); */ int mbedtls_ssl_get_record_expansion( const mbedtls_ssl_context *ssl ); +#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH) +/** + * \brief Return the maximum fragment length (payload, in bytes). + * This is the value negotiated with peer if any, + * or the locally configured value. + * + * \note With DTLS, \c mbedtls_ssl_write() will return an error if + * called with a larger length value. + * With TLS, \c mbedtls_ssl_write() will fragment the input if + * necessary and return the number of bytes written; it is up + * to the caller to call \c mbedtls_ssl_write() again in + * order to send the remaining bytes if any. + * + * \param ssl SSL context + * + * \return Current maximum fragment length. + */ +size_t mbedtls_ssl_get_max_frag_len( const mbedtls_ssl_context *ssl ); +#endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */ + #if defined(MBEDTLS_X509_CRT_PARSE_C) /** * \brief Return the peer certificate from the current connection @@ -2122,26 +2145,33 @@ int mbedtls_ssl_renegotiate( mbedtls_ssl_context *ssl ); int mbedtls_ssl_read( mbedtls_ssl_context *ssl, unsigned char *buf, size_t len ); /** - * \brief Write exactly 'len' application data bytes + * \brief Try to write exactly 'len' application data bytes + * + * \warning This function will do partial writes in some cases. If the + * return value is non-negative but less than length, the + * function must be called again with updated arguments: + * buf + ret, len - ret (if ret is the return value) until + * it returns a value equal to the last 'len' argument. * * \param ssl SSL context * \param buf buffer holding the data * \param len how many bytes must be written * - * \return the number of bytes written, - * or a negative error code. + * \return the number of bytes actually written (may be less than len), + * or MBEDTLS_ERR_SSL_WANT_WRITE of MBEDTLS_ERR_SSL_WANT_READ, + * or another negative error code. * - * \note When this function returns MBEDTLS_ERR_SSL_WANT_WRITE, + * \note When this function returns MBEDTLS_ERR_SSL_WANT_WRITE/READ, * it must be called later with the *same* arguments, * until it returns a positive value. * * \note If the requested length is greater than the maximum * fragment length (either the built-in limit or the one set * or negotiated with the peer), then: - * - with TLS, less bytes than requested are written. (In - * order to write larger messages, this function should be - * called in a loop.) + * - with TLS, less bytes than requested are written. * - with DTLS, MBEDTLS_ERR_SSL_BAD_INPUT_DATA is returned. + * \c mbedtls_ssl_get_max_frag_len() may be used to query the + * active maximum fragment length. */ int mbedtls_ssl_write( mbedtls_ssl_context *ssl, const unsigned char *buf, size_t len ); diff --git a/ext/mbedtls/include/mbedtls/ssl_cache.h b/ext/mbedtls/include/mbedtls/ssl_cache.h index a92a1fa04..a03d447e3 100644 --- a/ext/mbedtls/include/mbedtls/ssl_cache.h +++ b/ext/mbedtls/include/mbedtls/ssl_cache.h @@ -3,9 +3,8 @@ * * \brief SSL session cache implementation * - * Copyright (C) 2006-2013, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SSL_CACHE_H #define MBEDTLS_SSL_CACHE_H diff --git a/ext/mbedtls/include/mbedtls/ssl_ciphersuites.h b/ext/mbedtls/include/mbedtls/ssl_ciphersuites.h index 86df418b1..c943eabb5 100644 --- a/ext/mbedtls/include/mbedtls/ssl_ciphersuites.h +++ b/ext/mbedtls/include/mbedtls/ssl_ciphersuites.h @@ -3,9 +3,8 @@ * * \brief SSL Ciphersuites for mbed TLS * - * Copyright (C) 2006-2013, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SSL_CIPHERSUITES_H #define MBEDTLS_SSL_CIPHERSUITES_H diff --git a/ext/mbedtls/include/mbedtls/ssl_cookie.h b/ext/mbedtls/include/mbedtls/ssl_cookie.h index 395768b58..36a542e85 100644 --- a/ext/mbedtls/include/mbedtls/ssl_cookie.h +++ b/ext/mbedtls/include/mbedtls/ssl_cookie.h @@ -3,9 +3,8 @@ * * \brief DTLS cookie callbacks implementation * - * Copyright (C) 2014-2015, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SSL_COOKIE_H #define MBEDTLS_SSL_COOKIE_H diff --git a/ext/mbedtls/include/mbedtls/ssl_internal.h b/ext/mbedtls/include/mbedtls/ssl_internal.h index da81f56e6..95146ad26 100644 --- a/ext/mbedtls/include/mbedtls/ssl_internal.h +++ b/ext/mbedtls/include/mbedtls/ssl_internal.h @@ -3,9 +3,8 @@ * * \brief Internal functions shared by the SSL modules * - * Copyright (C) 2015, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SSL_INTERNAL_H #define MBEDTLS_SSL_INTERNAL_H diff --git a/ext/mbedtls/include/mbedtls/ssl_ticket.h b/ext/mbedtls/include/mbedtls/ssl_ticket.h index abce61e36..c8b07d5b9 100644 --- a/ext/mbedtls/include/mbedtls/ssl_ticket.h +++ b/ext/mbedtls/include/mbedtls/ssl_ticket.h @@ -3,9 +3,8 @@ * * \brief TLS server ticket callbacks implementation * - * Copyright (C) 2015, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SSL_TICKET_H #define MBEDTLS_SSL_TICKET_H diff --git a/ext/mbedtls/include/mbedtls/threading.h b/ext/mbedtls/include/mbedtls/threading.h index ed355e68d..6d0249873 100644 --- a/ext/mbedtls/include/mbedtls/threading.h +++ b/ext/mbedtls/include/mbedtls/threading.h @@ -3,9 +3,8 @@ * * \brief Threading abstraction layer * - * Copyright (C) 2006-2013, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_THREADING_H #define MBEDTLS_THREADING_H diff --git a/ext/mbedtls/include/mbedtls/timing.h b/ext/mbedtls/include/mbedtls/timing.h index 75b6734f0..78de0633b 100644 --- a/ext/mbedtls/include/mbedtls/timing.h +++ b/ext/mbedtls/include/mbedtls/timing.h @@ -3,9 +3,8 @@ * * \brief Portable interface to the CPU cycle counter * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_TIMING_H #define MBEDTLS_TIMING_H diff --git a/ext/mbedtls/include/mbedtls/version.h b/ext/mbedtls/include/mbedtls/version.h index 75bddb1f6..19e646a9c 100644 --- a/ext/mbedtls/include/mbedtls/version.h +++ b/ext/mbedtls/include/mbedtls/version.h @@ -3,9 +3,8 @@ * * \brief Run-time version information * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * This set of compile-time defines and run-time variables can be used to @@ -39,7 +40,7 @@ * Major, Minor, Patchlevel */ #define MBEDTLS_VERSION_MAJOR 2 -#define MBEDTLS_VERSION_MINOR 0 +#define MBEDTLS_VERSION_MINOR 1 #define MBEDTLS_VERSION_PATCH 0 /** @@ -47,9 +48,9 @@ * MMNNPP00 * Major version | Minor version | Patch version */ -#define MBEDTLS_VERSION_NUMBER 0x02000000 -#define MBEDTLS_VERSION_STRING "2.0.0" -#define MBEDTLS_VERSION_STRING_FULL "mbed TLS 2.0.0" +#define MBEDTLS_VERSION_NUMBER 0x02010000 +#define MBEDTLS_VERSION_STRING "2.1.0" +#define MBEDTLS_VERSION_STRING_FULL "mbed TLS 2.1.0" #if defined(MBEDTLS_VERSION_C) diff --git a/ext/mbedtls/include/mbedtls/x509.h b/ext/mbedtls/include/mbedtls/x509.h index cd658c5a8..4aecd0797 100644 --- a/ext/mbedtls/include/mbedtls/x509.h +++ b/ext/mbedtls/include/mbedtls/x509.h @@ -3,9 +3,8 @@ * * \brief X.509 generic defines and structures * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_X509_H #define MBEDTLS_X509_H diff --git a/ext/mbedtls/include/mbedtls/x509_crl.h b/ext/mbedtls/include/mbedtls/x509_crl.h index dbc4642b0..483f0ad78 100644 --- a/ext/mbedtls/include/mbedtls/x509_crl.h +++ b/ext/mbedtls/include/mbedtls/x509_crl.h @@ -3,9 +3,8 @@ * * \brief X.509 certificate revocation list parsing * - * Copyright (C) 2006-2013, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_X509_CRL_H #define MBEDTLS_X509_CRL_H diff --git a/ext/mbedtls/include/mbedtls/x509_crt.h b/ext/mbedtls/include/mbedtls/x509_crt.h index c0abc5205..f423536e5 100644 --- a/ext/mbedtls/include/mbedtls/x509_crt.h +++ b/ext/mbedtls/include/mbedtls/x509_crt.h @@ -3,9 +3,8 @@ * * \brief X.509 certificate parsing and writing * - * Copyright (C) 2006-2013, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_X509_CRT_H #define MBEDTLS_X509_CRT_H diff --git a/ext/mbedtls/include/mbedtls/x509_csr.h b/ext/mbedtls/include/mbedtls/x509_csr.h index 64dd93732..1b536d22a 100644 --- a/ext/mbedtls/include/mbedtls/x509_csr.h +++ b/ext/mbedtls/include/mbedtls/x509_csr.h @@ -3,9 +3,8 @@ * * \brief X.509 certificate signing request parsing and writing * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_X509_CSR_H #define MBEDTLS_X509_CSR_H diff --git a/ext/mbedtls/include/mbedtls/xtea.h b/ext/mbedtls/include/mbedtls/xtea.h index 1417eca03..bd00c90d9 100644 --- a/ext/mbedtls/include/mbedtls/xtea.h +++ b/ext/mbedtls/include/mbedtls/xtea.h @@ -3,9 +3,8 @@ * * \brief XTEA block cipher (32-bit) * - * Copyright (C) 2006-2013, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_XTEA_H #define MBEDTLS_XTEA_H diff --git a/ext/mbedtls/library/CMakeLists.txt b/ext/mbedtls/library/CMakeLists.txt index d2a29c5b3..c458117d4 100644 --- a/ext/mbedtls/library/CMakeLists.txt +++ b/ext/mbedtls/library/CMakeLists.txt @@ -131,22 +131,22 @@ if(USE_STATIC_MBEDTLS_LIBRARY) set_target_properties(${mbedtls_static_target} PROPERTIES OUTPUT_NAME mbedtls) target_link_libraries(${mbedtls_static_target} ${libs} ${mbedx509_static_target}) - install(TARGETS ${mbedtls_static_target} ${mbedx509_static_target} ${mbedcrypt_static_target} + install(TARGETS ${mbedtls_static_target} ${mbedx509_static_target} ${mbedcrypto_static_target} DESTINATION ${LIB_INSTALL_DIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) endif(USE_STATIC_MBEDTLS_LIBRARY) if(USE_SHARED_MBEDTLS_LIBRARY) add_library(mbedcrypto SHARED ${src_crypto}) - set_target_properties(mbedcrypto PROPERTIES VERSION 2.0.0 SOVERSION 0) + set_target_properties(mbedcrypto PROPERTIES VERSION 2.1.0 SOVERSION 0) target_link_libraries(mbedcrypto ${libs}) add_library(mbedx509 SHARED ${src_x509}) - set_target_properties(mbedx509 PROPERTIES VERSION 2.0.0 SOVERSION 0) + set_target_properties(mbedx509 PROPERTIES VERSION 2.1.0 SOVERSION 0) target_link_libraries(mbedx509 ${libs} mbedcrypto) add_library(mbedtls SHARED ${src_tls}) - set_target_properties(mbedtls PROPERTIES VERSION 2.0.0 SOVERSION 10) + set_target_properties(mbedtls PROPERTIES VERSION 2.1.0 SOVERSION 10) target_link_libraries(mbedtls ${libs} mbedx509) install(TARGETS mbedtls mbedx509 mbedcrypto diff --git a/ext/mbedtls/library/Makefile.dist b/ext/mbedtls/library/Makefile.dist index 56d53264d..f72ae8e35 100644 --- a/ext/mbedtls/library/Makefile.dist +++ b/ext/mbedtls/library/Makefile.dist @@ -93,9 +93,9 @@ libmbedtls.a: $(OBJS_TLS) echo " RL $@" $(AR) s $@ -libmbedtls.$(SOEXT_TLS): $(OBJS_TLS) +libmbedtls.$(SOEXT_TLS): $(OBJS_TLS) libmbedx509.so echo " LD $@" - $(CC) -shared -Wl,-soname,$@ $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(OBJS_TLS) + $(CC) -shared -Wl,-soname,$@ -L. -lmbedcrypto -lmbedx509 $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(OBJS_TLS) libmbedtls.so: libmbedtls.$(SOEXT_TLS) echo " LN $@ -> $<" @@ -105,9 +105,9 @@ libmbedtls.dylib: $(OBJS_TLS) echo " LD $@" $(CC) -dynamiclib $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(OBJS_TLS) -libmbedtls.dll: $(OBJS_TLS) +libmbedtls.dll: $(OBJS_TLS) libmbedx509.dll echo " LD $@" - $(CC) -shared -Wl,-soname,$@ -Wl,--out-implib,$@.a -o $@ $(OBJS_TLS) -lws2_32 -lwinmm -lgdi32 $(LOCAL_LDFLAGS) $(LDFLAGS) + $(CC) -shared -Wl,-soname,$@ -Wl,--out-implib,$@.a -o $@ $(OBJS_TLS) -lws2_32 -lwinmm -lgdi32 -L. -lmbedcrypto -lmbedx509 -static-libgcc $(LOCAL_LDFLAGS) $(LDFLAGS) # x509 libmbedx509.a: $(OBJS_X509) @@ -116,9 +116,9 @@ libmbedx509.a: $(OBJS_X509) echo " RL $@" $(AR) s $@ -libmbedx509.$(SOEXT_X509): $(OBJS_X509) +libmbedx509.$(SOEXT_X509): $(OBJS_X509) libmbedcrypto.so echo " LD $@" - $(CC) -shared -Wl,-soname,$@ $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(OBJS_X509) + $(CC) -shared -Wl,-soname,$@ -L. -lmbedcrypto $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(OBJS_X509) libmbedx509.so: libmbedx509.$(SOEXT_X509) echo " LN $@ -> $<" @@ -128,9 +128,9 @@ libmbedx509.dylib: $(OBJS_X509) echo " LD $@" $(CC) -dynamiclib $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(OBJS_X509) -libmbedx509.dll: $(OBJS_X509) +libmbedx509.dll: $(OBJS_X509) libmbedcrypto.dll echo " LD $@" - $(CC) -shared -Wl,-soname,$@ -Wl,--out-implib,$@.a -o $@ $(OBJS_X509) -lws2_32 -lwinmm -lgdi32 $(LOCAL_LDFLAGS) $(LDFLAGS) + $(CC) -shared -Wl,-soname,$@ -Wl,--out-implib,$@.a -o $@ $(OBJS_X509) -lws2_32 -lwinmm -lgdi32 -L. -lmbedcrypto -static-libgcc $(LOCAL_LDFLAGS) $(LDFLAGS) # crypto libmbedcrypto.a: $(OBJS_CRYPTO) @@ -153,7 +153,7 @@ libmbedcrypto.dylib: $(OBJS_CRYPTO) libmbedcrypto.dll: $(OBJS_CRYPTO) echo " LD $@" - $(CC) -shared -Wl,-soname,$@ -Wl,--out-implib,$@.a -o $@ $(OBJS_CRYPTO) -lws2_32 -lwinmm -lgdi32 $(LOCAL_LDFLAGS) $(LDFLAGS) + $(CC) -shared -Wl,-soname,$@ -Wl,--out-implib,$@.a -o $@ $(OBJS_CRYPTO) -lws2_32 -lwinmm -lgdi32 -static-libgcc $(LOCAL_LDFLAGS) $(LDFLAGS) .c.o: echo " CC $<" diff --git a/ext/mbedtls/library/aes.c b/ext/mbedtls/library/aes.c index 559213872..8fdc18920 100644 --- a/ext/mbedtls/library/aes.c +++ b/ext/mbedtls/library/aes.c @@ -1,9 +1,8 @@ /* * FIPS-197 compliant AES implementation * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * The AES block cipher was designed by Vincent Rijmen and Joan Daemen. diff --git a/ext/mbedtls/library/aesni.c b/ext/mbedtls/library/aesni.c index 2165de77e..f43427ce5 100644 --- a/ext/mbedtls/library/aesni.c +++ b/ext/mbedtls/library/aesni.c @@ -1,9 +1,8 @@ /* * AES-NI support functions * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* diff --git a/ext/mbedtls/library/arc4.c b/ext/mbedtls/library/arc4.c index f11b5d66b..e005fb542 100644 --- a/ext/mbedtls/library/arc4.c +++ b/ext/mbedtls/library/arc4.c @@ -1,9 +1,8 @@ /* * An implementation of the ARCFOUR algorithm * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * The ARCFOUR algorithm was publicly disclosed on 94/09. diff --git a/ext/mbedtls/library/asn1parse.c b/ext/mbedtls/library/asn1parse.c index e2c07023e..5e267d0cd 100644 --- a/ext/mbedtls/library/asn1parse.c +++ b/ext/mbedtls/library/asn1parse.c @@ -1,9 +1,8 @@ /* * Generic ASN.1 parsing * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/ext/mbedtls/library/asn1write.c b/ext/mbedtls/library/asn1write.c index f5b1849ea..1c6079c0c 100644 --- a/ext/mbedtls/library/asn1write.c +++ b/ext/mbedtls/library/asn1write.c @@ -1,9 +1,8 @@ /* * ASN.1 buffer writing functionality * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/ext/mbedtls/library/base64.c b/ext/mbedtls/library/base64.c index 4fa434d18..51809e2ae 100644 --- a/ext/mbedtls/library/base64.c +++ b/ext/mbedtls/library/base64.c @@ -1,9 +1,8 @@ /* * RFC 1521 base64 encoding/decoding * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/ext/mbedtls/library/bignum.c b/ext/mbedtls/library/bignum.c index ad0aa2cda..1a658b4c2 100644 --- a/ext/mbedtls/library/bignum.c +++ b/ext/mbedtls/library/bignum.c @@ -1,9 +1,8 @@ /* * Multi-precision integer library * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * This MPI implementation is based on: diff --git a/ext/mbedtls/library/blowfish.c b/ext/mbedtls/library/blowfish.c index 767d141a3..fd3b856e4 100644 --- a/ext/mbedtls/library/blowfish.c +++ b/ext/mbedtls/library/blowfish.c @@ -1,9 +1,8 @@ /* * Blowfish implementation * - * Copyright (C) 2012-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * The Blowfish block cipher was designed by Bruce Schneier in 1993. diff --git a/ext/mbedtls/library/camellia.c b/ext/mbedtls/library/camellia.c index 83e8e78bb..2ed83e13b 100644 --- a/ext/mbedtls/library/camellia.c +++ b/ext/mbedtls/library/camellia.c @@ -1,9 +1,8 @@ /* * Camellia implementation * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * The Camellia block cipher was designed by NTT and Mitsubishi Electric diff --git a/ext/mbedtls/library/ccm.c b/ext/mbedtls/library/ccm.c index 97c3c2a22..b03d2a0dc 100644 --- a/ext/mbedtls/library/ccm.c +++ b/ext/mbedtls/library/ccm.c @@ -1,9 +1,8 @@ /* * NIST SP800-38C compliant CCM implementation * - * Copyright (C) 2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* diff --git a/ext/mbedtls/library/certs.c b/ext/mbedtls/library/certs.c index 2dd7eba6a..4a81e0201 100644 --- a/ext/mbedtls/library/certs.c +++ b/ext/mbedtls/library/certs.c @@ -1,9 +1,8 @@ /* * X.509 test certificates * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/ext/mbedtls/library/cipher.c b/ext/mbedtls/library/cipher.c index 627d459a3..0c33e215c 100644 --- a/ext/mbedtls/library/cipher.c +++ b/ext/mbedtls/library/cipher.c @@ -5,9 +5,8 @@ * * \author Adriaan de Jong * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +21,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/ext/mbedtls/library/cipher_wrap.c b/ext/mbedtls/library/cipher_wrap.c index c795234bc..54a81c53c 100644 --- a/ext/mbedtls/library/cipher_wrap.c +++ b/ext/mbedtls/library/cipher_wrap.c @@ -5,9 +5,8 @@ * * \author Adriaan de Jong * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +21,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/ext/mbedtls/library/ctr_drbg.c b/ext/mbedtls/library/ctr_drbg.c index 00b50d26b..0a649d6d9 100644 --- a/ext/mbedtls/library/ctr_drbg.c +++ b/ext/mbedtls/library/ctr_drbg.c @@ -1,9 +1,8 @@ /* * CTR_DRBG implementation based on AES-256 (NIST SP 800-90) * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * The NIST SP 800-90 DRBGs are described in the following publucation. diff --git a/ext/mbedtls/library/debug.c b/ext/mbedtls/library/debug.c index 2a559b54b..60544ceac 100644 --- a/ext/mbedtls/library/debug.c +++ b/ext/mbedtls/library/debug.c @@ -1,9 +1,8 @@ /* * Debugging routines * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) @@ -43,6 +44,10 @@ #define mbedtls_snprintf snprintf #endif +#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && !defined(inline) +#define inline __inline +#endif + #define DEBUG_BUF_SIZE 512 static int debug_threshold = 0; @@ -52,6 +57,27 @@ void mbedtls_debug_set_threshold( int threshold ) debug_threshold = threshold; } +/* + * All calls to f_dbg must be made via this function + */ +static inline void debug_send_line( const mbedtls_ssl_context *ssl, int level, + const char *file, int line, + const char *str ) +{ + /* + * If in a threaded environment, we need a thread identifier. + * Since there is no portable way to get one, use the address of the ssl + * context instead, as it shouldn't be shared between threads. + */ +#if defined(MBEDTLS_THREADING_C) + char idstr[20 + DEBUG_BUF_SIZE]; /* 0x + 16 nibbles + ': ' */ + mbedtls_snprintf( idstr, sizeof( idstr ), "%p: %s", ssl, str ); + ssl->conf->f_dbg( ssl->conf->p_dbg, level, file, line, idstr ); +#else + ssl->conf->f_dbg( ssl->conf->p_dbg, level, file, line, str ); +#endif +} + void mbedtls_debug_print_msg( const mbedtls_ssl_context *ssl, int level, const char *file, int line, const char *format, ... ) @@ -86,7 +112,7 @@ void mbedtls_debug_print_msg( const mbedtls_ssl_context *ssl, int level, str[ret + 1] = '\0'; } - ssl->conf->f_dbg( ssl->conf->p_dbg, level, file, line, str ); + debug_send_line( ssl, level, file, line, str ); } void mbedtls_debug_print_ret( const mbedtls_ssl_context *ssl, int level, @@ -109,7 +135,7 @@ void mbedtls_debug_print_ret( const mbedtls_ssl_context *ssl, int level, mbedtls_snprintf( str, sizeof( str ), "%s() returned %d (-0x%04x)\n", text, ret, -ret ); - ssl->conf->f_dbg( ssl->conf->p_dbg, level, file, line, str ); + debug_send_line( ssl, level, file, line, str ); } void mbedtls_debug_print_buf( const mbedtls_ssl_context *ssl, int level, @@ -126,7 +152,7 @@ void mbedtls_debug_print_buf( const mbedtls_ssl_context *ssl, int level, mbedtls_snprintf( str + idx, sizeof( str ) - idx, "dumping '%s' (%u bytes)\n", text, (unsigned int) len ); - ssl->conf->f_dbg( ssl->conf->p_dbg, level, file, line, str ); + debug_send_line( ssl, level, file, line, str ); idx = 0; memset( txt, 0, sizeof( txt ) ); @@ -140,7 +166,7 @@ void mbedtls_debug_print_buf( const mbedtls_ssl_context *ssl, int level, if( i > 0 ) { mbedtls_snprintf( str + idx, sizeof( str ) - idx, " %s\n", txt ); - ssl->conf->f_dbg( ssl->conf->p_dbg, level, file, line, str ); + debug_send_line( ssl, level, file, line, str ); idx = 0; memset( txt, 0, sizeof( txt ) ); @@ -162,7 +188,7 @@ void mbedtls_debug_print_buf( const mbedtls_ssl_context *ssl, int level, idx += mbedtls_snprintf( str + idx, sizeof( str ) - idx, " " ); mbedtls_snprintf( str + idx, sizeof( str ) - idx, " %s\n", txt ); - ssl->conf->f_dbg( ssl->conf->p_dbg, level, file, line, str ); + debug_send_line( ssl, level, file, line, str ); } } @@ -207,7 +233,7 @@ void mbedtls_debug_print_mpi( const mbedtls_ssl_context *ssl, int level, mbedtls_snprintf( str + idx, sizeof( str ) - idx, "value of '%s' (%d bits) is:\n", text, (int) ( ( n * ( sizeof(mbedtls_mpi_uint) << 3 ) ) + j + 1 ) ); - ssl->conf->f_dbg( ssl->conf->p_dbg, level, file, line, str ); + debug_send_line( ssl, level, file, line, str ); idx = 0; for( i = n + 1, j = 0; i > 0; i-- ) @@ -227,7 +253,7 @@ void mbedtls_debug_print_mpi( const mbedtls_ssl_context *ssl, int level, if( j > 0 ) { mbedtls_snprintf( str + idx, sizeof( str ) - idx, "\n" ); - ssl->conf->f_dbg( ssl->conf->p_dbg, level, file, line, str ); + debug_send_line( ssl, level, file, line, str ); idx = 0; } } @@ -244,7 +270,7 @@ void mbedtls_debug_print_mpi( const mbedtls_ssl_context *ssl, int level, idx += mbedtls_snprintf( str + idx, sizeof( str ) - idx, " 00" ); mbedtls_snprintf( str + idx, sizeof( str ) - idx, "\n" ); - ssl->conf->f_dbg( ssl->conf->p_dbg, level, file, line, str ); + debug_send_line( ssl, level, file, line, str ); } #endif /* MBEDTLS_BIGNUM_C */ @@ -261,7 +287,7 @@ static void debug_print_pk( const mbedtls_ssl_context *ssl, int level, if( mbedtls_pk_debug( pk, items ) != 0 ) { - ssl->conf->f_dbg( ssl->conf->p_dbg, level, file, line, + debug_send_line( ssl, level, file, line, "invalid PK context\n" ); return; } @@ -282,7 +308,7 @@ static void debug_print_pk( const mbedtls_ssl_context *ssl, int level, mbedtls_debug_print_ecp( ssl, level, file, line, name, items[i].value ); else #endif - ssl->conf->f_dbg( ssl->conf->p_dbg, level, file, line, + debug_send_line( ssl, level, file, line, "should not happen\n" ); } } @@ -305,7 +331,7 @@ static void debug_print_line_by_line( const mbedtls_ssl_context *ssl, int level, memcpy( str, start, len ); str[len] = '\0'; - ssl->conf->f_dbg( ssl->conf->p_dbg, level, file, line, str ); + debug_send_line( ssl, level, file, line, str ); start = cur + 1; } @@ -327,7 +353,7 @@ void mbedtls_debug_print_crt( const mbedtls_ssl_context *ssl, int level, char buf[1024]; mbedtls_snprintf( str, sizeof( str ), "%s #%d:\n", text, ++i ); - ssl->conf->f_dbg( ssl->conf->p_dbg, level, file, line, str ); + debug_send_line( ssl, level, file, line, str ); mbedtls_x509_crt_info( buf, sizeof( buf ) - 1, "", crt ); debug_print_line_by_line( ssl, level, file, line, buf ); diff --git a/ext/mbedtls/library/des.c b/ext/mbedtls/library/des.c index 68de7013d..c2cf6be4b 100644 --- a/ext/mbedtls/library/des.c +++ b/ext/mbedtls/library/des.c @@ -1,9 +1,8 @@ /* * FIPS-46-3 compliant Triple-DES implementation * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * DES, on which TDES is based, was originally designed by Horst Feistel diff --git a/ext/mbedtls/library/dhm.c b/ext/mbedtls/library/dhm.c index ac6261fbe..20f245bb4 100644 --- a/ext/mbedtls/library/dhm.c +++ b/ext/mbedtls/library/dhm.c @@ -1,9 +1,8 @@ /* * Diffie-Hellman-Merkle key exchange * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * Reference: diff --git a/ext/mbedtls/library/ecdh.c b/ext/mbedtls/library/ecdh.c index 8d8897726..553ac0350 100644 --- a/ext/mbedtls/library/ecdh.c +++ b/ext/mbedtls/library/ecdh.c @@ -1,9 +1,8 @@ /* * Elliptic curve Diffie-Hellman * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* diff --git a/ext/mbedtls/library/ecdsa.c b/ext/mbedtls/library/ecdsa.c index df8122e00..69b587a29 100644 --- a/ext/mbedtls/library/ecdsa.c +++ b/ext/mbedtls/library/ecdsa.c @@ -1,9 +1,8 @@ /* * Elliptic curve DSA * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* diff --git a/ext/mbedtls/library/ecp.c b/ext/mbedtls/library/ecp.c index c5464e30c..fefdcd39a 100644 --- a/ext/mbedtls/library/ecp.c +++ b/ext/mbedtls/library/ecp.c @@ -1,9 +1,8 @@ /* * Elliptic curves over GF(p): generic functions * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* diff --git a/ext/mbedtls/library/ecp_curves.c b/ext/mbedtls/library/ecp_curves.c index c21e0a071..1fccbbe2d 100644 --- a/ext/mbedtls/library/ecp_curves.c +++ b/ext/mbedtls/library/ecp_curves.c @@ -1,9 +1,8 @@ /* * Elliptic curves over GF(p): curve-specific data and functions * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/ext/mbedtls/library/entropy.c b/ext/mbedtls/library/entropy.c index 90e414916..65ecd2272 100644 --- a/ext/mbedtls/library/entropy.c +++ b/ext/mbedtls/library/entropy.c @@ -1,9 +1,8 @@ /* * Entropy accumulator implementation * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/ext/mbedtls/library/entropy_poll.c b/ext/mbedtls/library/entropy_poll.c index 073acad8f..7b0947558 100644 --- a/ext/mbedtls/library/entropy_poll.c +++ b/ext/mbedtls/library/entropy_poll.c @@ -1,9 +1,8 @@ /* * Platform-specific and custom entropy polling functions * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) @@ -140,7 +141,7 @@ int mbedtls_platform_entropy_poll( void *data, unsigned char *output, size_t len, size_t *olen ) { FILE *file; - size_t ret; + size_t read_len; ((void) data); #if defined(HAVE_GETRANDOM) @@ -165,8 +166,8 @@ int mbedtls_platform_entropy_poll( void *data, if( file == NULL ) return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED ); - ret = fread( output, 1, len, file ); - if( ret != len ) + read_len = fread( output, 1, len, file ); + if( read_len != len ) { fclose( file ); return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED ); diff --git a/ext/mbedtls/library/error.c b/ext/mbedtls/library/error.c index e78057b49..bd720618c 100644 --- a/ext/mbedtls/library/error.c +++ b/ext/mbedtls/library/error.c @@ -1,9 +1,8 @@ /* * Error message information * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/ext/mbedtls/library/gcm.c b/ext/mbedtls/library/gcm.c index c16578806..99d867f10 100644 --- a/ext/mbedtls/library/gcm.c +++ b/ext/mbedtls/library/gcm.c @@ -1,9 +1,8 @@ /* * NIST SP800-38D compliant GCM implementation * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* diff --git a/ext/mbedtls/library/havege.c b/ext/mbedtls/library/havege.c index 93450745b..688aa3bd4 100644 --- a/ext/mbedtls/library/havege.c +++ b/ext/mbedtls/library/havege.c @@ -1,9 +1,8 @@ /** * \brief HAVEGE: HArdware Volatile Entropy Gathering and Expansion * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * The HAVEGE RNG was designed by Andre Seznec in 2002. diff --git a/ext/mbedtls/library/hmac_drbg.c b/ext/mbedtls/library/hmac_drbg.c index 5c4ee6def..2826cc204 100644 --- a/ext/mbedtls/library/hmac_drbg.c +++ b/ext/mbedtls/library/hmac_drbg.c @@ -1,9 +1,8 @@ /* * HMAC_DRBG implementation (NIST SP 800-90) * - * Copyright (C) 2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* @@ -408,10 +409,7 @@ int mbedtls_hmac_drbg_update_seed_file( mbedtls_hmac_drbg_context *ctx, const ch /* Dummy checkup routine */ int mbedtls_hmac_drbg_self_test( int verbose ) { - - if( verbose != 0 ) - mbedtls_printf( "\n" ); - + (void) verbose; return( 0 ); } #else diff --git a/ext/mbedtls/library/md.c b/ext/mbedtls/library/md.c index a2c020b1e..fa63762ec 100644 --- a/ext/mbedtls/library/md.c +++ b/ext/mbedtls/library/md.c @@ -5,9 +5,8 @@ * * \author Adriaan de Jong * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +21,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/ext/mbedtls/library/md2.c b/ext/mbedtls/library/md2.c index d1fea1273..29d8d3138 100644 --- a/ext/mbedtls/library/md2.c +++ b/ext/mbedtls/library/md2.c @@ -1,9 +1,8 @@ /* * RFC 1115/1319 compliant MD2 implementation * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * The MD2 algorithm was designed by Ron Rivest in 1989. @@ -47,13 +48,13 @@ #endif /* MBEDTLS_PLATFORM_C */ #endif /* MBEDTLS_SELF_TEST */ +#if !defined(MBEDTLS_MD2_ALT) + /* Implementation that should never be optimized out by the compiler */ static void mbedtls_zeroize( void *v, size_t n ) { volatile unsigned char *p = v; while( n-- ) *p++ = 0; } -#if !defined(MBEDTLS_MD2_ALT) - static const unsigned char PI_SUBST[256] = { 0x29, 0x2E, 0x43, 0xC9, 0xA2, 0xD8, 0x7C, 0x01, 0x3D, 0x36, diff --git a/ext/mbedtls/library/md4.c b/ext/mbedtls/library/md4.c index b71d2c939..2a66db49e 100644 --- a/ext/mbedtls/library/md4.c +++ b/ext/mbedtls/library/md4.c @@ -1,9 +1,8 @@ /* * RFC 1186/1320 compliant MD4 implementation * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * The MD4 algorithm was designed by Ron Rivest in 1990. @@ -47,13 +48,13 @@ #endif /* MBEDTLS_PLATFORM_C */ #endif /* MBEDTLS_SELF_TEST */ +#if !defined(MBEDTLS_MD4_ALT) + /* Implementation that should never be optimized out by the compiler */ static void mbedtls_zeroize( void *v, size_t n ) { volatile unsigned char *p = v; while( n-- ) *p++ = 0; } -#if !defined(MBEDTLS_MD4_ALT) - /* * 32-bit integer manipulation macros (little endian) */ diff --git a/ext/mbedtls/library/md5.c b/ext/mbedtls/library/md5.c index 7c846bed0..758eebeb6 100644 --- a/ext/mbedtls/library/md5.c +++ b/ext/mbedtls/library/md5.c @@ -1,9 +1,8 @@ /* * RFC 1321 compliant MD5 implementation * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * The MD5 algorithm was designed by Ron Rivest in 1991. @@ -46,13 +47,13 @@ #endif /* MBEDTLS_PLATFORM_C */ #endif /* MBEDTLS_SELF_TEST */ +#if !defined(MBEDTLS_MD5_ALT) + /* Implementation that should never be optimized out by the compiler */ static void mbedtls_zeroize( void *v, size_t n ) { volatile unsigned char *p = v; while( n-- ) *p++ = 0; } -#if !defined(MBEDTLS_MD5_ALT) - /* * 32-bit integer manipulation macros (little endian) */ diff --git a/ext/mbedtls/library/md_wrap.c b/ext/mbedtls/library/md_wrap.c index b4a6f69e2..49c47d69d 100644 --- a/ext/mbedtls/library/md_wrap.c +++ b/ext/mbedtls/library/md_wrap.c @@ -1,13 +1,12 @@ /** * \file md_wrap.c - + * * \brief Generic message digest wrapper for mbed TLS * * \author Adriaan de Jong * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +21,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/ext/mbedtls/library/memory_buffer_alloc.c b/ext/mbedtls/library/memory_buffer_alloc.c index b5a8f170b..ec86061d8 100644 --- a/ext/mbedtls/library/memory_buffer_alloc.c +++ b/ext/mbedtls/library/memory_buffer_alloc.c @@ -1,9 +1,8 @@ /* * Buffer-based memory allocator * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/ext/mbedtls/library/net.c b/ext/mbedtls/library/net.c index bcec232e1..ea3a0bde0 100644 --- a/ext/mbedtls/library/net.c +++ b/ext/mbedtls/library/net.c @@ -1,9 +1,8 @@ /* * TCP/IP or UDP/IP networking functions * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/ext/mbedtls/library/oid.c b/ext/mbedtls/library/oid.c index f14282add..0530006bd 100644 --- a/ext/mbedtls/library/oid.c +++ b/ext/mbedtls/library/oid.c @@ -3,9 +3,8 @@ * * \brief Object Identifier (OID) database * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/ext/mbedtls/library/padlock.c b/ext/mbedtls/library/padlock.c index 32654f9ab..eb9dd585e 100644 --- a/ext/mbedtls/library/padlock.c +++ b/ext/mbedtls/library/padlock.c @@ -1,9 +1,8 @@ /* * VIA PadLock support functions * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * This implementation is based on the VIA PadLock Programming Guide: diff --git a/ext/mbedtls/library/pem.c b/ext/mbedtls/library/pem.c index 13fc2df2f..3ac8a02ed 100644 --- a/ext/mbedtls/library/pem.c +++ b/ext/mbedtls/library/pem.c @@ -1,9 +1,8 @@ /* * Privacy Enhanced Mail (PEM) decoding * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) @@ -236,12 +237,14 @@ int mbedtls_pem_read_buffer( mbedtls_pem_context *ctx, const char *header, const return( MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT ); s1 += strlen( header ); + if( *s1 == ' ' ) s1++; if( *s1 == '\r' ) s1++; if( *s1 == '\n' ) s1++; else return( MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT ); end = s2; end += strlen( footer ); + if( *end == ' ' ) end++; if( *end == '\r' ) end++; if( *end == '\n' ) end++; *use_len = end - data; diff --git a/ext/mbedtls/library/pk.c b/ext/mbedtls/library/pk.c index b5810b5fe..52f5c421c 100644 --- a/ext/mbedtls/library/pk.c +++ b/ext/mbedtls/library/pk.c @@ -1,9 +1,8 @@ /* * Public Key abstraction layer * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/ext/mbedtls/library/pk_wrap.c b/ext/mbedtls/library/pk_wrap.c index 8e584f430..a68b4f30c 100644 --- a/ext/mbedtls/library/pk_wrap.c +++ b/ext/mbedtls/library/pk_wrap.c @@ -1,9 +1,8 @@ /* * Public Key abstraction layer: wrapper functions * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/ext/mbedtls/library/pkcs11.c b/ext/mbedtls/library/pkcs11.c index b04d9691a..73d0ead5a 100644 --- a/ext/mbedtls/library/pkcs11.c +++ b/ext/mbedtls/library/pkcs11.c @@ -5,9 +5,8 @@ * * \author Adriaan de Jong * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +21,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #include "mbedtls/pkcs11.h" diff --git a/ext/mbedtls/library/pkcs12.c b/ext/mbedtls/library/pkcs12.c index bdf6a9b93..3454a7acc 100644 --- a/ext/mbedtls/library/pkcs12.c +++ b/ext/mbedtls/library/pkcs12.c @@ -1,9 +1,8 @@ /* * PKCS#12 Personal Information Exchange Syntax * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * The PKCS #12 Personal Information Exchange Syntax Standard v1.1 diff --git a/ext/mbedtls/library/pkcs5.c b/ext/mbedtls/library/pkcs5.c index 68cbfa77d..80232b1d6 100644 --- a/ext/mbedtls/library/pkcs5.c +++ b/ext/mbedtls/library/pkcs5.c @@ -5,9 +5,8 @@ * * \author Mathias Olsson * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +21,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * PKCS#5 includes PBKDF2 and more diff --git a/ext/mbedtls/library/pkparse.c b/ext/mbedtls/library/pkparse.c index f24dbad92..317e19c5f 100644 --- a/ext/mbedtls/library/pkparse.c +++ b/ext/mbedtls/library/pkparse.c @@ -1,9 +1,8 @@ /* * Public Key layer for parsing key files and structures * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/ext/mbedtls/library/pkwrite.c b/ext/mbedtls/library/pkwrite.c index a8cbd6b95..8367b27d9 100644 --- a/ext/mbedtls/library/pkwrite.c +++ b/ext/mbedtls/library/pkwrite.c @@ -1,9 +1,8 @@ /* * Public Key layer for writing key files and structures * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/ext/mbedtls/library/platform.c b/ext/mbedtls/library/platform.c index 3161a4c00..8cd742d66 100644 --- a/ext/mbedtls/library/platform.c +++ b/ext/mbedtls/library/platform.c @@ -1,9 +1,8 @@ /* * Platform abstraction layer * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/ext/mbedtls/library/ripemd160.c b/ext/mbedtls/library/ripemd160.c index ecaeea00a..000bf9dd2 100644 --- a/ext/mbedtls/library/ripemd160.c +++ b/ext/mbedtls/library/ripemd160.c @@ -1,9 +1,8 @@ /* * RIPE MD-160 implementation * - * Copyright (C) 2014-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* diff --git a/ext/mbedtls/library/rsa.c b/ext/mbedtls/library/rsa.c index 9f0d46186..f1052e7bc 100644 --- a/ext/mbedtls/library/rsa.c +++ b/ext/mbedtls/library/rsa.c @@ -1,9 +1,8 @@ /* * The RSA public-key cryptosystem * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * RSA was designed by Ron Rivest, Adi Shamir and Len Adleman. @@ -274,27 +275,27 @@ int mbedtls_rsa_public( mbedtls_rsa_context *ctx, mbedtls_mpi_init( &T ); +#if defined(MBEDTLS_THREADING_C) + if( ( ret = mbedtls_mutex_lock( &ctx->mutex ) ) != 0 ) + return( ret ); +#endif + MBEDTLS_MPI_CHK( mbedtls_mpi_read_binary( &T, input, ctx->len ) ); if( mbedtls_mpi_cmp_mpi( &T, &ctx->N ) >= 0 ) { - mbedtls_mpi_free( &T ); - return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA ); + ret = MBEDTLS_ERR_MPI_BAD_INPUT_DATA; + goto cleanup; } -#if defined(MBEDTLS_THREADING_C) - if( ( ret = mbedtls_mutex_lock( &ctx->mutex ) ) != 0 ) - return( ret ); -#endif - olen = ctx->len; MBEDTLS_MPI_CHK( mbedtls_mpi_exp_mod( &T, &T, &ctx->E, &ctx->N, &ctx->RN ) ); MBEDTLS_MPI_CHK( mbedtls_mpi_write_binary( &T, output, olen ) ); cleanup: #if defined(MBEDTLS_THREADING_C) - if( ( ret = mbedtls_mutex_unlock( &ctx->mutex ) ) != 0 ) - return( ret ); + if( mbedtls_mutex_unlock( &ctx->mutex ) != 0 ) + return( MBEDTLS_ERR_THREADING_MUTEX_ERROR ); #endif mbedtls_mpi_free( &T ); @@ -311,16 +312,11 @@ cleanup: * DSS, and other systems. In : Advances in Cryptology-CRYPTO'96. Springer * Berlin Heidelberg, 1996. p. 104-113. */ -static int rsa_prepare_blinding( mbedtls_rsa_context *ctx, mbedtls_mpi *Vi, mbedtls_mpi *Vf, +static int rsa_prepare_blinding( mbedtls_rsa_context *ctx, int (*f_rng)(void *, unsigned char *, size_t), void *p_rng ) { int ret, count = 0; -#if defined(MBEDTLS_THREADING_C) - if( ( ret = mbedtls_mutex_lock( &ctx->mutex ) ) != 0 ) - return( ret ); -#endif - if( ctx->Vf.p != NULL ) { /* We already have blinding values, just update them by squaring */ @@ -329,7 +325,7 @@ static int rsa_prepare_blinding( mbedtls_rsa_context *ctx, mbedtls_mpi *Vi, mbed MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi( &ctx->Vf, &ctx->Vf, &ctx->Vf ) ); MBEDTLS_MPI_CHK( mbedtls_mpi_mod_mpi( &ctx->Vf, &ctx->Vf, &ctx->N ) ); - goto done; + goto cleanup; } /* Unblinding value: Vf = random number, invertible mod N */ @@ -345,19 +341,8 @@ static int rsa_prepare_blinding( mbedtls_rsa_context *ctx, mbedtls_mpi *Vi, mbed MBEDTLS_MPI_CHK( mbedtls_mpi_inv_mod( &ctx->Vi, &ctx->Vf, &ctx->N ) ); MBEDTLS_MPI_CHK( mbedtls_mpi_exp_mod( &ctx->Vi, &ctx->Vi, &ctx->E, &ctx->N, &ctx->RN ) ); -done: - if( Vi != &ctx->Vi ) - { - MBEDTLS_MPI_CHK( mbedtls_mpi_copy( Vi, &ctx->Vi ) ); - MBEDTLS_MPI_CHK( mbedtls_mpi_copy( Vf, &ctx->Vf ) ); - } cleanup: -#if defined(MBEDTLS_THREADING_C) - if( ( ret = mbedtls_mutex_unlock( &ctx->mutex ) ) != 0 ) - return( ret ); -#endif - return( ret ); } @@ -373,31 +358,19 @@ int mbedtls_rsa_private( mbedtls_rsa_context *ctx, int ret; size_t olen; mbedtls_mpi T, T1, T2; - mbedtls_mpi *Vi, *Vf; - /* - * When using the Chinese Remainder Theorem, we use blinding values. - * Without threading, we just read them directly from the context, - * otherwise we make a local copy in order to reduce locking contention. - */ -#if defined(MBEDTLS_THREADING_C) - mbedtls_mpi Vi_copy, Vf_copy; + mbedtls_mpi_init( &T ); mbedtls_mpi_init( &T1 ); mbedtls_mpi_init( &T2 ); - mbedtls_mpi_init( &Vi_copy ); mbedtls_mpi_init( &Vf_copy ); - Vi = &Vi_copy; - Vf = &Vf_copy; -#else - Vi = &ctx->Vi; - Vf = &ctx->Vf; +#if defined(MBEDTLS_THREADING_C) + if( ( ret = mbedtls_mutex_lock( &ctx->mutex ) ) != 0 ) + return( ret ); #endif - mbedtls_mpi_init( &T ); mbedtls_mpi_init( &T1 ); mbedtls_mpi_init( &T2 ); - MBEDTLS_MPI_CHK( mbedtls_mpi_read_binary( &T, input, ctx->len ) ); if( mbedtls_mpi_cmp_mpi( &T, &ctx->N ) >= 0 ) { - mbedtls_mpi_free( &T ); - return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA ); + ret = MBEDTLS_ERR_MPI_BAD_INPUT_DATA; + goto cleanup; } if( f_rng != NULL ) @@ -406,16 +379,11 @@ int mbedtls_rsa_private( mbedtls_rsa_context *ctx, * Blinding * T = T * Vi mod N */ - MBEDTLS_MPI_CHK( rsa_prepare_blinding( ctx, Vi, Vf, f_rng, p_rng ) ); - MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi( &T, &T, Vi ) ); + MBEDTLS_MPI_CHK( rsa_prepare_blinding( ctx, f_rng, p_rng ) ); + MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi( &T, &T, &ctx->Vi ) ); MBEDTLS_MPI_CHK( mbedtls_mpi_mod_mpi( &T, &T, &ctx->N ) ); } -#if defined(MBEDTLS_THREADING_C) - if( ( ret = mbedtls_mutex_lock( &ctx->mutex ) ) != 0 ) - return( ret ); -#endif - #if defined(MBEDTLS_RSA_NO_CRT) MBEDTLS_MPI_CHK( mbedtls_mpi_exp_mod( &T, &T, &ctx->D, &ctx->N, &ctx->RN ) ); #else @@ -448,7 +416,7 @@ int mbedtls_rsa_private( mbedtls_rsa_context *ctx, * Unblind * T = T * Vf mod N */ - MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi( &T, &T, Vf ) ); + MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi( &T, &T, &ctx->Vf ) ); MBEDTLS_MPI_CHK( mbedtls_mpi_mod_mpi( &T, &T, &ctx->N ) ); } @@ -457,10 +425,10 @@ int mbedtls_rsa_private( mbedtls_rsa_context *ctx, cleanup: #if defined(MBEDTLS_THREADING_C) - if( ( ret = mbedtls_mutex_unlock( &ctx->mutex ) ) != 0 ) - return( ret ); - mbedtls_mpi_free( &Vi_copy ); mbedtls_mpi_free( &Vf_copy ); + if( mbedtls_mutex_unlock( &ctx->mutex ) != 0 ) + return( MBEDTLS_ERR_THREADING_MUTEX_ERROR ); #endif + mbedtls_mpi_free( &T ); mbedtls_mpi_free( &T1 ); mbedtls_mpi_free( &T2 ); if( ret != 0 ) @@ -1642,9 +1610,12 @@ int mbedtls_rsa_self_test( int verbose ) return( 1 ); } + if( verbose != 0 ) + mbedtls_printf( "passed\n" ); + #if defined(MBEDTLS_SHA1_C) if( verbose != 0 ) - mbedtls_printf( "passed\n PKCS#1 data sign : " ); + mbedtls_printf( "PKCS#1 data sign : " ); mbedtls_sha1( rsa_plaintext, PT_LEN, sha1sum ); @@ -1670,9 +1641,12 @@ int mbedtls_rsa_self_test( int verbose ) } if( verbose != 0 ) - mbedtls_printf( "passed\n\n" ); + mbedtls_printf( "passed\n" ); #endif /* MBEDTLS_SHA1_C */ + if( verbose != 0 ) + mbedtls_printf( "\n" ); + cleanup: mbedtls_rsa_free( &rsa ); #else /* MBEDTLS_PKCS1_V15 */ diff --git a/ext/mbedtls/library/sha1.c b/ext/mbedtls/library/sha1.c index 7ca83508c..35b6019c2 100644 --- a/ext/mbedtls/library/sha1.c +++ b/ext/mbedtls/library/sha1.c @@ -1,9 +1,8 @@ /* * FIPS-180-1 compliant SHA-1 implementation * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * The SHA-1 standard was published by NIST in 1993. @@ -46,13 +47,13 @@ #endif /* MBEDTLS_PLATFORM_C */ #endif /* MBEDTLS_SELF_TEST */ +#if !defined(MBEDTLS_SHA1_ALT) + /* Implementation that should never be optimized out by the compiler */ static void mbedtls_zeroize( void *v, size_t n ) { volatile unsigned char *p = v; while( n-- ) *p++ = 0; } -#if !defined(MBEDTLS_SHA1_ALT) - /* * 32-bit integer manipulation macros (big endian) */ diff --git a/ext/mbedtls/library/sha256.c b/ext/mbedtls/library/sha256.c index 4b393d05f..490557388 100644 --- a/ext/mbedtls/library/sha256.c +++ b/ext/mbedtls/library/sha256.c @@ -1,9 +1,8 @@ /* * FIPS-180-2 compliant SHA-256 implementation * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * The SHA-256 Secure Hash Standard was published by NIST in 2002. @@ -46,13 +47,13 @@ #endif /* MBEDTLS_PLATFORM_C */ #endif /* MBEDTLS_SELF_TEST */ +#if !defined(MBEDTLS_SHA256_ALT) + /* Implementation that should never be optimized out by the compiler */ static void mbedtls_zeroize( void *v, size_t n ) { volatile unsigned char *p = v; while( n-- ) *p++ = 0; } -#if !defined(MBEDTLS_SHA256_ALT) - /* * 32-bit integer manipulation macros (big endian) */ diff --git a/ext/mbedtls/library/sha512.c b/ext/mbedtls/library/sha512.c index 3daf08089..994318ceb 100644 --- a/ext/mbedtls/library/sha512.c +++ b/ext/mbedtls/library/sha512.c @@ -1,9 +1,8 @@ /* * FIPS-180-2 compliant SHA-384/512 implementation * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * The SHA-512 Secure Hash Standard was published by NIST in 2002. @@ -52,13 +53,13 @@ #endif /* MBEDTLS_PLATFORM_C */ #endif /* MBEDTLS_SELF_TEST */ +#if !defined(MBEDTLS_SHA512_ALT) + /* Implementation that should never be optimized out by the compiler */ static void mbedtls_zeroize( void *v, size_t n ) { volatile unsigned char *p = v; while( n-- ) *p++ = 0; } -#if !defined(MBEDTLS_SHA512_ALT) - /* * 64-bit integer manipulation macros (big endian) */ diff --git a/ext/mbedtls/library/ssl_cache.c b/ext/mbedtls/library/ssl_cache.c index 162b47a44..170b40142 100644 --- a/ext/mbedtls/library/ssl_cache.c +++ b/ext/mbedtls/library/ssl_cache.c @@ -1,9 +1,8 @@ /* * SSL session cache implementation * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * These session callbacks use a simple chained list diff --git a/ext/mbedtls/library/ssl_ciphersuites.c b/ext/mbedtls/library/ssl_ciphersuites.c index 484da5213..918b87c0c 100644 --- a/ext/mbedtls/library/ssl_ciphersuites.c +++ b/ext/mbedtls/library/ssl_ciphersuites.c @@ -3,9 +3,8 @@ * * \brief SSL ciphersuites for mbed TLS * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/ext/mbedtls/library/ssl_cli.c b/ext/mbedtls/library/ssl_cli.c index 1d683d307..078624463 100644 --- a/ext/mbedtls/library/ssl_cli.c +++ b/ext/mbedtls/library/ssl_cli.c @@ -1,9 +1,8 @@ /* * SSLv3/TLSv1 client-side functions * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) @@ -1269,7 +1270,7 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl ) return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } - if( ssl->in_hslen > 39 + n ) + if( ssl->in_hslen > mbedtls_ssl_hs_hdr_len( ssl ) + 39 + n ) { ext_len = ( ( buf[38 + n] << 8 ) | ( buf[39 + n] ) ); @@ -1281,7 +1282,7 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl ) return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } } - else if( ssl->in_hslen == 38 + n ) + else if( ssl->in_hslen == mbedtls_ssl_hs_hdr_len( ssl ) + 38 + n ) { ext_len = 0; } @@ -1748,6 +1749,12 @@ static int ssl_write_encrypted_pms( mbedtls_ssl_context *ssl, size_t len_bytes = ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_0 ? 0 : 2; unsigned char *p = ssl->handshake->premaster + pms_offset; + if( offset + len_bytes > MBEDTLS_SSL_MAX_CONTENT_LEN ) + { + MBEDTLS_SSL_DEBUG_MSG( 1, ( "buffer too small for encrypted pms" ) ); + return( MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL ); + } + /* * Generate (part of) the pre-master as * struct { @@ -2522,6 +2529,14 @@ static int ssl_write_client_key_exchange( mbedtls_ssl_context *ssl ) i = 4; n = ssl->conf->psk_identity_len; + + if( i + 2 + n > MBEDTLS_SSL_MAX_CONTENT_LEN ) + { + MBEDTLS_SSL_DEBUG_MSG( 1, ( "psk identity too long or " + "SSL buffer too short" ) ); + return( MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL ); + } + ssl->out_msg[i++] = (unsigned char)( n >> 8 ); ssl->out_msg[i++] = (unsigned char)( n ); @@ -2550,6 +2565,14 @@ static int ssl_write_client_key_exchange( mbedtls_ssl_context *ssl ) * ClientDiffieHellmanPublic public (DHM send G^X mod P) */ n = ssl->handshake->dhm_ctx.len; + + if( i + 2 + n > MBEDTLS_SSL_MAX_CONTENT_LEN ) + { + MBEDTLS_SSL_DEBUG_MSG( 1, ( "psk identity or DHM size too long" + " or SSL buffer too short" ) ); + return( MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL ); + } + ssl->out_msg[i++] = (unsigned char)( n >> 8 ); ssl->out_msg[i++] = (unsigned char)( n ); diff --git a/ext/mbedtls/library/ssl_cookie.c b/ext/mbedtls/library/ssl_cookie.c index cc88905c4..7f9d8b4f3 100644 --- a/ext/mbedtls/library/ssl_cookie.c +++ b/ext/mbedtls/library/ssl_cookie.c @@ -1,9 +1,8 @@ /* * DTLS cookie callbacks implementation * - * Copyright (C) 2014-2015, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * These session callbacks use a simple chained list diff --git a/ext/mbedtls/library/ssl_srv.c b/ext/mbedtls/library/ssl_srv.c index 701d27d62..92ed3bda4 100644 --- a/ext/mbedtls/library/ssl_srv.c +++ b/ext/mbedtls/library/ssl_srv.c @@ -1,9 +1,8 @@ /* * SSLv3/TLSv1 server-side functions * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) @@ -1480,8 +1481,6 @@ read_record_header: msg_len != ext_offset + 2 + ext_len ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad client hello message" ) ); - MBEDTLS_SSL_DEBUG_BUF( 3, "client hello extensions", - buf + ext_offset + 2, ext_len ); return( MBEDTLS_ERR_SSL_BAD_HS_CLIENT_HELLO ); } } @@ -1489,6 +1488,7 @@ read_record_header: ext_len = 0; ext = buf + ext_offset + 2; + MBEDTLS_SSL_DEBUG_BUF( 3, "client hello extensions", ext, ext_len ); while( ext_len != 0 ) { @@ -1643,11 +1643,11 @@ read_record_header: if( p[0] == (unsigned char)( ( MBEDTLS_SSL_FALLBACK_SCSV_VALUE >> 8 ) & 0xff ) && p[1] == (unsigned char)( ( MBEDTLS_SSL_FALLBACK_SCSV_VALUE ) & 0xff ) ) { - MBEDTLS_SSL_DEBUG_MSG( 0, ( "received FALLBACK_SCSV" ) ); + MBEDTLS_SSL_DEBUG_MSG( 2, ( "received FALLBACK_SCSV" ) ); if( ssl->minor_ver < ssl->conf->max_minor_ver ) { - MBEDTLS_SSL_DEBUG_MSG( 0, ( "inapropriate fallback" ) ); + MBEDTLS_SSL_DEBUG_MSG( 1, ( "inapropriate fallback" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_INAPROPRIATE_FALLBACK ); @@ -2482,7 +2482,7 @@ static int ssl_write_certificate_request( mbedtls_ssl_context *ssl ) memcpy( p, crt->subject_raw.p, dn_size ); p += dn_size; - MBEDTLS_SSL_DEBUG_BUF( 3, "requested DN", p, dn_size ); + MBEDTLS_SSL_DEBUG_BUF( 3, "requested DN", p - dn_size, dn_size ); total_dn_size += 2 + dn_size; crt = crt->next; diff --git a/ext/mbedtls/library/ssl_ticket.c b/ext/mbedtls/library/ssl_ticket.c index 94795f468..3e025d8ed 100644 --- a/ext/mbedtls/library/ssl_ticket.c +++ b/ext/mbedtls/library/ssl_ticket.c @@ -1,9 +1,8 @@ /* * TLS server tickets callbacks implementation * - * Copyright (C) 2015, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/ext/mbedtls/library/ssl_tls.c b/ext/mbedtls/library/ssl_tls.c index 998f77b39..2fe376bea 100644 --- a/ext/mbedtls/library/ssl_tls.c +++ b/ext/mbedtls/library/ssl_tls.c @@ -1,9 +1,8 @@ /* * SSLv3/TLSv1 shared functions * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * The SSL 3.0 specification was drafted by Netscape in 1996, @@ -694,8 +695,6 @@ int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl ) } else { - int ret; - /* Initialize HMAC contexts */ if( ( ret = mbedtls_md_setup( &transform->md_ctx_enc, md_info, 1 ) ) != 0 || ( ret = mbedtls_md_setup( &transform->md_ctx_dec, md_info, 1 ) ) != 0 ) @@ -1455,7 +1454,7 @@ static int ssl_encrypt_buf( mbedtls_ssl_context *ssl ) /* * Generate IV */ - int ret = ssl->conf->f_rng( ssl->conf->p_rng, ssl->transform_out->iv_enc, + ret = ssl->conf->f_rng( ssl->conf->p_rng, ssl->transform_out->iv_enc, ssl->transform_out->ivlen ); if( ret != 0 ) return( ret ); @@ -2172,7 +2171,7 @@ static int ssl_resend_hello_request( mbedtls_ssl_context *ssl ) if( ++ssl->renego_records_seen > doublings ) { - MBEDTLS_SSL_DEBUG_MSG( 0, ( "no longer retransmitting hello request" ) ); + MBEDTLS_SSL_DEBUG_MSG( 2, ( "no longer retransmitting hello request" ) ); return( 0 ); } } @@ -3573,6 +3572,23 @@ read_record_header: if( ret == MBEDTLS_ERR_SSL_INVALID_RECORD || ret == MBEDTLS_ERR_SSL_INVALID_MAC ) { + /* Except when waiting for Finished as a bad mac here + * probably means something went wrong in the handshake + * (eg wrong psk used, mitm downgrade attempt, etc.) */ + if( ssl->state == MBEDTLS_SSL_CLIENT_FINISHED || + ssl->state == MBEDTLS_SSL_SERVER_FINISHED ) + { +#if defined(MBEDTLS_SSL_ALL_ALERT_MESSAGES) + if( ret == MBEDTLS_ERR_SSL_INVALID_MAC ) + { + mbedtls_ssl_send_alert_message( ssl, + MBEDTLS_SSL_ALERT_LEVEL_FATAL, + MBEDTLS_SSL_ALERT_MSG_BAD_RECORD_MAC ); + } +#endif + return( ret ); + } + #if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT) if( ssl->conf->badmac_limit != 0 && ++ssl->badmac_seen >= ssl->conf->badmac_limit ) @@ -3701,6 +3717,9 @@ int mbedtls_ssl_send_alert_message( mbedtls_ssl_context *ssl, { int ret; + if( ssl == NULL || ssl->conf == NULL ) + return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA ); + MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> send alert message" ) ); ssl->out_msgtype = MBEDTLS_SSL_MSG_ALERT; @@ -5442,6 +5461,13 @@ int mbedtls_ssl_conf_psk( mbedtls_ssl_config *conf, if( psk_len > MBEDTLS_PSK_MAX_LEN ) return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA ); + /* Identity len will be encoded on two bytes */ + if( ( psk_identity_len >> 16 ) != 0 || + psk_identity_len > MBEDTLS_SSL_MAX_CONTENT_LEN ) + { + return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA ); + } + if( conf->psk != NULL || conf->psk_identity != NULL ) { mbedtls_free( conf->psk ); @@ -5838,13 +5864,36 @@ int mbedtls_ssl_get_record_expansion( const mbedtls_ssl_context *ssl ) break; default: - MBEDTLS_SSL_DEBUG_MSG( 0, ( "should never happen" ) ); + MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) ); return( MBEDTLS_ERR_SSL_INTERNAL_ERROR ); } return( (int)( mbedtls_ssl_hdr_len( ssl ) + transform_expansion ) ); } +#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH) +size_t mbedtls_ssl_get_max_frag_len( const mbedtls_ssl_context *ssl ) +{ + size_t max_len; + + /* + * Assume mfl_code is correct since it was checked when set + */ + max_len = mfl_code_to_length[ssl->conf->mfl_code]; + + /* + * Check if a smaller max length was negotiated + */ + if( ssl->session_out != NULL && + mfl_code_to_length[ssl->session_out->mfl_code] < max_len ) + { + max_len = mfl_code_to_length[ssl->session_out->mfl_code]; + } + + return max_len; +} +#endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */ + #if defined(MBEDTLS_X509_CRT_PARSE_C) const mbedtls_x509_crt *mbedtls_ssl_get_peer_cert( const mbedtls_ssl_context *ssl ) { @@ -5877,6 +5926,9 @@ int mbedtls_ssl_handshake_step( mbedtls_ssl_context *ssl ) { int ret = MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE; + if( ssl == NULL || ssl->conf == NULL ) + return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA ); + #if defined(MBEDTLS_SSL_CLI_C) if( ssl->conf->endpoint == MBEDTLS_SSL_IS_CLIENT ) ret = mbedtls_ssl_handshake_client_step( ssl ); @@ -5896,6 +5948,9 @@ int mbedtls_ssl_handshake( mbedtls_ssl_context *ssl ) { int ret = 0; + if( ssl == NULL || ssl->conf == NULL ) + return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA ); + MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> handshake" ) ); while( ssl->state != MBEDTLS_SSL_HANDSHAKE_OVER ) @@ -5991,6 +6046,9 @@ int mbedtls_ssl_renegotiate( mbedtls_ssl_context *ssl ) { int ret = MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE; + if( ssl == NULL || ssl->conf == NULL ) + return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA ); + #if defined(MBEDTLS_SSL_SRV_C) /* On server, just send the request */ if( ssl->conf->endpoint == MBEDTLS_SSL_IS_SERVER ) @@ -6055,7 +6113,7 @@ static int ssl_check_ctr_renegotiate( mbedtls_ssl_context *ssl ) return( 0 ); } - MBEDTLS_SSL_DEBUG_MSG( 0, ( "record counter limit reached: renegotiate" ) ); + MBEDTLS_SSL_DEBUG_MSG( 1, ( "record counter limit reached: renegotiate" ) ); return( mbedtls_ssl_renegotiate( ssl ) ); } #endif /* MBEDTLS_SSL_RENEGOTIATION */ @@ -6068,6 +6126,9 @@ int mbedtls_ssl_read( mbedtls_ssl_context *ssl, unsigned char *buf, size_t len ) int ret, record_read = 0; size_t n; + if( ssl == NULL || ssl->conf == NULL ) + return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA ); + MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> read" ) ); #if defined(MBEDTLS_SSL_PROTO_DTLS) @@ -6322,23 +6383,7 @@ static int ssl_write_real( mbedtls_ssl_context *ssl, { int ret; #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH) - unsigned int max_len; -#endif - -#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH) - /* - * Assume mfl_code is correct since it was checked when set - */ - max_len = mfl_code_to_length[ssl->conf->mfl_code]; - - /* - * Check if a smaller max length was negotiated - */ - if( ssl->session_out != NULL && - mfl_code_to_length[ssl->session_out->mfl_code] < max_len ) - { - max_len = mfl_code_to_length[ssl->session_out->mfl_code]; - } + size_t max_len = mbedtls_ssl_get_max_frag_len( ssl ); if( len > max_len ) { @@ -6427,6 +6472,9 @@ int mbedtls_ssl_write( mbedtls_ssl_context *ssl, const unsigned char *buf, size_ MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> write" ) ); + if( ssl == NULL || ssl->conf == NULL ) + return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA ); + #if defined(MBEDTLS_SSL_RENEGOTIATION) if( ( ret = ssl_check_ctr_renegotiate( ssl ) ) != 0 ) { @@ -6462,6 +6510,9 @@ int mbedtls_ssl_close_notify( mbedtls_ssl_context *ssl ) { int ret; + if( ssl == NULL || ssl->conf == NULL ) + return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA ); + MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> write close notify" ) ); if( ssl->out_left != 0 ) @@ -6819,6 +6870,7 @@ int mbedtls_ssl_config_defaults( mbedtls_ssl_config *conf, #if defined(MBEDTLS_ECP_C) conf->curve_list = ssl_preset_suiteb_curves; #endif + break; /* * Default diff --git a/ext/mbedtls/library/threading.c b/ext/mbedtls/library/threading.c index b499a44c8..90e6aa526 100644 --- a/ext/mbedtls/library/threading.c +++ b/ext/mbedtls/library/threading.c @@ -1,9 +1,8 @@ /* * Threading abstraction layer * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/ext/mbedtls/library/timing.c b/ext/mbedtls/library/timing.c index 5a36fb72a..1b730023f 100644 --- a/ext/mbedtls/library/timing.c +++ b/ext/mbedtls/library/timing.c @@ -1,9 +1,8 @@ /* * Portable interface to the CPU cycle counter * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) @@ -414,7 +415,9 @@ int mbedtls_timing_self_test( int verbose ) millisecs = mbedtls_timing_get_timer( &hires, 0 ); - if( millisecs < 900 * secs || millisecs > 1100 * secs ) + /* For some reason on Windows it looks like alarm has an extra delay + * (maybe related to creating a new thread). Allow some room here. */ + if( millisecs < 800 * secs || millisecs > 1200 * secs + 300 ) { if( verbose != 0 ) mbedtls_printf( "failed\n" ); @@ -429,25 +432,25 @@ int mbedtls_timing_self_test( int verbose ) if( verbose != 0 ) mbedtls_printf( " TIMING test #2 (set/get_delay ): " ); - for( a = 100; a <= 200; a += 100 ) + for( a = 200; a <= 400; a += 200 ) { - for( b = 100; b <= 200; b += 100 ) + for( b = 200; b <= 400; b += 200 ) { mbedtls_timing_set_delay( &ctx, a, a + b ); - busy_msleep( a - a / 10 ); + busy_msleep( a - a / 8 ); if( mbedtls_timing_get_delay( &ctx ) != 0 ) FAIL; - busy_msleep( a / 5 ); + busy_msleep( a / 4 ); if( mbedtls_timing_get_delay( &ctx ) != 1 ) FAIL; - busy_msleep( b - a / 5 ); + busy_msleep( b - a / 8 - b / 8 ); if( mbedtls_timing_get_delay( &ctx ) != 1 ) FAIL; - busy_msleep( b / 5 ); + busy_msleep( b / 4 ); if( mbedtls_timing_get_delay( &ctx ) != 2 ) FAIL; } diff --git a/ext/mbedtls/library/version.c b/ext/mbedtls/library/version.c index 4e881f0a7..6e8c318d2 100644 --- a/ext/mbedtls/library/version.c +++ b/ext/mbedtls/library/version.c @@ -1,9 +1,8 @@ /* * Version information * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/ext/mbedtls/library/version_features.c b/ext/mbedtls/library/version_features.c index 868289ce1..f2c7fec6b 100644 --- a/ext/mbedtls/library/version_features.c +++ b/ext/mbedtls/library/version_features.c @@ -1,9 +1,8 @@ /* * Version feature information * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/ext/mbedtls/library/x509.c b/ext/mbedtls/library/x509.c index 2ba3f98bf..eebb22e0f 100644 --- a/ext/mbedtls/library/x509.c +++ b/ext/mbedtls/library/x509.c @@ -1,9 +1,8 @@ /* * X.509 common functions for parsing and verification * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * The ITU-T X.509 standard defines a certificate format for PKI. @@ -1016,7 +1017,7 @@ int mbedtls_x509_self_test( int verbose ) return( 0 ); #else ((void) verbose); - return( MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE ); + return( 0 ); #endif /* MBEDTLS_CERTS_C && MBEDTLS_SHA1_C */ } diff --git a/ext/mbedtls/library/x509_create.c b/ext/mbedtls/library/x509_create.c index ed8c57797..75b64e205 100644 --- a/ext/mbedtls/library/x509_create.c +++ b/ext/mbedtls/library/x509_create.c @@ -1,9 +1,8 @@ /* * X.509 base functions for creating certificates / CSRs * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/ext/mbedtls/library/x509_crl.c b/ext/mbedtls/library/x509_crl.c index 85de93058..8398cad8d 100644 --- a/ext/mbedtls/library/x509_crl.c +++ b/ext/mbedtls/library/x509_crl.c @@ -1,9 +1,8 @@ /* * X.509 Certidicate Revocation List (CRL) parsing * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * The ITU-T X.509 standard defines a certificate format for PKI. diff --git a/ext/mbedtls/library/x509_crt.c b/ext/mbedtls/library/x509_crt.c index c837c03d1..02934df2f 100644 --- a/ext/mbedtls/library/x509_crt.c +++ b/ext/mbedtls/library/x509_crt.c @@ -1,9 +1,8 @@ /* * X.509 certificate parsing and verification * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * The ITU-T X.509 standard defines a certificate format for PKI. @@ -2062,8 +2063,8 @@ static int x509_crt_verify_child( *flags |= x509_crt_verifycrl(child, parent, ca_crl, profile ); #endif - /* Look for a grandparent upwards the chain */ - for( grandparent = parent->next; + /* Look for a grandparent in trusted CAs */ + for( grandparent = trust_ca; grandparent != NULL; grandparent = grandparent->next ) { @@ -2072,20 +2073,42 @@ static int x509_crt_verify_child( break; } - /* Is our parent part of the chain or at the top? */ if( grandparent != NULL ) { - ret = x509_crt_verify_child( parent, grandparent, trust_ca, ca_crl, profile, + ret = x509_crt_verify_top( parent, grandparent, ca_crl, profile, path_cnt + 1, &parent_flags, f_vrfy, p_vrfy ); if( ret != 0 ) return( ret ); } else { - ret = x509_crt_verify_top( parent, trust_ca, ca_crl, profile, - path_cnt + 1, &parent_flags, f_vrfy, p_vrfy ); - if( ret != 0 ) - return( ret ); + /* Look for a grandparent upwards the chain */ + for( grandparent = parent->next; + grandparent != NULL; + grandparent = grandparent->next ) + { + if( x509_crt_check_parent( parent, grandparent, + 0, path_cnt == 0 ) == 0 ) + break; + } + + /* Is our parent part of the chain or at the top? */ + if( grandparent != NULL ) + { + ret = x509_crt_verify_child( parent, grandparent, trust_ca, ca_crl, + profile, path_cnt + 1, &parent_flags, + f_vrfy, p_vrfy ); + if( ret != 0 ) + return( ret ); + } + else + { + ret = x509_crt_verify_top( parent, trust_ca, ca_crl, profile, + path_cnt + 1, &parent_flags, + f_vrfy, p_vrfy ); + if( ret != 0 ) + return( ret ); + } } /* child is verified to be a child of the parent, call verify callback */ @@ -2188,27 +2211,44 @@ int mbedtls_x509_crt_verify_with_profile( mbedtls_x509_crt *crt, } } - /* Look for a parent upwards the chain */ - for( parent = crt->next; parent != NULL; parent = parent->next ) + /* Look for a parent in trusted CAs */ + for( parent = trust_ca; parent != NULL; parent = parent->next ) { if( x509_crt_check_parent( crt, parent, 0, pathlen == 0 ) == 0 ) break; } - /* Are we part of the chain or at the top? */ if( parent != NULL ) { - ret = x509_crt_verify_child( crt, parent, trust_ca, ca_crl, profile, - pathlen, flags, f_vrfy, p_vrfy ); + ret = x509_crt_verify_top( crt, parent, ca_crl, profile, + pathlen, flags, f_vrfy, p_vrfy ); if( ret != 0 ) return( ret ); } else { - ret = x509_crt_verify_top( crt, trust_ca, ca_crl, profile, - pathlen, flags, f_vrfy, p_vrfy ); - if( ret != 0 ) - return( ret ); + /* Look for a parent upwards the chain */ + for( parent = crt->next; parent != NULL; parent = parent->next ) + { + if( x509_crt_check_parent( crt, parent, 0, pathlen == 0 ) == 0 ) + break; + } + + /* Are we part of the chain or at the top? */ + if( parent != NULL ) + { + ret = x509_crt_verify_child( crt, parent, trust_ca, ca_crl, profile, + pathlen, flags, f_vrfy, p_vrfy ); + if( ret != 0 ) + return( ret ); + } + else + { + ret = x509_crt_verify_top( crt, trust_ca, ca_crl, profile, + pathlen, flags, f_vrfy, p_vrfy ); + if( ret != 0 ) + return( ret ); + } } if( *flags != 0 ) diff --git a/ext/mbedtls/library/x509_csr.c b/ext/mbedtls/library/x509_csr.c index 0e727b445..0a15c70e5 100644 --- a/ext/mbedtls/library/x509_csr.c +++ b/ext/mbedtls/library/x509_csr.c @@ -1,9 +1,8 @@ /* * X.509 Certificate Signing Request (CSR) parsing * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * The ITU-T X.509 standard defines a certificate format for PKI. diff --git a/ext/mbedtls/library/x509write_crt.c b/ext/mbedtls/library/x509write_crt.c index 2e43084a6..112e0451d 100644 --- a/ext/mbedtls/library/x509write_crt.c +++ b/ext/mbedtls/library/x509write_crt.c @@ -1,9 +1,8 @@ /* * X.509 certificate writing * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * References: diff --git a/ext/mbedtls/library/x509write_csr.c b/ext/mbedtls/library/x509write_csr.c index 4095ba190..b8531f660 100644 --- a/ext/mbedtls/library/x509write_csr.c +++ b/ext/mbedtls/library/x509write_csr.c @@ -1,9 +1,8 @@ /* * X.509 Certificate Signing Request writing * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ /* * References: diff --git a/ext/mbedtls/library/xtea.c b/ext/mbedtls/library/xtea.c index c44892e60..4d8d37ebc 100644 --- a/ext/mbedtls/library/xtea.c +++ b/ext/mbedtls/library/xtea.c @@ -1,9 +1,8 @@ /* * An 32-bit implementation of the XTEA algorithm * - * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved - * - * This file is part of mbed TLS (https://tls.mbed.org) + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: GPL-2.0 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +17,8 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) -- 2.40.0