Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 691980 - dev-util/mingw64-runtime: does not enable secure API
Summary: dev-util/mingw64-runtime: does not enable secure API
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Sergei Trofimovich (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-12 06:53 UTC by Jason A. Donenfeld
Modified: 2019-08-13 07:10 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jason A. Donenfeld gentoo-dev 2019-08-12 06:53:47 UTC
Microsoft recommends using the _s variety of C runtime functions: https://docs.microsoft.com/en-us/cpp/c-runtime-library/security-features-in-the-crt

These are well-supported in mingw64, but the headers need to be enabled by passing `--enable-secure-api` to the `./configure` at compile time. This has the affect of sticking MINGW_HAS_SECURE_API into mingw.h:

    AC_MSG_CHECKING([whether to enable the secure API])
    AC_ARG_ENABLE([secure-api],
      [AS_HELP_STRING([--enable-secure-api],
        [Expose secure API prototypes])],
      [],
      [enable_secure_api=no])
    AC_MSG_RESULT([$enable_secure_api])
    AS_VAR_IF([enable_secure_api],[yes],
      [MINGW_HAS_SECURE_API="#define MINGW_HAS_SECURE_API 1"],
      [MINGW_HAS_SECURE_API=""])
    AC_SUBST([MINGW_HAS_SECURE_API])

Other mingw64 toolchains enable this too, for example the ones available from http://musl.cc/ .
Comment 1 Larry the Git Cow gentoo-dev 2019-08-13 07:10:35 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=25efe91bae6323a6ab9e853132d847274e53f7ef

commit 25efe91bae6323a6ab9e853132d847274e53f7ef
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2019-08-13 07:09:26 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2019-08-13 07:10:24 +0000

    dev-util/mingw64-runtime: add USE=+secure-api, bug #691980
    
    Expose *_s() family of functions by default from headers.
    
    Reported-by: Jason A. Donenfeld
    Closes: https://bugs.gentoo.org/691980
    Package-Manager: Portage-2.3.71, Repoman-2.3.17
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 dev-util/mingw64-runtime/metadata.xml              |   1 +
 .../mingw64-runtime-6.0.0-r2.ebuild                | 113 +++++++++++++++++++++
 2 files changed, 114 insertions(+)