@@ -57,9 +57,8 @@ _s variants in the Annex K. The Microsoft Windows/MINGW secure API did the
57
57
same, but deviated in some functions from the standard. Besides
58
58
Windows only Android's Bionic and Embarcadero implemented this C11
59
59
secure Annex K API so far.
60
- They are still missing from glibc, musl, FreeBSD and DragonFly libc,
61
- OpenBSD libc, newlib, dietlibc, uClibc, minilibc.
62
-
60
+ They are still missing from glibc, musl, FreeBSD, darwin and DragonFly
61
+ libc, OpenBSD libc, newlib, dietlibc, uClibc, minilibc.
63
62
64
63
Design Considerations
65
64
---------------------
@@ -70,7 +69,7 @@ to provide a complementary set of functions with like behavior.
70
69
This library is meant to be used on top of all the existing libc's
71
70
which miss the secure C11 functions. Of course tighter integration
72
71
into the system libc would be better, esp. with the printf, scanf and
73
- IO functions. See the seperate libc-overview.md document.
72
+ IO functions. See the seperate [ libc-overview](doc/libc-overview .md) document.
74
73
75
74
Austin Group Review of ISO/IEC WDTR 24731
76
75
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1106.txt
@@ -81,15 +80,15 @@ http://en.cppreference.com/w/c
81
80
Stackoverflow discussion:
82
81
https://stackoverflow.com/questions/372980/do-you-use-the-tr-24731-safe-functions
83
82
84
- === Use of errno
83
+ * Use of errno
85
84
86
85
The TR24731 specification says an implementation may set errno for the
87
86
functions defined in the technical report, but is not required to. This
88
87
library does not set errno. The library does use errno return codes as
89
88
required by functional APIs. Specific Safe C String and Safe C Memory errno
90
89
codes are defined in the safe_errno.h file.
91
90
92
- === Runtime-constraints
91
+ * Runtime-constraints
93
92
94
93
Per the spec, the library verifies that the calling program does not violate
95
94
the function's runtime-constraints. If a runtime-constraint is violated, the
@@ -115,16 +114,16 @@ RSIZE_MAX::
115
114
range limit for the safe string functions. RSIZE_MAX_MEM defines the
116
115
range limit for the safe memory functions. The point is that string
117
116
limits can and should be different from memory limits.
117
+ There also exist RSIZE_MAX_WSTR, RSIZE_MAX_MEM16, RSIZE_MAX_MEM32.
118
118
119
119
120
- === Header Files
120
+ * Header Files
121
121
122
122
The specification states the various functions would be added to existing
123
123
Standard C header files: stdio.h, string.h, etc. This implementation
124
- separates the memory related functions into the safe_mem_lib.h header and the
125
- string related functions into the safe_str_lib.h header.
126
- You can optionally use the safe_lib.h header to include also non str/mem
127
- functions.
124
+ separates the memory related functions into the safe_mem_lib.h header, the
125
+ string related functions into the safe_str_lib.h header, and the rest into
126
+ the safe_lib.h header.
128
127
129
128
The make file builds a single library libsafec-VERSION.a and .so in the
130
129
src/.libs directory.
@@ -145,33 +144,32 @@ library to be built on a wide variety of platforms. See the
145
144
xref:tested-platforms[``Tested Platforms''] section for details on what
146
145
platforms this library was tested on during its development.
147
146
147
+ Note that the library will behave differently if built with a C11 compiler
148
+ or not. With C11 mem{cpy,move,set}_s smax/n=0 is allowed, before not.
148
149
149
- === Building
150
+ * Building
150
151
151
152
For those familiar with autotools you can probably skip this part. For those
152
153
not and want to get right to building the code see below. And, for those that
153
154
need additional information see the 'INSTALL' file in the same directory.
154
155
155
156
.To build you do the following:
156
- ----
157
- prompt $ ./build-tools/autogen.sh
158
- prompt $ ./configure
159
- prompt $ make
160
- ----
157
+
158
+ $ ./build-tools/autogen.sh
159
+ $ ./configure
160
+ $ make
161
+
161
162
'autogen.sh' only needs to be run if you are building from the git
162
163
repository. Optionally, you can do ``make check'' if you want to run the unit
163
164
tests.
164
165
165
166
166
- === Installing
167
+ * Installing
167
168
168
169
Installation must be preformed by `root`, an `Administrator' on most
169
170
systems. The following is used to install the library.
170
171
171
- ----
172
- prompt$ sudo make install
173
- ----
174
-
172
+ $ sudo make install
175
173
176
174
Safe Linux Kernel Module
177
175
------------------------
@@ -180,13 +178,13 @@ build infrastructure. Consequently, you have to run a different makefile to
180
178
build the kernel module.
181
179
182
180
183
- === Building
181
+ * Building
184
182
185
183
.To build do the following:
186
- ----
187
- prompt $ ./configure
188
- prompt $ make -f Makefile.kernel
189
- ----
184
+
185
+ $ ./configure
186
+ $ make -f Makefile.kernel
187
+
190
188
191
189
This assumes you are compiling on a Linux box and this makefile supports the
192
190
standard kernel build system infrastructure documented in:
@@ -197,7 +195,7 @@ NOTE: If you build the kernel module then wish to build the userspace library
197
195
will fail to build.
198
196
199
197
200
- === Installing
198
+ * Installing
201
199
202
200
The kernel module will be found at the root of the source tree called
203
201
'slkm.ko'. The file 'testslkm.ko' are the unit tests run on the userspace
@@ -208,9 +206,10 @@ kernel.
208
206
[[tested-platforms]]
209
207
Tested Platforms
210
208
----------------
209
+
211
210
.The library has been tested on the following systems
212
211
- Mac OS X 10.6-11 w/ Apple developer tools and macports (gcc+clang)
213
- - Linux Debian 10 amd64 glibc 2.24
212
+ - Linux Debian 10 amd64/i386 glibc 2.24
214
213
- Linux Void amd64 musl-1.1.16
215
214
- x86_64-w64-mingw32, i686-w64-mingw32 cross-compiled and tested under wine
216
215
- i386-mingw32 cross-compiled and tested under wine
@@ -224,10 +223,7 @@ Known Issues
224
223
------------
225
224
1. If you are building the library from the git repository you will have to
226
225
first run build-tools/autogen.sh which runs autoreconf to ``install'' the
227
- autotools files and create the configure script. On Mac OSX you may see a
228
- warning about ``AC_FOREACH is obsolete'' this can be ignored as the library
229
- will still build correctly.
230
-
226
+ autotools files and create the configure script.
231
227
232
228
[bibliography]
233
229
.References
0 commit comments