--- /dev/null
+Fix https://bugs.gentoo.org/705038
+
+Thanks Greg Turner <gmt@be-evil.net>
+
+diff -urpN mbedtls-mbedtls-2.19.1.orig/crypto/include/CMakeLists.txt mbedtls-mbedtls-2.19.1/crypto/include/CMakeLists.txt
+--- mbedtls-mbedtls-2.19.1.orig/crypto/include/CMakeLists.txt 2020-01-26 09:01:50.324231295 -0800
++++ mbedtls-mbedtls-2.19.1/crypto/include/CMakeLists.txt 2020-01-26 09:04:26.498880873 -0800
+@@ -5,6 +5,19 @@ if(INSTALL_MBEDTLS_HEADERS)
+ file(GLOB headers "mbedtls/*.h")
+ file(GLOB psa_headers "psa/*.h")
+
++ if(USE_CRYPTO_SUBMODULE)
++ # Don't overwrite mbedtls's header files!
++ # config.h is supposed to be automatically checked for compatibility
++ # in automatic builds, while the other files should not just be
++ # compatible, but also identical in theory.
++ # Practically, we don't check that in crypto but just assume that the
++ # submodule configuration is sane and trust tls's headers.
++ list(REMOVE_ITEM headers "${CMAKE_CURRENT_SOURCE_DIR}/mbedtls/compat-1.3.h"
++ "${CMAKE_CURRENT_SOURCE_DIR}/mbedtls/config.h"
++ "${CMAKE_CURRENT_SOURCE_DIR}/mbedtls/error.h"
++ "${CMAKE_CURRENT_SOURCE_DIR}/mbedtls/version.h")
++ endif(USE_CRYPTO_SUBMODULE)
++
+ install(FILES ${headers}
+ DESTINATION include/mbedtls
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+diff -urpN mbedtls-mbedtls-2.19.1.orig/include/CMakeLists.txt mbedtls-mbedtls-2.19.1/include/CMakeLists.txt
+--- mbedtls-mbedtls-2.19.1.orig/include/CMakeLists.txt 2020-01-26 09:01:50.320231227 -0800
++++ mbedtls-mbedtls-2.19.1/include/CMakeLists.txt 2020-01-26 09:03:45.761189288 -0800
+@@ -4,19 +4,6 @@ if(INSTALL_MBEDTLS_HEADERS)
+
+ file(GLOB headers "mbedtls/*.h")
+
+- if(USE_CRYPTO_SUBMODULE)
+- # Don't overwrite mbedtls's header files!
+- # config.h is supposed to be automatically checked for compatibility
+- # in automatic builds, while the other files should not just be
+- # compatible, but also identical in theory.
+- # Practically, we don't check that in crypto but just assume that the
+- # submodule configuration is sane and trust tls's headers.
+- list(REMOVE_ITEM headers "${CMAKE_CURRENT_SOURCE_DIR}/mbedtls/compat-1.3.h"
+- "${CMAKE_CURRENT_SOURCE_DIR}/mbedtls/config.h"
+- "${CMAKE_CURRENT_SOURCE_DIR}/mbedtls/error.h"
+- "${CMAKE_CURRENT_SOURCE_DIR}/mbedtls/version.h")
+- endif(USE_CRYPTO_SUBMODULE)
+-
+ install(FILES ${headers}
+ DESTINATION include/mbedtls
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)