<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
	<longdescription>
This library implements the secure C11 Annex K functions on top of most libc implementations, which are missing from them.

The ISO TR24731 Bounds Checking Interface documents indicate that the key motivation for the new specification is to help mitigate the ever increasing security attacks, specifically the buffer overrun.

The rationale document says "Buffer overrun attacks continue to be a security problem. Roughly 10% of vulnerability reports cataloged by CERT from 01/01/2005 to 07/01/2005 involved buffer overflows. Preventing buffer overruns is the primary, but not the only, motivation for this technical report."

The rationale document continues "that these only mitigate, that is lessen, security problems. When used properly, these functions decrease the danger buffer overrun attacks. Source code may remain vulnerable due to other bugs and security issues. The highest level of security is achieved by building in layers of security utilizing multiple strategies."

The rationale document lists the following key points for TR24731:

Guard against overflowing a buffer
Do not produce unterminated strings
Do not unexpectedly truncate strings
Provide a library useful to existing code
Preserve the null terminated string datatype
Only require local edits to programs
Library based solution
Support compile-time checking
Make failures obvious
Zero buffers, null strings
Runtime-constraint handler mechanism
Support re-entrant code
Consistent naming scheme
Have a uniform pattern for the function parameters and return type
Deference to existing technology
and the following can be added...

provide a library of functions with like behavior
provide a library of functions that promote and increase code safety and security
provide a library of functions that are efficient
The C11 Standard adopted many of these points, and added some secure _s variants in the Annex K. The Microsoft Windows/MINGW secure API did the same, but deviated in some functions from the standard. Besides Windows (with its msvcrt, ucrt, reactos msvcrt and wine msvcrt variants) only the unused stlport, Android's Bionic, Huawei securec and Embarcadero implemented this C11 secure Annex K API so far. They are still missing from glibc, musl, FreeBSD, darwin and DragonFly libc, OpenBSD libc, newlib, dietlibc, uClibc, minilibc.
	</longdescription>
	<maintainer type="person">
		<email>lssndrbarbieri@gmail.com</email>
		<name>Alessandro Barbieri</name>
	</maintainer>
	<upstream>
		<bugs-to>https://github.com/rurban/safeclib/issues</bugs-to>
		<remote-id type="github">rurban/safeclib</remote-id>
	</upstream>
	<use>
		<flag name="constraint-handler">enable C11 invoke_safe_{str,mem}_constraint_handler for less performance, bigger size and more flexibility</flag>
		<flag name="extensions">enable additional functions not defined in the C11 specification</flag>
		<flag name="norm-compat">Enable NFKC and NFKD modes for wcsnorm</flag>
		<flag name="nullslack">enable to null out the remaining part of a string if it is not completely used</flag>
		<flag name="unsafe">Include unsafe std C11 functions: tmpnam_s</flag>
		<flag name="valgrind">enable Valgrind on the unit tests</flag>
	</use>
</pkgmetadata>
