Merge pull request #5135 from openluopworld/origin/mbedtls-2.16

Backport 2.16: Fix GCM calculation with very long IV
diff --git a/include/mbedtls/aes.h b/include/mbedtls/aes.h
index 33a11a7..dc5ae19 100644
--- a/include/mbedtls/aes.h
+++ b/include/mbedtls/aes.h
@@ -538,10 +538,6 @@
  * \brief      This function performs an AES-CTR encryption or decryption
  *             operation.
  *
- *             This function performs the operation defined in the \p mode
- *             parameter (encrypt/decrypt), on the input data buffer
- *             defined in the \p input parameter.
- *
  *             Due to the nature of CTR, you must use the same key schedule
  *             for both encryption and decryption operations. Therefore, you
  *             must use the context initialized with mbedtls_aes_setkey_enc()
diff --git a/include/mbedtls/sha256.h b/include/mbedtls/sha256.h
index c55177d..68386a5 100644
--- a/include/mbedtls/sha256.h
+++ b/include/mbedtls/sha256.h
@@ -264,6 +264,9 @@
  *                 be a writable buffer of length \c 32 Bytes.
  * \param is224    Determines which function to use. This must be
  *                 either \c 0 for SHA-256, or \c 1 for SHA-224.
+ *
+ * \return         \c 0 on success.
+ * \return         A negative error code on failure.
  */
 int mbedtls_sha256_ret( const unsigned char *input,
                         size_t ilen,
diff --git a/library/Makefile b/library/Makefile
index 1e1b035..6a17091 100644
--- a/library/Makefile
+++ b/library/Makefile
@@ -110,6 +110,14 @@
 
 shared: libmbedcrypto.$(DLEXT) libmbedx509.$(DLEXT) libmbedtls.$(DLEXT)
 
+# Windows builds under Mingw can fail if make tries to create archives in the same
+# directory at the same time - see https://bugs.launchpad.net/gcc-arm-embedded/+bug/1848002.
+# This forces builds of the .a files to be serialised.
+ifdef WINDOWS
+libmbedtls.a: | libmbedx509.a
+libmbedx509.a: | libmbedcrypto.a
+endif
+
 # tls
 libmbedtls.a: $(OBJS_TLS)
 	echo "  AR    $@"