Coverage Report

Created: 2025-11-09 06:31

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/krb5/src/include/k5-platform.h
Line
Count
Source
1
/* -*- mode: c; indent-tabs-mode: nil -*- */
2
/* include/k5-platform.h */
3
/*
4
 * Copyright 2003, 2004, 2005, 2007, 2008, 2009 Massachusetts Institute of Technology.
5
 * All Rights Reserved.
6
 *
7
 * Export of this software from the United States of America may
8
 *   require a specific license from the United States Government.
9
 *   It is the responsibility of any person or organization contemplating
10
 *   export to obtain such a license before exporting.
11
 *
12
 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
13
 * distribute this software and its documentation for any purpose and
14
 * without fee is hereby granted, provided that the above copyright
15
 * notice appear in all copies and that both that copyright notice and
16
 * this permission notice appear in supporting documentation, and that
17
 * the name of M.I.T. not be used in advertising or publicity pertaining
18
 * to distribution of the software without specific, written prior
19
 * permission.  Furthermore if you modify this software you must label
20
 * your software as modified software and not distribute it in such a
21
 * fashion that it might be confused with the original M.I.T. software.
22
 * M.I.T. makes no representations about the suitability of
23
 * this software for any purpose.  It is provided "as is" without express
24
 * or implied warranty.
25
 */
26
27
/*
28
 * Some platform-dependent definitions to sync up the C support level.
29
 * Some to a C99-ish level, some related utility code.
30
 *
31
 * Currently:
32
 * + [u]int{8,16,32}_t types
33
 * + 64-bit types and load/store code
34
 * + SIZE_MAX
35
 * + shared library init/fini hooks
36
 * + consistent getpwnam/getpwuid interfaces
37
 * + va_copy fudged if not provided
38
 * + strlcpy/strlcat
39
 * + fnmatch
40
 * + [v]asprintf
41
 * + strerror_r
42
 * + mkstemp
43
 * + zap (support function and macro)
44
 * + constant time memory comparison
45
 * + path manipulation
46
 * + _, N_, dgettext, bindtextdomain (for localization)
47
 * + getopt_long
48
 * + secure_getenv
49
 * + fetching filenames from a directory
50
 */
51
52
#ifndef K5_PLATFORM_H
53
#define K5_PLATFORM_H
54
55
#include "autoconf.h"
56
#include <assert.h>
57
#include <string.h>
58
#include <stdarg.h>
59
#include <stdint.h>
60
#include <limits.h>
61
#include <stdlib.h>
62
#include <stdio.h>
63
#include <fcntl.h>
64
#include <errno.h>
65
#ifdef HAVE_FNMATCH_H
66
#include <fnmatch.h>
67
#endif
68
69
#ifdef HAVE_UNISTD_H
70
#include <unistd.h>
71
#endif
72
73
#ifdef __cplusplus
74
extern "C" {
75
#endif
76
77
#ifdef _WIN32
78
#define CAN_COPY_VA_LIST
79
#endif
80
81
/* This attribute prevents unused function warnings in gcc and clang. */
82
#ifdef __GNUC__
83
#define UNUSED __attribute__((__unused__))
84
#else
85
#define UNUSED
86
#endif
87
88
#if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__))
89
#include <TargetConditionals.h>
90
#endif
91
92
/* Initialization and finalization function support for libraries.
93
94
   At top level, before the functions are defined or even declared:
95
   MAKE_INIT_FUNCTION(init_fn);
96
   MAKE_FINI_FUNCTION(fini_fn);
97
   Then:
98
   int init_fn(void) { ... }
99
   void fini_fn(void) { if (INITIALIZER_RAN(init_fn)) ... }
100
   In code, in the same file:
101
   err = CALL_INIT_FUNCTION(init_fn);
102
103
   To trigger or verify the initializer invocation from another file,
104
   a helper function must be created.
105
106
   This model handles both the load-time execution (Windows) and
107
   delayed execution (pthread_once) approaches, and should be able to
108
   guarantee in both cases that the init function is run once, in one
109
   thread, before other stuff in the library is done; furthermore, the
110
   finalization code should only run if the initialization code did.
111
   (Maybe I could've made the "if INITIALIZER_RAN" test implicit, via
112
   another function hidden in macros, but this is hairy enough
113
   already.)
114
115
   The init_fn and fini_fn names should be chosen such that any
116
   exported names staring with those names, and optionally followed by
117
   additional characters, fits in with any namespace constraints on
118
   the library in question.
119
120
121
   There's also PROGRAM_EXITING() currently always defined as zero.
122
   If there's some trivial way to find out if the fini function is
123
   being called because the program that the library is linked into is
124
   exiting, we can just skip all the work because the resources are
125
   about to be freed up anyways.  Generally this is likely to be the
126
   same as distinguishing whether the library was loaded dynamically
127
   while the program was running, or loaded as part of program
128
   startup.  On most platforms, I don't think we can distinguish these
129
   cases easily, and it's probably not worth expending any significant
130
   effort.  (Note in particular that atexit() won't do, because if the
131
   library is explicitly loaded and unloaded, it would have to be able
132
   to deregister the atexit callback function.  Also, the system limit
133
   on atexit callbacks may be small.)
134
135
136
   Implementation outline:
137
138
   Windows: MAKE_FINI_FUNCTION creates a symbol with a magic name that
139
   is sought at library build time, and code is added to invoke the
140
   function when the library is unloaded.  MAKE_INIT_FUNCTION does
141
   likewise, but the function is invoked when the library is loaded,
142
   and an extra variable is declared to hold an error code and a "yes
143
   the initializer ran" flag.  CALL_INIT_FUNCTION blows up if the flag
144
   isn't set, otherwise returns the error code.
145
146
   UNIX: MAKE_INIT_FUNCTION creates and initializes a variable with a
147
   name derived from the function name, containing a k5_once_t
148
   (pthread_once_t or int), an error code, and a pointer to the
149
   function.  The function itself is declared static, but the
150
   associated variable has external linkage.  CALL_INIT_FUNCTION
151
   ensures thath the function is called exactly once (pthread_once or
152
   just check the flag) and returns the stored error code (or the
153
   pthread_once error).
154
155
   (That's the basic idea.  With some debugging assert() calls and
156
   such, it's a bit more complicated.  And we also need to handle
157
   doing the pthread test at run time on systems where that works, so
158
   we use the k5_once_t stuff instead.)
159
160
   UNIX, with library unloading prevented or when building static
161
   libraries: we don't need to run finalizers.
162
163
   UNIX, with compiler support: MAKE_FINI_FUNCTION declares the
164
   function as a destructor, and the run time linker support or
165
   whatever will cause it to be invoked when the library is unloaded,
166
   the program ends, etc.
167
168
   UNIX, with linker support: MAKE_FINI_FUNCTION creates a symbol with
169
   a magic name that is sought at library build time, and linker
170
   options are used to mark it as a finalization function for the
171
   library.  The symbol must be exported.
172
173
   UNIX, no library finalization support: The finalization function
174
   never runs, and we leak memory.  Tough.
175
176
   DELAY_INITIALIZER will be defined by the configure script if we
177
   want to use k5_once instead of load-time initialization.  That'll
178
   be the preferred method on most systems except Windows, where we
179
   have to initialize some mutexes.
180
181
182
183
184
   For maximum flexibility in defining the macros, the function name
185
   parameter should be a simple name, not even a macro defined as
186
   another name.  The function should have a unique name, and should
187
   conform to whatever namespace is used by the library in question.
188
   (We do have export lists, but (1) they're not used for all
189
   platforms, and (2) they're not used for static libraries.)
190
191
   If the macro expansion needs the function to have been declared, it
192
   must include a declaration.  If it is not necessary for the symbol
193
   name to be exported from the object file, the macro should declare
194
   it as "static".  Hence the signature must exactly match "void
195
   foo(void)".  (ANSI C allows a static declaration followed by a
196
   non-static one; the result is internal linkage.)  The macro
197
   expansion has to come before the function, because gcc apparently
198
   won't act on "__attribute__((constructor))" if it comes after the
199
   function definition.
200
201
   This is going to be compiler- and environment-specific, and may
202
   require some support at library build time, and/or "asm"
203
   statements.  But through macro expansion and auxiliary functions,
204
   we should be able to handle most things except #pragma.
205
206
   It's okay for this code to require that the library be built
207
   with the same compiler and compiler options throughout, but
208
   we shouldn't require that the library and application use the
209
   same compiler.
210
211
   For static libraries, we don't really care about cleanup too much,
212
   since it's all memory handling and mutex allocation which will all
213
   be cleaned up when the program exits.  Thus, it's okay if gcc-built
214
   static libraries don't play nicely with cc-built executables when
215
   it comes to static constructors, just as long as it doesn't cause
216
   linking to fail.
217
218
   For dynamic libraries on UNIX, we'll use pthread_once-type support
219
   to do delayed initialization, so if finalization can't be made to
220
   work, we'll only have memory leaks in a load/use/unload cycle.  If
221
   anyone (like, say, the OS vendor) complains about this, they can
222
   tell us how to get a shared library finalization function invoked
223
   automatically.
224
225
   Currently there's --disable-delayed-initialization for preventing
226
   the initialization from being delayed on UNIX, but that's mainly
227
   just for testing the linker options for initialization, and will
228
   probably be removed at some point.  */
229
230
/* Helper macros.  */
231
232
# define JOIN__2_2(A,B) A ## _ ## _ ## B
233
# define JOIN__2(A,B) JOIN__2_2(A,B)
234
235
/* XXX Should test USE_LINKER_INIT_OPTION early, and if it's set,
236
   always provide a function by the expected name, even if we're
237
   delaying initialization.  */
238
239
#if defined(DELAY_INITIALIZER)
240
241
/* Run the initialization code during program execution, at the latest
242
   possible moment.  This means multiple threads may be active.  */
243
# include "k5-thread.h"
244
typedef struct { k5_once_t once; int error, did_run; void (*fn)(void); } k5_init_t;
245
# ifdef USE_LINKER_INIT_OPTION
246
#  define MAYBE_DUMMY_INIT(NAME)                \
247
        void JOIN__2(NAME, auxinit) () { }
248
# else
249
#  define MAYBE_DUMMY_INIT(NAME)
250
# endif
251
# ifdef __GNUC__
252
/* Do it in macro form so we get the file/line of the invocation if
253
   the assertion fails.  */
254
#  define k5_call_init_function(I)                                      \
255
        (__extension__ ({                                               \
256
                k5_init_t *k5int_i = (I);                               \
257
                int k5int_err = k5_once(&k5int_i->once, k5int_i->fn);   \
258
                (k5int_err                                              \
259
                 ? k5int_err                                            \
260
                 : (assert(k5int_i->did_run != 0), k5int_i->error));    \
261
            }))
262
#  define MAYBE_DEFINE_CALLINIT_FUNCTION
263
# else
264
#  define MAYBE_DEFINE_CALLINIT_FUNCTION                        \
265
        static inline int k5_call_init_function(k5_init_t *i)   \
266
        {                                                       \
267
            int err;                                            \
268
            err = k5_once(&i->once, i->fn);                     \
269
            if (err)                                            \
270
                return err;                                     \
271
            assert (i->did_run != 0);                           \
272
            return i->error;                                    \
273
        }
274
# endif
275
# define MAKE_INIT_FUNCTION(NAME)                               \
276
        static int NAME(void);                                  \
277
        MAYBE_DUMMY_INIT(NAME)                                  \
278
        /* forward declaration for use in initializer */        \
279
        static void JOIN__2(NAME, aux) (void);                  \
280
        static k5_init_t JOIN__2(NAME, once) =                  \
281
                { K5_ONCE_INIT, 0, 0, JOIN__2(NAME, aux) };     \
282
        MAYBE_DEFINE_CALLINIT_FUNCTION                          \
283
        static void JOIN__2(NAME, aux) (void)                   \
284
        {                                                       \
285
            JOIN__2(NAME, once).did_run = 1;                    \
286
            JOIN__2(NAME, once).error = NAME();                 \
287
        }                                                       \
288
        /* so ';' following macro use won't get error */        \
289
        static int NAME(void)
290
# define CALL_INIT_FUNCTION(NAME)       \
291
        k5_call_init_function(& JOIN__2(NAME, once))
292
/* This should be called in finalization only, so we shouldn't have
293
   multiple active threads mucking around in our library at this
294
   point.  So ignore the once_t object and just look at the flag.
295
296
   XXX Could we have problems with memory coherence between processors
297
   if we don't invoke mutex/once routines?  Probably not, the
298
   application code should already be coordinating things such that
299
   the library code is not in use by this point, and memory
300
   synchronization will be needed there.  */
301
# define INITIALIZER_RAN(NAME)  \
302
        (JOIN__2(NAME, once).did_run && JOIN__2(NAME, once).error == 0)
303
304
# define PROGRAM_EXITING()              (0)
305
306
#elif defined(__GNUC__) && !defined(_WIN32) && defined(CONSTRUCTOR_ATTR_WORKS)
307
308
/* Run initializer at load time, via GCC/C++ hook magic.  */
309
310
# ifdef USE_LINKER_INIT_OPTION
311
     /* Both gcc and linker option??  Favor gcc.  */
312
#  define MAYBE_DUMMY_INIT(NAME)                \
313
        void JOIN__2(NAME, auxinit) () { }
314
# else
315
#  define MAYBE_DUMMY_INIT(NAME)
316
# endif
317
318
typedef struct { int error; unsigned char did_run; } k5_init_t;
319
# define MAKE_INIT_FUNCTION(NAME)               \
320
        MAYBE_DUMMY_INIT(NAME)                  \
321
        static k5_init_t JOIN__2(NAME, ran)     \
322
                = { 0, 2 };                     \
323
        static void JOIN__2(NAME, aux)(void)    \
324
            __attribute__((constructor));       \
325
        static int NAME(void);                  \
326
        static void JOIN__2(NAME, aux)(void)    \
327
        {                                       \
328
            JOIN__2(NAME, ran).error = NAME();  \
329
            JOIN__2(NAME, ran).did_run = 3;     \
330
        }                                       \
331
        static int NAME(void)
332
# define CALL_INIT_FUNCTION(NAME)               \
333
        (JOIN__2(NAME, ran).did_run == 3        \
334
         ? JOIN__2(NAME, ran).error             \
335
         : (abort(),0))
336
# define INITIALIZER_RAN(NAME)  (JOIN__2(NAME,ran).did_run == 3 && JOIN__2(NAME, ran).error == 0)
337
338
# define PROGRAM_EXITING()              (0)
339
340
#elif defined(USE_LINKER_INIT_OPTION) || defined(_WIN32)
341
342
/* Run initializer at load time, via linker magic, or in the
343
   case of WIN32, win_glue.c hard-coded knowledge.  */
344
typedef struct { int error; unsigned char did_run; } k5_init_t;
345
# define MAKE_INIT_FUNCTION(NAME)               \
346
        static k5_init_t JOIN__2(NAME, ran)     \
347
                = { 0, 2 };                     \
348
        static int NAME(void);                  \
349
        void JOIN__2(NAME, auxinit)()           \
350
        {                                       \
351
            JOIN__2(NAME, ran).error = NAME();  \
352
            JOIN__2(NAME, ran).did_run = 3;     \
353
        }                                       \
354
        static int NAME(void)
355
# define CALL_INIT_FUNCTION(NAME)               \
356
        (JOIN__2(NAME, ran).did_run == 3        \
357
         ? JOIN__2(NAME, ran).error             \
358
         : (abort(),0))
359
# define INITIALIZER_RAN(NAME)  \
360
        (JOIN__2(NAME, ran).error == 0)
361
362
# define PROGRAM_EXITING()              (0)
363
364
#else
365
366
# error "Don't know how to do load-time initializers for this configuration."
367
368
# define PROGRAM_EXITING()              (0)
369
370
#endif
371
372
373
374
#if defined(USE_LINKER_FINI_OPTION) || defined(_WIN32)
375
/* If we're told the linker option will be used, it doesn't really
376
   matter what compiler we're using.  Do it the same way
377
   regardless.  */
378
379
#  define MAKE_FINI_FUNCTION(NAME)      \
380
        void NAME(void)
381
382
#elif !defined(SHARED) || defined(LIB_UNLOAD_PREVENTED)
383
384
/*
385
 * In this case, we just don't care about finalization.  The code will still
386
 * define the function, but we won't do anything with it.
387
 */
388
# define MAKE_FINI_FUNCTION(NAME)               \
389
        static void NAME(void) UNUSED
390
391
#elif defined(__GNUC__) && defined(DESTRUCTOR_ATTR_WORKS)
392
/* If we're using gcc, if the C++ support works, the compiler should
393
   build executables and shared libraries that support the use of
394
   static constructors and destructors.  The C compiler supports a
395
   function attribute that makes use of the same facility as C++.
396
397
   XXX How do we know if the C++ support actually works?  */
398
# define MAKE_FINI_FUNCTION(NAME)       \
399
        static void NAME(void) __attribute__((destructor))
400
401
#else
402
403
# error "Don't know how to do unload-time finalization for this configuration."
404
405
#endif
406
407
#ifndef SIZE_MAX
408
# define SIZE_MAX ((size_t)((size_t)0 - 1))
409
#endif
410
411
#ifdef _WIN32
412
# define SSIZE_MAX ((ssize_t)(SIZE_MAX/2))
413
#endif
414
415
/* Read and write integer values as (unaligned) octet strings in
416
   specific byte orders.  Add per-platform optimizations as
417
   needed.  */
418
419
#if HAVE_ENDIAN_H
420
# include <endian.h>
421
#elif HAVE_MACHINE_ENDIAN_H
422
# include <machine/endian.h>
423
#endif
424
/* Check for BIG/LITTLE_ENDIAN macros.  If exactly one is defined, use
425
   it.  If both are defined, then BYTE_ORDER should be defined and
426
   match one of them.  Try those symbols, then try again with an
427
   underscore prefix.  */
428
#if defined(BIG_ENDIAN) && defined(LITTLE_ENDIAN)
429
# if BYTE_ORDER == BIG_ENDIAN
430
#  define K5_BE
431
# endif
432
# if BYTE_ORDER == LITTLE_ENDIAN
433
#  define K5_LE
434
# endif
435
#elif defined(BIG_ENDIAN)
436
# define K5_BE
437
#elif defined(LITTLE_ENDIAN)
438
# define K5_LE
439
#elif defined(_BIG_ENDIAN) && defined(_LITTLE_ENDIAN)
440
# if _BYTE_ORDER == _BIG_ENDIAN
441
#  define K5_BE
442
# endif
443
# if _BYTE_ORDER == _LITTLE_ENDIAN
444
#  define K5_LE
445
# endif
446
#elif defined(_BIG_ENDIAN)
447
# define K5_BE
448
#elif defined(_LITTLE_ENDIAN)
449
# define K5_LE
450
#elif defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)
451
# define K5_BE
452
#elif defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
453
# define K5_LE
454
#endif
455
#if !defined(K5_BE) && !defined(K5_LE)
456
/* Look for some architectures we know about.
457
458
   MIPS can use either byte order, but the preprocessor tells us which
459
   mode we're compiling for.  The GCC config files indicate that
460
   variants of Alpha and IA64 might be out there with both byte
461
   orders, but until we encounter the "wrong" ones in the real world,
462
   just go with the default (unless there are cpp predefines to help
463
   us there too).
464
465
   As far as I know, only PDP11 and ARM (which we don't handle here)
466
   have strange byte orders where an 8-byte value isn't laid out as
467
   either 12345678 or 87654321.  */
468
# if defined(__i386__) || defined(_MIPSEL) || defined(__alpha__) || (defined(__ia64__) && !defined(__hpux))
469
#  define K5_LE
470
# endif
471
# if defined(__hppa__) || defined(__rs6000__) || defined(__sparc__) || defined(_MIPSEB) || defined(__m68k__) || defined(__sparc64__) || defined(__ppc__) || defined(__ppc64__) || (defined(__hpux) && defined(__ia64__))
472
#  define K5_BE
473
# endif
474
#endif
475
#if defined(K5_BE) && defined(K5_LE)
476
# error "oops, check the byte order macros"
477
#endif
478
479
/* Optimize for GCC on platforms with known byte orders.
480
481
   GCC's packed structures can be written to with any alignment; the
482
   compiler will use byte operations, unaligned-word operations, or
483
   normal memory ops as appropriate for the architecture.
484
485
   This assumes the availability of uint##_t types, which should work
486
   on most of our platforms except Windows, where we're not using
487
   GCC.  */
488
#ifdef __GNUC__
489
0
# define PUT(SIZE,PTR,VAL)      (((struct { uint##SIZE##_t i; } __attribute__((packed)) *)(PTR))->i = (VAL))
490
0
# define GET(SIZE,PTR)          (((const struct { uint##SIZE##_t i; } __attribute__((packed)) *)(PTR))->i)
491
0
# define PUTSWAPPED(SIZE,PTR,VAL)       PUT(SIZE,PTR,SWAP##SIZE(VAL))
492
0
# define GETSWAPPED(SIZE,PTR)           SWAP##SIZE(GET(SIZE,PTR))
493
#endif
494
/* To do: Define SWAP16, SWAP32, SWAP64 macros to byte-swap values
495
   with the indicated numbers of bits.
496
497
   Linux: byteswap.h, bswap_16 etc.
498
   Solaris 10: none
499
   macOS: machine/endian.h or byte_order.h, NXSwap{Short,Int,LongLong}
500
   NetBSD: sys/bswap.h, bswap16 etc.  */
501
502
#if defined(HAVE_BYTESWAP_H) && defined(HAVE_BSWAP_16)
503
# include <byteswap.h>
504
# define SWAP16                 bswap_16
505
0
# define SWAP32                 bswap_32
506
# ifdef HAVE_BSWAP_64
507
#  define SWAP64                bswap_64
508
# endif
509
#elif TARGET_OS_MAC
510
# include <architecture/byte_order.h>
511
# define SWAP16                k5_swap16
512
static inline unsigned int k5_swap16 (unsigned int x) {
513
    x &= 0xffff;
514
    return (x >> 8) | ((x & 0xff) << 8);
515
}
516
# define SWAP32                 OSSwapInt32
517
# define SWAP64                 OSSwapInt64
518
#elif defined(HAVE_SYS_BSWAP_H)
519
/* XXX NetBSD/x86 5.0.1 defines bswap16 and bswap32 as inline
520
   functions only, so autoconf doesn't pick up on their existence.
521
   So, no feature macro test for them here.  The 64-bit version isn't
522
   inline at all, though, for whatever reason.  */
523
# include <sys/bswap.h>
524
# define SWAP16                 bswap16
525
# define SWAP32                 bswap32
526
/* However, bswap64 causes lots of warnings about 'long long'
527
   constants; probably only on 32-bit platforms.  */
528
# if LONG_MAX > 0x7fffffffL
529
#  define SWAP64                bswap64
530
# endif
531
#endif
532
533
/* Note that on Windows at least this file can be included from C++
534
   source, so casts *from* void* are required.  */
535
static inline void
536
store_16_be (unsigned int val, void *vp)
537
0
{
538
0
    unsigned char *p = (unsigned char *) vp;
539
0
#if defined(__GNUC__) && defined(K5_BE) && !defined(__cplusplus)
540
0
    PUT(16,p,val);
541
0
#elif defined(__GNUC__) && defined(K5_LE) && defined(SWAP16) && !defined(__cplusplus)
542
0
    PUTSWAPPED(16,p,val);
543
0
#else
544
0
    p[0] = (val >>  8) & 0xff;
545
0
    p[1] = (val      ) & 0xff;
546
0
#endif
547
0
}
Unexecuted instantiation: fuzz_aes.c:store_16_be
Unexecuted instantiation: key.c:store_16_be
Unexecuted instantiation: keyblocks.c:store_16_be
Unexecuted instantiation: aes.c:store_16_be
Unexecuted instantiation: aead.c:store_16_be
Unexecuted instantiation: default_state.c:store_16_be
Unexecuted instantiation: etypes.c:store_16_be
Unexecuted instantiation: prf_aes2.c:store_16_be
Unexecuted instantiation: prf_cmac.c:store_16_be
Unexecuted instantiation: prf_dk.c:store_16_be
Unexecuted instantiation: prf_rc4.c:store_16_be
Unexecuted instantiation: random_to_key.c:store_16_be
Unexecuted instantiation: s2k_pbkdf2.c:store_16_be
Unexecuted instantiation: s2k_rc4.c:store_16_be
Unexecuted instantiation: cmac.c:store_16_be
Unexecuted instantiation: hmac.c:store_16_be
Unexecuted instantiation: kdf.c:store_16_be
Unexecuted instantiation: pbkdf2.c:store_16_be
Unexecuted instantiation: des_keys.c:store_16_be
Unexecuted instantiation: f_parity.c:store_16_be
Unexecuted instantiation: aescrypt.c:store_16_be
Unexecuted instantiation: aestab.c:store_16_be
Unexecuted instantiation: aeskey.c:store_16_be
Unexecuted instantiation: des3.c:store_16_be
Unexecuted instantiation: rc4.c:store_16_be
Unexecuted instantiation: camellia.c:store_16_be
Unexecuted instantiation: hash_md4.c:store_16_be
Unexecuted instantiation: hash_md5.c:store_16_be
Unexecuted instantiation: hash_sha1.c:store_16_be
Unexecuted instantiation: hash_sha2.c:store_16_be
Unexecuted instantiation: derive.c:store_16_be
Unexecuted instantiation: enc_dk_cmac.c:store_16_be
Unexecuted instantiation: enc_dk_hmac.c:store_16_be
Unexecuted instantiation: enc_etm.c:store_16_be
Unexecuted instantiation: enc_raw.c:store_16_be
Unexecuted instantiation: enc_rc4.c:store_16_be
Unexecuted instantiation: nfold.c:store_16_be
Unexecuted instantiation: prng.c:store_16_be
Unexecuted instantiation: d3_aead.c:store_16_be
Unexecuted instantiation: d3_kysched.c:store_16_be
Unexecuted instantiation: f_aead.c:store_16_be
Unexecuted instantiation: f_sched.c:store_16_be
Unexecuted instantiation: f_tables.c:store_16_be
Unexecuted instantiation: weak_key.c:store_16_be
Unexecuted instantiation: md4.c:store_16_be
Unexecuted instantiation: md5.c:store_16_be
Unexecuted instantiation: shs.c:store_16_be
Unexecuted instantiation: sha256.c:store_16_be
Unexecuted instantiation: sha512.c:store_16_be
Unexecuted instantiation: utf8_conv.c:store_16_be
Unexecuted instantiation: bcmp.c:store_16_be
Unexecuted instantiation: k5buf.c:store_16_be
Unexecuted instantiation: utf8.c:store_16_be
548
static inline void
549
store_32_be (unsigned int val, void *vp)
550
0
{
551
0
    unsigned char *p = (unsigned char *) vp;
552
#if defined(__GNUC__) && defined(K5_BE) && !defined(__cplusplus)
553
    PUT(32,p,val);
554
#elif defined(__GNUC__) && defined(K5_LE) && defined(SWAP32) && !defined(__cplusplus)
555
0
    PUTSWAPPED(32,p,val);
556
#else
557
    p[0] = (val >> 24) & 0xff;
558
    p[1] = (val >> 16) & 0xff;
559
    p[2] = (val >>  8) & 0xff;
560
    p[3] = (val      ) & 0xff;
561
#endif
562
0
}
Unexecuted instantiation: fuzz_aes.c:store_32_be
Unexecuted instantiation: key.c:store_32_be
Unexecuted instantiation: keyblocks.c:store_32_be
Unexecuted instantiation: aes.c:store_32_be
Unexecuted instantiation: aead.c:store_32_be
Unexecuted instantiation: default_state.c:store_32_be
Unexecuted instantiation: etypes.c:store_32_be
Unexecuted instantiation: prf_aes2.c:store_32_be
Unexecuted instantiation: prf_cmac.c:store_32_be
Unexecuted instantiation: prf_dk.c:store_32_be
Unexecuted instantiation: prf_rc4.c:store_32_be
Unexecuted instantiation: random_to_key.c:store_32_be
Unexecuted instantiation: s2k_pbkdf2.c:store_32_be
Unexecuted instantiation: s2k_rc4.c:store_32_be
Unexecuted instantiation: cmac.c:store_32_be
Unexecuted instantiation: hmac.c:store_32_be
Unexecuted instantiation: kdf.c:store_32_be
Unexecuted instantiation: pbkdf2.c:store_32_be
Unexecuted instantiation: des_keys.c:store_32_be
Unexecuted instantiation: f_parity.c:store_32_be
Unexecuted instantiation: aescrypt.c:store_32_be
Unexecuted instantiation: aestab.c:store_32_be
Unexecuted instantiation: aeskey.c:store_32_be
Unexecuted instantiation: des3.c:store_32_be
Unexecuted instantiation: rc4.c:store_32_be
Unexecuted instantiation: camellia.c:store_32_be
Unexecuted instantiation: hash_md4.c:store_32_be
Unexecuted instantiation: hash_md5.c:store_32_be
Unexecuted instantiation: hash_sha1.c:store_32_be
Unexecuted instantiation: hash_sha2.c:store_32_be
Unexecuted instantiation: derive.c:store_32_be
Unexecuted instantiation: enc_dk_cmac.c:store_32_be
Unexecuted instantiation: enc_dk_hmac.c:store_32_be
Unexecuted instantiation: enc_etm.c:store_32_be
Unexecuted instantiation: enc_raw.c:store_32_be
Unexecuted instantiation: enc_rc4.c:store_32_be
Unexecuted instantiation: nfold.c:store_32_be
Unexecuted instantiation: prng.c:store_32_be
Unexecuted instantiation: d3_aead.c:store_32_be
Unexecuted instantiation: d3_kysched.c:store_32_be
Unexecuted instantiation: f_aead.c:store_32_be
Unexecuted instantiation: f_sched.c:store_32_be
Unexecuted instantiation: f_tables.c:store_32_be
Unexecuted instantiation: weak_key.c:store_32_be
Unexecuted instantiation: md4.c:store_32_be
Unexecuted instantiation: md5.c:store_32_be
Unexecuted instantiation: shs.c:store_32_be
Unexecuted instantiation: sha256.c:store_32_be
Unexecuted instantiation: sha512.c:store_32_be
Unexecuted instantiation: utf8_conv.c:store_32_be
Unexecuted instantiation: bcmp.c:store_32_be
Unexecuted instantiation: k5buf.c:store_32_be
Unexecuted instantiation: utf8.c:store_32_be
563
static inline void
564
store_64_be (uint64_t val, void *vp)
565
0
{
566
0
    unsigned char *p = (unsigned char *) vp;
567
0
#if defined(__GNUC__) && defined(K5_BE) && !defined(__cplusplus)
568
0
    PUT(64,p,val);
569
0
#elif defined(__GNUC__) && defined(K5_LE) && defined(SWAP64) && !defined(__cplusplus)
570
0
    PUTSWAPPED(64,p,val);
571
0
#else
572
0
    p[0] = (unsigned char)((val >> 56) & 0xff);
573
0
    p[1] = (unsigned char)((val >> 48) & 0xff);
574
0
    p[2] = (unsigned char)((val >> 40) & 0xff);
575
0
    p[3] = (unsigned char)((val >> 32) & 0xff);
576
0
    p[4] = (unsigned char)((val >> 24) & 0xff);
577
0
    p[5] = (unsigned char)((val >> 16) & 0xff);
578
0
    p[6] = (unsigned char)((val >>  8) & 0xff);
579
0
    p[7] = (unsigned char)((val      ) & 0xff);
580
0
#endif
581
0
}
Unexecuted instantiation: fuzz_aes.c:store_64_be
Unexecuted instantiation: key.c:store_64_be
Unexecuted instantiation: keyblocks.c:store_64_be
Unexecuted instantiation: aes.c:store_64_be
Unexecuted instantiation: aead.c:store_64_be
Unexecuted instantiation: default_state.c:store_64_be
Unexecuted instantiation: etypes.c:store_64_be
Unexecuted instantiation: prf_aes2.c:store_64_be
Unexecuted instantiation: prf_cmac.c:store_64_be
Unexecuted instantiation: prf_dk.c:store_64_be
Unexecuted instantiation: prf_rc4.c:store_64_be
Unexecuted instantiation: random_to_key.c:store_64_be
Unexecuted instantiation: s2k_pbkdf2.c:store_64_be
Unexecuted instantiation: s2k_rc4.c:store_64_be
Unexecuted instantiation: cmac.c:store_64_be
Unexecuted instantiation: hmac.c:store_64_be
Unexecuted instantiation: kdf.c:store_64_be
Unexecuted instantiation: pbkdf2.c:store_64_be
Unexecuted instantiation: des_keys.c:store_64_be
Unexecuted instantiation: f_parity.c:store_64_be
Unexecuted instantiation: aescrypt.c:store_64_be
Unexecuted instantiation: aestab.c:store_64_be
Unexecuted instantiation: aeskey.c:store_64_be
Unexecuted instantiation: des3.c:store_64_be
Unexecuted instantiation: rc4.c:store_64_be
Unexecuted instantiation: camellia.c:store_64_be
Unexecuted instantiation: hash_md4.c:store_64_be
Unexecuted instantiation: hash_md5.c:store_64_be
Unexecuted instantiation: hash_sha1.c:store_64_be
Unexecuted instantiation: hash_sha2.c:store_64_be
Unexecuted instantiation: derive.c:store_64_be
Unexecuted instantiation: enc_dk_cmac.c:store_64_be
Unexecuted instantiation: enc_dk_hmac.c:store_64_be
Unexecuted instantiation: enc_etm.c:store_64_be
Unexecuted instantiation: enc_raw.c:store_64_be
Unexecuted instantiation: enc_rc4.c:store_64_be
Unexecuted instantiation: nfold.c:store_64_be
Unexecuted instantiation: prng.c:store_64_be
Unexecuted instantiation: d3_aead.c:store_64_be
Unexecuted instantiation: d3_kysched.c:store_64_be
Unexecuted instantiation: f_aead.c:store_64_be
Unexecuted instantiation: f_sched.c:store_64_be
Unexecuted instantiation: f_tables.c:store_64_be
Unexecuted instantiation: weak_key.c:store_64_be
Unexecuted instantiation: md4.c:store_64_be
Unexecuted instantiation: md5.c:store_64_be
Unexecuted instantiation: shs.c:store_64_be
Unexecuted instantiation: sha256.c:store_64_be
Unexecuted instantiation: sha512.c:store_64_be
Unexecuted instantiation: utf8_conv.c:store_64_be
Unexecuted instantiation: bcmp.c:store_64_be
Unexecuted instantiation: k5buf.c:store_64_be
Unexecuted instantiation: utf8.c:store_64_be
582
static inline unsigned short
583
load_16_be (const void *cvp)
584
0
{
585
0
    const unsigned char *p = (const unsigned char *) cvp;
586
0
#if defined(__GNUC__) && defined(K5_BE) && !defined(__cplusplus)
587
0
    return GET(16,p);
588
0
#elif defined(__GNUC__) && defined(K5_LE) && defined(SWAP16) && !defined(__cplusplus)
589
0
    return GETSWAPPED(16,p);
590
0
#else
591
0
    return (p[1] | (p[0] << 8));
592
0
#endif
593
0
}
Unexecuted instantiation: fuzz_aes.c:load_16_be
Unexecuted instantiation: key.c:load_16_be
Unexecuted instantiation: keyblocks.c:load_16_be
Unexecuted instantiation: aes.c:load_16_be
Unexecuted instantiation: aead.c:load_16_be
Unexecuted instantiation: default_state.c:load_16_be
Unexecuted instantiation: etypes.c:load_16_be
Unexecuted instantiation: prf_aes2.c:load_16_be
Unexecuted instantiation: prf_cmac.c:load_16_be
Unexecuted instantiation: prf_dk.c:load_16_be
Unexecuted instantiation: prf_rc4.c:load_16_be
Unexecuted instantiation: random_to_key.c:load_16_be
Unexecuted instantiation: s2k_pbkdf2.c:load_16_be
Unexecuted instantiation: s2k_rc4.c:load_16_be
Unexecuted instantiation: cmac.c:load_16_be
Unexecuted instantiation: hmac.c:load_16_be
Unexecuted instantiation: kdf.c:load_16_be
Unexecuted instantiation: pbkdf2.c:load_16_be
Unexecuted instantiation: des_keys.c:load_16_be
Unexecuted instantiation: f_parity.c:load_16_be
Unexecuted instantiation: aescrypt.c:load_16_be
Unexecuted instantiation: aestab.c:load_16_be
Unexecuted instantiation: aeskey.c:load_16_be
Unexecuted instantiation: des3.c:load_16_be
Unexecuted instantiation: rc4.c:load_16_be
Unexecuted instantiation: camellia.c:load_16_be
Unexecuted instantiation: hash_md4.c:load_16_be
Unexecuted instantiation: hash_md5.c:load_16_be
Unexecuted instantiation: hash_sha1.c:load_16_be
Unexecuted instantiation: hash_sha2.c:load_16_be
Unexecuted instantiation: derive.c:load_16_be
Unexecuted instantiation: enc_dk_cmac.c:load_16_be
Unexecuted instantiation: enc_dk_hmac.c:load_16_be
Unexecuted instantiation: enc_etm.c:load_16_be
Unexecuted instantiation: enc_raw.c:load_16_be
Unexecuted instantiation: enc_rc4.c:load_16_be
Unexecuted instantiation: nfold.c:load_16_be
Unexecuted instantiation: prng.c:load_16_be
Unexecuted instantiation: d3_aead.c:load_16_be
Unexecuted instantiation: d3_kysched.c:load_16_be
Unexecuted instantiation: f_aead.c:load_16_be
Unexecuted instantiation: f_sched.c:load_16_be
Unexecuted instantiation: f_tables.c:load_16_be
Unexecuted instantiation: weak_key.c:load_16_be
Unexecuted instantiation: md4.c:load_16_be
Unexecuted instantiation: md5.c:load_16_be
Unexecuted instantiation: shs.c:load_16_be
Unexecuted instantiation: sha256.c:load_16_be
Unexecuted instantiation: sha512.c:load_16_be
Unexecuted instantiation: utf8_conv.c:load_16_be
Unexecuted instantiation: bcmp.c:load_16_be
Unexecuted instantiation: k5buf.c:load_16_be
Unexecuted instantiation: utf8.c:load_16_be
594
static inline unsigned int
595
load_32_be (const void *cvp)
596
0
{
597
0
    const unsigned char *p = (const unsigned char *) cvp;
598
#if defined(__GNUC__) && defined(K5_BE) && !defined(__cplusplus)
599
    return GET(32,p);
600
#elif defined(__GNUC__) && defined(K5_LE) && defined(SWAP32) && !defined(__cplusplus)
601
0
    return GETSWAPPED(32,p);
602
#else
603
    return (p[3] | (p[2] << 8)
604
            | ((uint32_t) p[1] << 16)
605
            | ((uint32_t) p[0] << 24));
606
#endif
607
0
}
Unexecuted instantiation: fuzz_aes.c:load_32_be
Unexecuted instantiation: key.c:load_32_be
Unexecuted instantiation: keyblocks.c:load_32_be
Unexecuted instantiation: aes.c:load_32_be
Unexecuted instantiation: aead.c:load_32_be
Unexecuted instantiation: default_state.c:load_32_be
Unexecuted instantiation: etypes.c:load_32_be
Unexecuted instantiation: prf_aes2.c:load_32_be
Unexecuted instantiation: prf_cmac.c:load_32_be
Unexecuted instantiation: prf_dk.c:load_32_be
Unexecuted instantiation: prf_rc4.c:load_32_be
Unexecuted instantiation: random_to_key.c:load_32_be
Unexecuted instantiation: s2k_pbkdf2.c:load_32_be
Unexecuted instantiation: s2k_rc4.c:load_32_be
Unexecuted instantiation: cmac.c:load_32_be
Unexecuted instantiation: hmac.c:load_32_be
Unexecuted instantiation: kdf.c:load_32_be
Unexecuted instantiation: pbkdf2.c:load_32_be
Unexecuted instantiation: des_keys.c:load_32_be
Unexecuted instantiation: f_parity.c:load_32_be
Unexecuted instantiation: aescrypt.c:load_32_be
Unexecuted instantiation: aestab.c:load_32_be
Unexecuted instantiation: aeskey.c:load_32_be
Unexecuted instantiation: des3.c:load_32_be
Unexecuted instantiation: rc4.c:load_32_be
Unexecuted instantiation: camellia.c:load_32_be
Unexecuted instantiation: hash_md4.c:load_32_be
Unexecuted instantiation: hash_md5.c:load_32_be
Unexecuted instantiation: hash_sha1.c:load_32_be
Unexecuted instantiation: hash_sha2.c:load_32_be
Unexecuted instantiation: derive.c:load_32_be
Unexecuted instantiation: enc_dk_cmac.c:load_32_be
Unexecuted instantiation: enc_dk_hmac.c:load_32_be
Unexecuted instantiation: enc_etm.c:load_32_be
Unexecuted instantiation: enc_raw.c:load_32_be
Unexecuted instantiation: enc_rc4.c:load_32_be
Unexecuted instantiation: nfold.c:load_32_be
Unexecuted instantiation: prng.c:load_32_be
Unexecuted instantiation: d3_aead.c:load_32_be
Unexecuted instantiation: d3_kysched.c:load_32_be
Unexecuted instantiation: f_aead.c:load_32_be
Unexecuted instantiation: f_sched.c:load_32_be
Unexecuted instantiation: f_tables.c:load_32_be
Unexecuted instantiation: weak_key.c:load_32_be
Unexecuted instantiation: md4.c:load_32_be
Unexecuted instantiation: md5.c:load_32_be
Unexecuted instantiation: shs.c:load_32_be
Unexecuted instantiation: sha256.c:load_32_be
Unexecuted instantiation: sha512.c:load_32_be
Unexecuted instantiation: utf8_conv.c:load_32_be
Unexecuted instantiation: bcmp.c:load_32_be
Unexecuted instantiation: k5buf.c:load_32_be
Unexecuted instantiation: utf8.c:load_32_be
608
static inline uint64_t
609
load_64_be (const void *cvp)
610
0
{
611
0
    const unsigned char *p = (const unsigned char *) cvp;
612
0
#if defined(__GNUC__) && defined(K5_BE) && !defined(__cplusplus)
613
0
    return GET(64,p);
614
0
#elif defined(__GNUC__) && defined(K5_LE) && defined(SWAP64) && !defined(__cplusplus)
615
0
    return GETSWAPPED(64,p);
616
0
#else
617
0
    return ((uint64_t)load_32_be(p) << 32) | load_32_be(p+4);
618
0
#endif
619
0
}
Unexecuted instantiation: fuzz_aes.c:load_64_be
Unexecuted instantiation: key.c:load_64_be
Unexecuted instantiation: keyblocks.c:load_64_be
Unexecuted instantiation: aes.c:load_64_be
Unexecuted instantiation: aead.c:load_64_be
Unexecuted instantiation: default_state.c:load_64_be
Unexecuted instantiation: etypes.c:load_64_be
Unexecuted instantiation: prf_aes2.c:load_64_be
Unexecuted instantiation: prf_cmac.c:load_64_be
Unexecuted instantiation: prf_dk.c:load_64_be
Unexecuted instantiation: prf_rc4.c:load_64_be
Unexecuted instantiation: random_to_key.c:load_64_be
Unexecuted instantiation: s2k_pbkdf2.c:load_64_be
Unexecuted instantiation: s2k_rc4.c:load_64_be
Unexecuted instantiation: cmac.c:load_64_be
Unexecuted instantiation: hmac.c:load_64_be
Unexecuted instantiation: kdf.c:load_64_be
Unexecuted instantiation: pbkdf2.c:load_64_be
Unexecuted instantiation: des_keys.c:load_64_be
Unexecuted instantiation: f_parity.c:load_64_be
Unexecuted instantiation: aescrypt.c:load_64_be
Unexecuted instantiation: aestab.c:load_64_be
Unexecuted instantiation: aeskey.c:load_64_be
Unexecuted instantiation: des3.c:load_64_be
Unexecuted instantiation: rc4.c:load_64_be
Unexecuted instantiation: camellia.c:load_64_be
Unexecuted instantiation: hash_md4.c:load_64_be
Unexecuted instantiation: hash_md5.c:load_64_be
Unexecuted instantiation: hash_sha1.c:load_64_be
Unexecuted instantiation: hash_sha2.c:load_64_be
Unexecuted instantiation: derive.c:load_64_be
Unexecuted instantiation: enc_dk_cmac.c:load_64_be
Unexecuted instantiation: enc_dk_hmac.c:load_64_be
Unexecuted instantiation: enc_etm.c:load_64_be
Unexecuted instantiation: enc_raw.c:load_64_be
Unexecuted instantiation: enc_rc4.c:load_64_be
Unexecuted instantiation: nfold.c:load_64_be
Unexecuted instantiation: prng.c:load_64_be
Unexecuted instantiation: d3_aead.c:load_64_be
Unexecuted instantiation: d3_kysched.c:load_64_be
Unexecuted instantiation: f_aead.c:load_64_be
Unexecuted instantiation: f_sched.c:load_64_be
Unexecuted instantiation: f_tables.c:load_64_be
Unexecuted instantiation: weak_key.c:load_64_be
Unexecuted instantiation: md4.c:load_64_be
Unexecuted instantiation: md5.c:load_64_be
Unexecuted instantiation: shs.c:load_64_be
Unexecuted instantiation: sha256.c:load_64_be
Unexecuted instantiation: sha512.c:load_64_be
Unexecuted instantiation: utf8_conv.c:load_64_be
Unexecuted instantiation: bcmp.c:load_64_be
Unexecuted instantiation: k5buf.c:load_64_be
Unexecuted instantiation: utf8.c:load_64_be
620
static inline void
621
store_16_le (unsigned int val, void *vp)
622
0
{
623
0
    unsigned char *p = (unsigned char *) vp;
624
0
#if defined(__GNUC__) && defined(K5_LE) && !defined(__cplusplus)
625
0
    PUT(16,p,val);
626
#elif defined(__GNUC__) && defined(K5_BE) && defined(SWAP16) && !defined(__cplusplus)
627
    PUTSWAPPED(16,p,val);
628
#else
629
    p[1] = (val >>  8) & 0xff;
630
    p[0] = (val      ) & 0xff;
631
#endif
632
0
}
Unexecuted instantiation: fuzz_aes.c:store_16_le
Unexecuted instantiation: key.c:store_16_le
Unexecuted instantiation: keyblocks.c:store_16_le
Unexecuted instantiation: aes.c:store_16_le
Unexecuted instantiation: aead.c:store_16_le
Unexecuted instantiation: default_state.c:store_16_le
Unexecuted instantiation: etypes.c:store_16_le
Unexecuted instantiation: prf_aes2.c:store_16_le
Unexecuted instantiation: prf_cmac.c:store_16_le
Unexecuted instantiation: prf_dk.c:store_16_le
Unexecuted instantiation: prf_rc4.c:store_16_le
Unexecuted instantiation: random_to_key.c:store_16_le
Unexecuted instantiation: s2k_pbkdf2.c:store_16_le
Unexecuted instantiation: s2k_rc4.c:store_16_le
Unexecuted instantiation: cmac.c:store_16_le
Unexecuted instantiation: hmac.c:store_16_le
Unexecuted instantiation: kdf.c:store_16_le
Unexecuted instantiation: pbkdf2.c:store_16_le
Unexecuted instantiation: des_keys.c:store_16_le
Unexecuted instantiation: f_parity.c:store_16_le
Unexecuted instantiation: aescrypt.c:store_16_le
Unexecuted instantiation: aestab.c:store_16_le
Unexecuted instantiation: aeskey.c:store_16_le
Unexecuted instantiation: des3.c:store_16_le
Unexecuted instantiation: rc4.c:store_16_le
Unexecuted instantiation: camellia.c:store_16_le
Unexecuted instantiation: hash_md4.c:store_16_le
Unexecuted instantiation: hash_md5.c:store_16_le
Unexecuted instantiation: hash_sha1.c:store_16_le
Unexecuted instantiation: hash_sha2.c:store_16_le
Unexecuted instantiation: derive.c:store_16_le
Unexecuted instantiation: enc_dk_cmac.c:store_16_le
Unexecuted instantiation: enc_dk_hmac.c:store_16_le
Unexecuted instantiation: enc_etm.c:store_16_le
Unexecuted instantiation: enc_raw.c:store_16_le
Unexecuted instantiation: enc_rc4.c:store_16_le
Unexecuted instantiation: nfold.c:store_16_le
Unexecuted instantiation: prng.c:store_16_le
Unexecuted instantiation: d3_aead.c:store_16_le
Unexecuted instantiation: d3_kysched.c:store_16_le
Unexecuted instantiation: f_aead.c:store_16_le
Unexecuted instantiation: f_sched.c:store_16_le
Unexecuted instantiation: f_tables.c:store_16_le
Unexecuted instantiation: weak_key.c:store_16_le
Unexecuted instantiation: md4.c:store_16_le
Unexecuted instantiation: md5.c:store_16_le
Unexecuted instantiation: shs.c:store_16_le
Unexecuted instantiation: sha256.c:store_16_le
Unexecuted instantiation: sha512.c:store_16_le
Unexecuted instantiation: utf8_conv.c:store_16_le
Unexecuted instantiation: bcmp.c:store_16_le
Unexecuted instantiation: k5buf.c:store_16_le
Unexecuted instantiation: utf8.c:store_16_le
633
static inline void
634
store_32_le (unsigned int val, void *vp)
635
0
{
636
0
    unsigned char *p = (unsigned char *) vp;
637
0
#if defined(__GNUC__) && defined(K5_LE) && !defined(__cplusplus)
638
0
    PUT(32,p,val);
639
#elif defined(__GNUC__) && defined(K5_BE) && defined(SWAP32) && !defined(__cplusplus)
640
    PUTSWAPPED(32,p,val);
641
#else
642
    p[3] = (val >> 24) & 0xff;
643
    p[2] = (val >> 16) & 0xff;
644
    p[1] = (val >>  8) & 0xff;
645
    p[0] = (val      ) & 0xff;
646
#endif
647
0
}
Unexecuted instantiation: fuzz_aes.c:store_32_le
Unexecuted instantiation: key.c:store_32_le
Unexecuted instantiation: keyblocks.c:store_32_le
Unexecuted instantiation: aes.c:store_32_le
Unexecuted instantiation: aead.c:store_32_le
Unexecuted instantiation: default_state.c:store_32_le
Unexecuted instantiation: etypes.c:store_32_le
Unexecuted instantiation: prf_aes2.c:store_32_le
Unexecuted instantiation: prf_cmac.c:store_32_le
Unexecuted instantiation: prf_dk.c:store_32_le
Unexecuted instantiation: prf_rc4.c:store_32_le
Unexecuted instantiation: random_to_key.c:store_32_le
Unexecuted instantiation: s2k_pbkdf2.c:store_32_le
Unexecuted instantiation: s2k_rc4.c:store_32_le
Unexecuted instantiation: cmac.c:store_32_le
Unexecuted instantiation: hmac.c:store_32_le
Unexecuted instantiation: kdf.c:store_32_le
Unexecuted instantiation: pbkdf2.c:store_32_le
Unexecuted instantiation: des_keys.c:store_32_le
Unexecuted instantiation: f_parity.c:store_32_le
Unexecuted instantiation: aescrypt.c:store_32_le
Unexecuted instantiation: aestab.c:store_32_le
Unexecuted instantiation: aeskey.c:store_32_le
Unexecuted instantiation: des3.c:store_32_le
Unexecuted instantiation: rc4.c:store_32_le
Unexecuted instantiation: camellia.c:store_32_le
Unexecuted instantiation: hash_md4.c:store_32_le
Unexecuted instantiation: hash_md5.c:store_32_le
Unexecuted instantiation: hash_sha1.c:store_32_le
Unexecuted instantiation: hash_sha2.c:store_32_le
Unexecuted instantiation: derive.c:store_32_le
Unexecuted instantiation: enc_dk_cmac.c:store_32_le
Unexecuted instantiation: enc_dk_hmac.c:store_32_le
Unexecuted instantiation: enc_etm.c:store_32_le
Unexecuted instantiation: enc_raw.c:store_32_le
Unexecuted instantiation: enc_rc4.c:store_32_le
Unexecuted instantiation: nfold.c:store_32_le
Unexecuted instantiation: prng.c:store_32_le
Unexecuted instantiation: d3_aead.c:store_32_le
Unexecuted instantiation: d3_kysched.c:store_32_le
Unexecuted instantiation: f_aead.c:store_32_le
Unexecuted instantiation: f_sched.c:store_32_le
Unexecuted instantiation: f_tables.c:store_32_le
Unexecuted instantiation: weak_key.c:store_32_le
Unexecuted instantiation: md4.c:store_32_le
Unexecuted instantiation: md5.c:store_32_le
Unexecuted instantiation: shs.c:store_32_le
Unexecuted instantiation: sha256.c:store_32_le
Unexecuted instantiation: sha512.c:store_32_le
Unexecuted instantiation: utf8_conv.c:store_32_le
Unexecuted instantiation: bcmp.c:store_32_le
Unexecuted instantiation: k5buf.c:store_32_le
Unexecuted instantiation: utf8.c:store_32_le
648
static inline void
649
store_64_le (uint64_t val, void *vp)
650
0
{
651
0
    unsigned char *p = (unsigned char *) vp;
652
0
#if defined(__GNUC__) && defined(K5_LE) && !defined(__cplusplus)
653
0
    PUT(64,p,val);
654
0
#elif defined(__GNUC__) && defined(K5_BE) && defined(SWAP64) && !defined(__cplusplus)
655
0
    PUTSWAPPED(64,p,val);
656
0
#else
657
0
    p[7] = (unsigned char)((val >> 56) & 0xff);
658
0
    p[6] = (unsigned char)((val >> 48) & 0xff);
659
0
    p[5] = (unsigned char)((val >> 40) & 0xff);
660
0
    p[4] = (unsigned char)((val >> 32) & 0xff);
661
0
    p[3] = (unsigned char)((val >> 24) & 0xff);
662
0
    p[2] = (unsigned char)((val >> 16) & 0xff);
663
0
    p[1] = (unsigned char)((val >>  8) & 0xff);
664
0
    p[0] = (unsigned char)((val      ) & 0xff);
665
0
#endif
666
0
}
Unexecuted instantiation: fuzz_aes.c:store_64_le
Unexecuted instantiation: key.c:store_64_le
Unexecuted instantiation: keyblocks.c:store_64_le
Unexecuted instantiation: aes.c:store_64_le
Unexecuted instantiation: aead.c:store_64_le
Unexecuted instantiation: default_state.c:store_64_le
Unexecuted instantiation: etypes.c:store_64_le
Unexecuted instantiation: prf_aes2.c:store_64_le
Unexecuted instantiation: prf_cmac.c:store_64_le
Unexecuted instantiation: prf_dk.c:store_64_le
Unexecuted instantiation: prf_rc4.c:store_64_le
Unexecuted instantiation: random_to_key.c:store_64_le
Unexecuted instantiation: s2k_pbkdf2.c:store_64_le
Unexecuted instantiation: s2k_rc4.c:store_64_le
Unexecuted instantiation: cmac.c:store_64_le
Unexecuted instantiation: hmac.c:store_64_le
Unexecuted instantiation: kdf.c:store_64_le
Unexecuted instantiation: pbkdf2.c:store_64_le
Unexecuted instantiation: des_keys.c:store_64_le
Unexecuted instantiation: f_parity.c:store_64_le
Unexecuted instantiation: aescrypt.c:store_64_le
Unexecuted instantiation: aestab.c:store_64_le
Unexecuted instantiation: aeskey.c:store_64_le
Unexecuted instantiation: des3.c:store_64_le
Unexecuted instantiation: rc4.c:store_64_le
Unexecuted instantiation: camellia.c:store_64_le
Unexecuted instantiation: hash_md4.c:store_64_le
Unexecuted instantiation: hash_md5.c:store_64_le
Unexecuted instantiation: hash_sha1.c:store_64_le
Unexecuted instantiation: hash_sha2.c:store_64_le
Unexecuted instantiation: derive.c:store_64_le
Unexecuted instantiation: enc_dk_cmac.c:store_64_le
Unexecuted instantiation: enc_dk_hmac.c:store_64_le
Unexecuted instantiation: enc_etm.c:store_64_le
Unexecuted instantiation: enc_raw.c:store_64_le
Unexecuted instantiation: enc_rc4.c:store_64_le
Unexecuted instantiation: nfold.c:store_64_le
Unexecuted instantiation: prng.c:store_64_le
Unexecuted instantiation: d3_aead.c:store_64_le
Unexecuted instantiation: d3_kysched.c:store_64_le
Unexecuted instantiation: f_aead.c:store_64_le
Unexecuted instantiation: f_sched.c:store_64_le
Unexecuted instantiation: f_tables.c:store_64_le
Unexecuted instantiation: weak_key.c:store_64_le
Unexecuted instantiation: md4.c:store_64_le
Unexecuted instantiation: md5.c:store_64_le
Unexecuted instantiation: shs.c:store_64_le
Unexecuted instantiation: sha256.c:store_64_le
Unexecuted instantiation: sha512.c:store_64_le
Unexecuted instantiation: utf8_conv.c:store_64_le
Unexecuted instantiation: bcmp.c:store_64_le
Unexecuted instantiation: k5buf.c:store_64_le
Unexecuted instantiation: utf8.c:store_64_le
667
static inline unsigned short
668
load_16_le (const void *cvp)
669
0
{
670
0
    const unsigned char *p = (const unsigned char *) cvp;
671
0
#if defined(__GNUC__) && defined(K5_LE) && !defined(__cplusplus)
672
0
    return GET(16,p);
673
#elif defined(__GNUC__) && defined(K5_BE) && defined(SWAP16) && !defined(__cplusplus)
674
    return GETSWAPPED(16,p);
675
#else
676
    return (p[0] | (p[1] << 8));
677
#endif
678
0
}
Unexecuted instantiation: fuzz_aes.c:load_16_le
Unexecuted instantiation: key.c:load_16_le
Unexecuted instantiation: keyblocks.c:load_16_le
Unexecuted instantiation: aes.c:load_16_le
Unexecuted instantiation: aead.c:load_16_le
Unexecuted instantiation: default_state.c:load_16_le
Unexecuted instantiation: etypes.c:load_16_le
Unexecuted instantiation: prf_aes2.c:load_16_le
Unexecuted instantiation: prf_cmac.c:load_16_le
Unexecuted instantiation: prf_dk.c:load_16_le
Unexecuted instantiation: prf_rc4.c:load_16_le
Unexecuted instantiation: random_to_key.c:load_16_le
Unexecuted instantiation: s2k_pbkdf2.c:load_16_le
Unexecuted instantiation: s2k_rc4.c:load_16_le
Unexecuted instantiation: cmac.c:load_16_le
Unexecuted instantiation: hmac.c:load_16_le
Unexecuted instantiation: kdf.c:load_16_le
Unexecuted instantiation: pbkdf2.c:load_16_le
Unexecuted instantiation: des_keys.c:load_16_le
Unexecuted instantiation: f_parity.c:load_16_le
Unexecuted instantiation: aescrypt.c:load_16_le
Unexecuted instantiation: aestab.c:load_16_le
Unexecuted instantiation: aeskey.c:load_16_le
Unexecuted instantiation: des3.c:load_16_le
Unexecuted instantiation: rc4.c:load_16_le
Unexecuted instantiation: camellia.c:load_16_le
Unexecuted instantiation: hash_md4.c:load_16_le
Unexecuted instantiation: hash_md5.c:load_16_le
Unexecuted instantiation: hash_sha1.c:load_16_le
Unexecuted instantiation: hash_sha2.c:load_16_le
Unexecuted instantiation: derive.c:load_16_le
Unexecuted instantiation: enc_dk_cmac.c:load_16_le
Unexecuted instantiation: enc_dk_hmac.c:load_16_le
Unexecuted instantiation: enc_etm.c:load_16_le
Unexecuted instantiation: enc_raw.c:load_16_le
Unexecuted instantiation: enc_rc4.c:load_16_le
Unexecuted instantiation: nfold.c:load_16_le
Unexecuted instantiation: prng.c:load_16_le
Unexecuted instantiation: d3_aead.c:load_16_le
Unexecuted instantiation: d3_kysched.c:load_16_le
Unexecuted instantiation: f_aead.c:load_16_le
Unexecuted instantiation: f_sched.c:load_16_le
Unexecuted instantiation: f_tables.c:load_16_le
Unexecuted instantiation: weak_key.c:load_16_le
Unexecuted instantiation: md4.c:load_16_le
Unexecuted instantiation: md5.c:load_16_le
Unexecuted instantiation: shs.c:load_16_le
Unexecuted instantiation: sha256.c:load_16_le
Unexecuted instantiation: sha512.c:load_16_le
Unexecuted instantiation: utf8_conv.c:load_16_le
Unexecuted instantiation: bcmp.c:load_16_le
Unexecuted instantiation: k5buf.c:load_16_le
Unexecuted instantiation: utf8.c:load_16_le
679
static inline unsigned int
680
load_32_le (const void *cvp)
681
0
{
682
0
    const unsigned char *p = (const unsigned char *) cvp;
683
0
#if defined(__GNUC__) && defined(K5_LE) && !defined(__cplusplus)
684
0
    return GET(32,p);
685
#elif defined(__GNUC__) && defined(K5_BE) && defined(SWAP32) && !defined(__cplusplus)
686
    return GETSWAPPED(32,p);
687
#else
688
    return (p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24));
689
#endif
690
0
}
Unexecuted instantiation: fuzz_aes.c:load_32_le
Unexecuted instantiation: key.c:load_32_le
Unexecuted instantiation: keyblocks.c:load_32_le
Unexecuted instantiation: aes.c:load_32_le
Unexecuted instantiation: aead.c:load_32_le
Unexecuted instantiation: default_state.c:load_32_le
Unexecuted instantiation: etypes.c:load_32_le
Unexecuted instantiation: prf_aes2.c:load_32_le
Unexecuted instantiation: prf_cmac.c:load_32_le
Unexecuted instantiation: prf_dk.c:load_32_le
Unexecuted instantiation: prf_rc4.c:load_32_le
Unexecuted instantiation: random_to_key.c:load_32_le
Unexecuted instantiation: s2k_pbkdf2.c:load_32_le
Unexecuted instantiation: s2k_rc4.c:load_32_le
Unexecuted instantiation: cmac.c:load_32_le
Unexecuted instantiation: hmac.c:load_32_le
Unexecuted instantiation: kdf.c:load_32_le
Unexecuted instantiation: pbkdf2.c:load_32_le
Unexecuted instantiation: des_keys.c:load_32_le
Unexecuted instantiation: f_parity.c:load_32_le
Unexecuted instantiation: aescrypt.c:load_32_le
Unexecuted instantiation: aestab.c:load_32_le
Unexecuted instantiation: aeskey.c:load_32_le
Unexecuted instantiation: des3.c:load_32_le
Unexecuted instantiation: rc4.c:load_32_le
Unexecuted instantiation: camellia.c:load_32_le
Unexecuted instantiation: hash_md4.c:load_32_le
Unexecuted instantiation: hash_md5.c:load_32_le
Unexecuted instantiation: hash_sha1.c:load_32_le
Unexecuted instantiation: hash_sha2.c:load_32_le
Unexecuted instantiation: derive.c:load_32_le
Unexecuted instantiation: enc_dk_cmac.c:load_32_le
Unexecuted instantiation: enc_dk_hmac.c:load_32_le
Unexecuted instantiation: enc_etm.c:load_32_le
Unexecuted instantiation: enc_raw.c:load_32_le
Unexecuted instantiation: enc_rc4.c:load_32_le
Unexecuted instantiation: nfold.c:load_32_le
Unexecuted instantiation: prng.c:load_32_le
Unexecuted instantiation: d3_aead.c:load_32_le
Unexecuted instantiation: d3_kysched.c:load_32_le
Unexecuted instantiation: f_aead.c:load_32_le
Unexecuted instantiation: f_sched.c:load_32_le
Unexecuted instantiation: f_tables.c:load_32_le
Unexecuted instantiation: weak_key.c:load_32_le
Unexecuted instantiation: md4.c:load_32_le
Unexecuted instantiation: md5.c:load_32_le
Unexecuted instantiation: shs.c:load_32_le
Unexecuted instantiation: sha256.c:load_32_le
Unexecuted instantiation: sha512.c:load_32_le
Unexecuted instantiation: utf8_conv.c:load_32_le
Unexecuted instantiation: bcmp.c:load_32_le
Unexecuted instantiation: k5buf.c:load_32_le
Unexecuted instantiation: utf8.c:load_32_le
691
static inline uint64_t
692
load_64_le (const void *cvp)
693
0
{
694
0
    const unsigned char *p = (const unsigned char *) cvp;
695
0
#if defined(__GNUC__) && defined(K5_LE) && !defined(__cplusplus)
696
0
    return GET(64,p);
697
0
#elif defined(__GNUC__) && defined(K5_BE) && defined(SWAP64) && !defined(__cplusplus)
698
0
    return GETSWAPPED(64,p);
699
0
#else
700
0
    return ((uint64_t)load_32_le(p+4) << 32) | load_32_le(p);
701
0
#endif
702
0
}
Unexecuted instantiation: fuzz_aes.c:load_64_le
Unexecuted instantiation: key.c:load_64_le
Unexecuted instantiation: keyblocks.c:load_64_le
Unexecuted instantiation: aes.c:load_64_le
Unexecuted instantiation: aead.c:load_64_le
Unexecuted instantiation: default_state.c:load_64_le
Unexecuted instantiation: etypes.c:load_64_le
Unexecuted instantiation: prf_aes2.c:load_64_le
Unexecuted instantiation: prf_cmac.c:load_64_le
Unexecuted instantiation: prf_dk.c:load_64_le
Unexecuted instantiation: prf_rc4.c:load_64_le
Unexecuted instantiation: random_to_key.c:load_64_le
Unexecuted instantiation: s2k_pbkdf2.c:load_64_le
Unexecuted instantiation: s2k_rc4.c:load_64_le
Unexecuted instantiation: cmac.c:load_64_le
Unexecuted instantiation: hmac.c:load_64_le
Unexecuted instantiation: kdf.c:load_64_le
Unexecuted instantiation: pbkdf2.c:load_64_le
Unexecuted instantiation: des_keys.c:load_64_le
Unexecuted instantiation: f_parity.c:load_64_le
Unexecuted instantiation: aescrypt.c:load_64_le
Unexecuted instantiation: aestab.c:load_64_le
Unexecuted instantiation: aeskey.c:load_64_le
Unexecuted instantiation: des3.c:load_64_le
Unexecuted instantiation: rc4.c:load_64_le
Unexecuted instantiation: camellia.c:load_64_le
Unexecuted instantiation: hash_md4.c:load_64_le
Unexecuted instantiation: hash_md5.c:load_64_le
Unexecuted instantiation: hash_sha1.c:load_64_le
Unexecuted instantiation: hash_sha2.c:load_64_le
Unexecuted instantiation: derive.c:load_64_le
Unexecuted instantiation: enc_dk_cmac.c:load_64_le
Unexecuted instantiation: enc_dk_hmac.c:load_64_le
Unexecuted instantiation: enc_etm.c:load_64_le
Unexecuted instantiation: enc_raw.c:load_64_le
Unexecuted instantiation: enc_rc4.c:load_64_le
Unexecuted instantiation: nfold.c:load_64_le
Unexecuted instantiation: prng.c:load_64_le
Unexecuted instantiation: d3_aead.c:load_64_le
Unexecuted instantiation: d3_kysched.c:load_64_le
Unexecuted instantiation: f_aead.c:load_64_le
Unexecuted instantiation: f_sched.c:load_64_le
Unexecuted instantiation: f_tables.c:load_64_le
Unexecuted instantiation: weak_key.c:load_64_le
Unexecuted instantiation: md4.c:load_64_le
Unexecuted instantiation: md5.c:load_64_le
Unexecuted instantiation: shs.c:load_64_le
Unexecuted instantiation: sha256.c:load_64_le
Unexecuted instantiation: sha512.c:load_64_le
Unexecuted instantiation: utf8_conv.c:load_64_le
Unexecuted instantiation: bcmp.c:load_64_le
Unexecuted instantiation: k5buf.c:load_64_le
Unexecuted instantiation: utf8.c:load_64_le
703
704
#define UINT16_TYPE uint16_t
705
73.4k
#define UINT32_TYPE uint32_t
706
707
static inline void
708
store_16_n (unsigned int val, void *vp)
709
0
{
710
0
    UINT16_TYPE n = val;
711
0
    memcpy(vp, &n, 2);
712
0
}
Unexecuted instantiation: fuzz_aes.c:store_16_n
Unexecuted instantiation: key.c:store_16_n
Unexecuted instantiation: keyblocks.c:store_16_n
Unexecuted instantiation: aes.c:store_16_n
Unexecuted instantiation: aead.c:store_16_n
Unexecuted instantiation: default_state.c:store_16_n
Unexecuted instantiation: etypes.c:store_16_n
Unexecuted instantiation: prf_aes2.c:store_16_n
Unexecuted instantiation: prf_cmac.c:store_16_n
Unexecuted instantiation: prf_dk.c:store_16_n
Unexecuted instantiation: prf_rc4.c:store_16_n
Unexecuted instantiation: random_to_key.c:store_16_n
Unexecuted instantiation: s2k_pbkdf2.c:store_16_n
Unexecuted instantiation: s2k_rc4.c:store_16_n
Unexecuted instantiation: cmac.c:store_16_n
Unexecuted instantiation: hmac.c:store_16_n
Unexecuted instantiation: kdf.c:store_16_n
Unexecuted instantiation: pbkdf2.c:store_16_n
Unexecuted instantiation: des_keys.c:store_16_n
Unexecuted instantiation: f_parity.c:store_16_n
Unexecuted instantiation: aescrypt.c:store_16_n
Unexecuted instantiation: aestab.c:store_16_n
Unexecuted instantiation: aeskey.c:store_16_n
Unexecuted instantiation: des3.c:store_16_n
Unexecuted instantiation: rc4.c:store_16_n
Unexecuted instantiation: camellia.c:store_16_n
Unexecuted instantiation: hash_md4.c:store_16_n
Unexecuted instantiation: hash_md5.c:store_16_n
Unexecuted instantiation: hash_sha1.c:store_16_n
Unexecuted instantiation: hash_sha2.c:store_16_n
Unexecuted instantiation: derive.c:store_16_n
Unexecuted instantiation: enc_dk_cmac.c:store_16_n
Unexecuted instantiation: enc_dk_hmac.c:store_16_n
Unexecuted instantiation: enc_etm.c:store_16_n
Unexecuted instantiation: enc_raw.c:store_16_n
Unexecuted instantiation: enc_rc4.c:store_16_n
Unexecuted instantiation: nfold.c:store_16_n
Unexecuted instantiation: prng.c:store_16_n
Unexecuted instantiation: d3_aead.c:store_16_n
Unexecuted instantiation: d3_kysched.c:store_16_n
Unexecuted instantiation: f_aead.c:store_16_n
Unexecuted instantiation: f_sched.c:store_16_n
Unexecuted instantiation: f_tables.c:store_16_n
Unexecuted instantiation: weak_key.c:store_16_n
Unexecuted instantiation: md4.c:store_16_n
Unexecuted instantiation: md5.c:store_16_n
Unexecuted instantiation: shs.c:store_16_n
Unexecuted instantiation: sha256.c:store_16_n
Unexecuted instantiation: sha512.c:store_16_n
Unexecuted instantiation: utf8_conv.c:store_16_n
Unexecuted instantiation: bcmp.c:store_16_n
Unexecuted instantiation: k5buf.c:store_16_n
Unexecuted instantiation: utf8.c:store_16_n
713
static inline void
714
store_32_n (unsigned int val, void *vp)
715
24.4k
{
716
24.4k
    UINT32_TYPE n = val;
717
24.4k
    memcpy(vp, &n, 4);
718
24.4k
}
Unexecuted instantiation: fuzz_aes.c:store_32_n
Unexecuted instantiation: key.c:store_32_n
Unexecuted instantiation: keyblocks.c:store_32_n
aes.c:store_32_n
Line
Count
Source
715
24.4k
{
716
24.4k
    UINT32_TYPE n = val;
717
24.4k
    memcpy(vp, &n, 4);
718
24.4k
}
Unexecuted instantiation: aead.c:store_32_n
Unexecuted instantiation: default_state.c:store_32_n
Unexecuted instantiation: etypes.c:store_32_n
Unexecuted instantiation: prf_aes2.c:store_32_n
Unexecuted instantiation: prf_cmac.c:store_32_n
Unexecuted instantiation: prf_dk.c:store_32_n
Unexecuted instantiation: prf_rc4.c:store_32_n
Unexecuted instantiation: random_to_key.c:store_32_n
Unexecuted instantiation: s2k_pbkdf2.c:store_32_n
Unexecuted instantiation: s2k_rc4.c:store_32_n
Unexecuted instantiation: cmac.c:store_32_n
Unexecuted instantiation: hmac.c:store_32_n
Unexecuted instantiation: kdf.c:store_32_n
Unexecuted instantiation: pbkdf2.c:store_32_n
Unexecuted instantiation: des_keys.c:store_32_n
Unexecuted instantiation: f_parity.c:store_32_n
Unexecuted instantiation: aescrypt.c:store_32_n
Unexecuted instantiation: aestab.c:store_32_n
Unexecuted instantiation: aeskey.c:store_32_n
Unexecuted instantiation: des3.c:store_32_n
Unexecuted instantiation: rc4.c:store_32_n
Unexecuted instantiation: camellia.c:store_32_n
Unexecuted instantiation: hash_md4.c:store_32_n
Unexecuted instantiation: hash_md5.c:store_32_n
Unexecuted instantiation: hash_sha1.c:store_32_n
Unexecuted instantiation: hash_sha2.c:store_32_n
Unexecuted instantiation: derive.c:store_32_n
Unexecuted instantiation: enc_dk_cmac.c:store_32_n
Unexecuted instantiation: enc_dk_hmac.c:store_32_n
Unexecuted instantiation: enc_etm.c:store_32_n
Unexecuted instantiation: enc_raw.c:store_32_n
Unexecuted instantiation: enc_rc4.c:store_32_n
Unexecuted instantiation: nfold.c:store_32_n
Unexecuted instantiation: prng.c:store_32_n
Unexecuted instantiation: d3_aead.c:store_32_n
Unexecuted instantiation: d3_kysched.c:store_32_n
Unexecuted instantiation: f_aead.c:store_32_n
Unexecuted instantiation: f_sched.c:store_32_n
Unexecuted instantiation: f_tables.c:store_32_n
Unexecuted instantiation: weak_key.c:store_32_n
Unexecuted instantiation: md4.c:store_32_n
Unexecuted instantiation: md5.c:store_32_n
Unexecuted instantiation: shs.c:store_32_n
Unexecuted instantiation: sha256.c:store_32_n
Unexecuted instantiation: sha512.c:store_32_n
Unexecuted instantiation: utf8_conv.c:store_32_n
Unexecuted instantiation: bcmp.c:store_32_n
Unexecuted instantiation: k5buf.c:store_32_n
Unexecuted instantiation: utf8.c:store_32_n
719
static inline void
720
store_64_n (uint64_t val, void *vp)
721
0
{
722
0
    uint64_t n = val;
723
0
    memcpy(vp, &n, 8);
724
0
}
Unexecuted instantiation: fuzz_aes.c:store_64_n
Unexecuted instantiation: key.c:store_64_n
Unexecuted instantiation: keyblocks.c:store_64_n
Unexecuted instantiation: aes.c:store_64_n
Unexecuted instantiation: aead.c:store_64_n
Unexecuted instantiation: default_state.c:store_64_n
Unexecuted instantiation: etypes.c:store_64_n
Unexecuted instantiation: prf_aes2.c:store_64_n
Unexecuted instantiation: prf_cmac.c:store_64_n
Unexecuted instantiation: prf_dk.c:store_64_n
Unexecuted instantiation: prf_rc4.c:store_64_n
Unexecuted instantiation: random_to_key.c:store_64_n
Unexecuted instantiation: s2k_pbkdf2.c:store_64_n
Unexecuted instantiation: s2k_rc4.c:store_64_n
Unexecuted instantiation: cmac.c:store_64_n
Unexecuted instantiation: hmac.c:store_64_n
Unexecuted instantiation: kdf.c:store_64_n
Unexecuted instantiation: pbkdf2.c:store_64_n
Unexecuted instantiation: des_keys.c:store_64_n
Unexecuted instantiation: f_parity.c:store_64_n
Unexecuted instantiation: aescrypt.c:store_64_n
Unexecuted instantiation: aestab.c:store_64_n
Unexecuted instantiation: aeskey.c:store_64_n
Unexecuted instantiation: des3.c:store_64_n
Unexecuted instantiation: rc4.c:store_64_n
Unexecuted instantiation: camellia.c:store_64_n
Unexecuted instantiation: hash_md4.c:store_64_n
Unexecuted instantiation: hash_md5.c:store_64_n
Unexecuted instantiation: hash_sha1.c:store_64_n
Unexecuted instantiation: hash_sha2.c:store_64_n
Unexecuted instantiation: derive.c:store_64_n
Unexecuted instantiation: enc_dk_cmac.c:store_64_n
Unexecuted instantiation: enc_dk_hmac.c:store_64_n
Unexecuted instantiation: enc_etm.c:store_64_n
Unexecuted instantiation: enc_raw.c:store_64_n
Unexecuted instantiation: enc_rc4.c:store_64_n
Unexecuted instantiation: nfold.c:store_64_n
Unexecuted instantiation: prng.c:store_64_n
Unexecuted instantiation: d3_aead.c:store_64_n
Unexecuted instantiation: d3_kysched.c:store_64_n
Unexecuted instantiation: f_aead.c:store_64_n
Unexecuted instantiation: f_sched.c:store_64_n
Unexecuted instantiation: f_tables.c:store_64_n
Unexecuted instantiation: weak_key.c:store_64_n
Unexecuted instantiation: md4.c:store_64_n
Unexecuted instantiation: md5.c:store_64_n
Unexecuted instantiation: shs.c:store_64_n
Unexecuted instantiation: sha256.c:store_64_n
Unexecuted instantiation: sha512.c:store_64_n
Unexecuted instantiation: utf8_conv.c:store_64_n
Unexecuted instantiation: bcmp.c:store_64_n
Unexecuted instantiation: k5buf.c:store_64_n
Unexecuted instantiation: utf8.c:store_64_n
725
static inline unsigned short
726
load_16_n (const void *p)
727
0
{
728
0
    UINT16_TYPE n;
729
0
    memcpy(&n, p, 2);
730
0
    return n;
731
0
}
Unexecuted instantiation: fuzz_aes.c:load_16_n
Unexecuted instantiation: key.c:load_16_n
Unexecuted instantiation: keyblocks.c:load_16_n
Unexecuted instantiation: aes.c:load_16_n
Unexecuted instantiation: aead.c:load_16_n
Unexecuted instantiation: default_state.c:load_16_n
Unexecuted instantiation: etypes.c:load_16_n
Unexecuted instantiation: prf_aes2.c:load_16_n
Unexecuted instantiation: prf_cmac.c:load_16_n
Unexecuted instantiation: prf_dk.c:load_16_n
Unexecuted instantiation: prf_rc4.c:load_16_n
Unexecuted instantiation: random_to_key.c:load_16_n
Unexecuted instantiation: s2k_pbkdf2.c:load_16_n
Unexecuted instantiation: s2k_rc4.c:load_16_n
Unexecuted instantiation: cmac.c:load_16_n
Unexecuted instantiation: hmac.c:load_16_n
Unexecuted instantiation: kdf.c:load_16_n
Unexecuted instantiation: pbkdf2.c:load_16_n
Unexecuted instantiation: des_keys.c:load_16_n
Unexecuted instantiation: f_parity.c:load_16_n
Unexecuted instantiation: aescrypt.c:load_16_n
Unexecuted instantiation: aestab.c:load_16_n
Unexecuted instantiation: aeskey.c:load_16_n
Unexecuted instantiation: des3.c:load_16_n
Unexecuted instantiation: rc4.c:load_16_n
Unexecuted instantiation: camellia.c:load_16_n
Unexecuted instantiation: hash_md4.c:load_16_n
Unexecuted instantiation: hash_md5.c:load_16_n
Unexecuted instantiation: hash_sha1.c:load_16_n
Unexecuted instantiation: hash_sha2.c:load_16_n
Unexecuted instantiation: derive.c:load_16_n
Unexecuted instantiation: enc_dk_cmac.c:load_16_n
Unexecuted instantiation: enc_dk_hmac.c:load_16_n
Unexecuted instantiation: enc_etm.c:load_16_n
Unexecuted instantiation: enc_raw.c:load_16_n
Unexecuted instantiation: enc_rc4.c:load_16_n
Unexecuted instantiation: nfold.c:load_16_n
Unexecuted instantiation: prng.c:load_16_n
Unexecuted instantiation: d3_aead.c:load_16_n
Unexecuted instantiation: d3_kysched.c:load_16_n
Unexecuted instantiation: f_aead.c:load_16_n
Unexecuted instantiation: f_sched.c:load_16_n
Unexecuted instantiation: f_tables.c:load_16_n
Unexecuted instantiation: weak_key.c:load_16_n
Unexecuted instantiation: md4.c:load_16_n
Unexecuted instantiation: md5.c:load_16_n
Unexecuted instantiation: shs.c:load_16_n
Unexecuted instantiation: sha256.c:load_16_n
Unexecuted instantiation: sha512.c:load_16_n
Unexecuted instantiation: utf8_conv.c:load_16_n
Unexecuted instantiation: bcmp.c:load_16_n
Unexecuted instantiation: k5buf.c:load_16_n
Unexecuted instantiation: utf8.c:load_16_n
732
static inline unsigned int
733
load_32_n (const void *p)
734
48.9k
{
735
48.9k
    UINT32_TYPE n;
736
48.9k
    memcpy(&n, p, 4);
737
48.9k
    return n;
738
48.9k
}
Unexecuted instantiation: fuzz_aes.c:load_32_n
Unexecuted instantiation: key.c:load_32_n
Unexecuted instantiation: keyblocks.c:load_32_n
aes.c:load_32_n
Line
Count
Source
734
48.9k
{
735
48.9k
    UINT32_TYPE n;
736
48.9k
    memcpy(&n, p, 4);
737
48.9k
    return n;
738
48.9k
}
Unexecuted instantiation: aead.c:load_32_n
Unexecuted instantiation: default_state.c:load_32_n
Unexecuted instantiation: etypes.c:load_32_n
Unexecuted instantiation: prf_aes2.c:load_32_n
Unexecuted instantiation: prf_cmac.c:load_32_n
Unexecuted instantiation: prf_dk.c:load_32_n
Unexecuted instantiation: prf_rc4.c:load_32_n
Unexecuted instantiation: random_to_key.c:load_32_n
Unexecuted instantiation: s2k_pbkdf2.c:load_32_n
Unexecuted instantiation: s2k_rc4.c:load_32_n
Unexecuted instantiation: cmac.c:load_32_n
Unexecuted instantiation: hmac.c:load_32_n
Unexecuted instantiation: kdf.c:load_32_n
Unexecuted instantiation: pbkdf2.c:load_32_n
Unexecuted instantiation: des_keys.c:load_32_n
Unexecuted instantiation: f_parity.c:load_32_n
Unexecuted instantiation: aescrypt.c:load_32_n
Unexecuted instantiation: aestab.c:load_32_n
Unexecuted instantiation: aeskey.c:load_32_n
Unexecuted instantiation: des3.c:load_32_n
Unexecuted instantiation: rc4.c:load_32_n
Unexecuted instantiation: camellia.c:load_32_n
Unexecuted instantiation: hash_md4.c:load_32_n
Unexecuted instantiation: hash_md5.c:load_32_n
Unexecuted instantiation: hash_sha1.c:load_32_n
Unexecuted instantiation: hash_sha2.c:load_32_n
Unexecuted instantiation: derive.c:load_32_n
Unexecuted instantiation: enc_dk_cmac.c:load_32_n
Unexecuted instantiation: enc_dk_hmac.c:load_32_n
Unexecuted instantiation: enc_etm.c:load_32_n
Unexecuted instantiation: enc_raw.c:load_32_n
Unexecuted instantiation: enc_rc4.c:load_32_n
Unexecuted instantiation: nfold.c:load_32_n
Unexecuted instantiation: prng.c:load_32_n
Unexecuted instantiation: d3_aead.c:load_32_n
Unexecuted instantiation: d3_kysched.c:load_32_n
Unexecuted instantiation: f_aead.c:load_32_n
Unexecuted instantiation: f_sched.c:load_32_n
Unexecuted instantiation: f_tables.c:load_32_n
Unexecuted instantiation: weak_key.c:load_32_n
Unexecuted instantiation: md4.c:load_32_n
Unexecuted instantiation: md5.c:load_32_n
Unexecuted instantiation: shs.c:load_32_n
Unexecuted instantiation: sha256.c:load_32_n
Unexecuted instantiation: sha512.c:load_32_n
Unexecuted instantiation: utf8_conv.c:load_32_n
Unexecuted instantiation: bcmp.c:load_32_n
Unexecuted instantiation: k5buf.c:load_32_n
Unexecuted instantiation: utf8.c:load_32_n
739
static inline uint64_t
740
load_64_n (const void *p)
741
0
{
742
0
    uint64_t n;
743
0
    memcpy(&n, p, 8);
744
0
    return n;
745
0
}
Unexecuted instantiation: fuzz_aes.c:load_64_n
Unexecuted instantiation: key.c:load_64_n
Unexecuted instantiation: keyblocks.c:load_64_n
Unexecuted instantiation: aes.c:load_64_n
Unexecuted instantiation: aead.c:load_64_n
Unexecuted instantiation: default_state.c:load_64_n
Unexecuted instantiation: etypes.c:load_64_n
Unexecuted instantiation: prf_aes2.c:load_64_n
Unexecuted instantiation: prf_cmac.c:load_64_n
Unexecuted instantiation: prf_dk.c:load_64_n
Unexecuted instantiation: prf_rc4.c:load_64_n
Unexecuted instantiation: random_to_key.c:load_64_n
Unexecuted instantiation: s2k_pbkdf2.c:load_64_n
Unexecuted instantiation: s2k_rc4.c:load_64_n
Unexecuted instantiation: cmac.c:load_64_n
Unexecuted instantiation: hmac.c:load_64_n
Unexecuted instantiation: kdf.c:load_64_n
Unexecuted instantiation: pbkdf2.c:load_64_n
Unexecuted instantiation: des_keys.c:load_64_n
Unexecuted instantiation: f_parity.c:load_64_n
Unexecuted instantiation: aescrypt.c:load_64_n
Unexecuted instantiation: aestab.c:load_64_n
Unexecuted instantiation: aeskey.c:load_64_n
Unexecuted instantiation: des3.c:load_64_n
Unexecuted instantiation: rc4.c:load_64_n
Unexecuted instantiation: camellia.c:load_64_n
Unexecuted instantiation: hash_md4.c:load_64_n
Unexecuted instantiation: hash_md5.c:load_64_n
Unexecuted instantiation: hash_sha1.c:load_64_n
Unexecuted instantiation: hash_sha2.c:load_64_n
Unexecuted instantiation: derive.c:load_64_n
Unexecuted instantiation: enc_dk_cmac.c:load_64_n
Unexecuted instantiation: enc_dk_hmac.c:load_64_n
Unexecuted instantiation: enc_etm.c:load_64_n
Unexecuted instantiation: enc_raw.c:load_64_n
Unexecuted instantiation: enc_rc4.c:load_64_n
Unexecuted instantiation: nfold.c:load_64_n
Unexecuted instantiation: prng.c:load_64_n
Unexecuted instantiation: d3_aead.c:load_64_n
Unexecuted instantiation: d3_kysched.c:load_64_n
Unexecuted instantiation: f_aead.c:load_64_n
Unexecuted instantiation: f_sched.c:load_64_n
Unexecuted instantiation: f_tables.c:load_64_n
Unexecuted instantiation: weak_key.c:load_64_n
Unexecuted instantiation: md4.c:load_64_n
Unexecuted instantiation: md5.c:load_64_n
Unexecuted instantiation: shs.c:load_64_n
Unexecuted instantiation: sha256.c:load_64_n
Unexecuted instantiation: sha512.c:load_64_n
Unexecuted instantiation: utf8_conv.c:load_64_n
Unexecuted instantiation: bcmp.c:load_64_n
Unexecuted instantiation: k5buf.c:load_64_n
Unexecuted instantiation: utf8.c:load_64_n
746
#undef UINT16_TYPE
747
#undef UINT32_TYPE
748
749
/* Assume for simplicity that these swaps are identical.  */
750
static inline uint64_t
751
k5_htonll (uint64_t val)
752
0
{
753
0
#ifdef K5_BE
754
0
    return val;
755
0
#elif defined K5_LE && defined SWAP64
756
0
    return SWAP64 (val);
757
0
#else
758
0
    return load_64_be ((unsigned char *)&val);
759
0
#endif
760
0
}
Unexecuted instantiation: fuzz_aes.c:k5_htonll
Unexecuted instantiation: key.c:k5_htonll
Unexecuted instantiation: keyblocks.c:k5_htonll
Unexecuted instantiation: aes.c:k5_htonll
Unexecuted instantiation: aead.c:k5_htonll
Unexecuted instantiation: default_state.c:k5_htonll
Unexecuted instantiation: etypes.c:k5_htonll
Unexecuted instantiation: prf_aes2.c:k5_htonll
Unexecuted instantiation: prf_cmac.c:k5_htonll
Unexecuted instantiation: prf_dk.c:k5_htonll
Unexecuted instantiation: prf_rc4.c:k5_htonll
Unexecuted instantiation: random_to_key.c:k5_htonll
Unexecuted instantiation: s2k_pbkdf2.c:k5_htonll
Unexecuted instantiation: s2k_rc4.c:k5_htonll
Unexecuted instantiation: cmac.c:k5_htonll
Unexecuted instantiation: hmac.c:k5_htonll
Unexecuted instantiation: kdf.c:k5_htonll
Unexecuted instantiation: pbkdf2.c:k5_htonll
Unexecuted instantiation: des_keys.c:k5_htonll
Unexecuted instantiation: f_parity.c:k5_htonll
Unexecuted instantiation: aescrypt.c:k5_htonll
Unexecuted instantiation: aestab.c:k5_htonll
Unexecuted instantiation: aeskey.c:k5_htonll
Unexecuted instantiation: des3.c:k5_htonll
Unexecuted instantiation: rc4.c:k5_htonll
Unexecuted instantiation: camellia.c:k5_htonll
Unexecuted instantiation: hash_md4.c:k5_htonll
Unexecuted instantiation: hash_md5.c:k5_htonll
Unexecuted instantiation: hash_sha1.c:k5_htonll
Unexecuted instantiation: hash_sha2.c:k5_htonll
Unexecuted instantiation: derive.c:k5_htonll
Unexecuted instantiation: enc_dk_cmac.c:k5_htonll
Unexecuted instantiation: enc_dk_hmac.c:k5_htonll
Unexecuted instantiation: enc_etm.c:k5_htonll
Unexecuted instantiation: enc_raw.c:k5_htonll
Unexecuted instantiation: enc_rc4.c:k5_htonll
Unexecuted instantiation: nfold.c:k5_htonll
Unexecuted instantiation: prng.c:k5_htonll
Unexecuted instantiation: d3_aead.c:k5_htonll
Unexecuted instantiation: d3_kysched.c:k5_htonll
Unexecuted instantiation: f_aead.c:k5_htonll
Unexecuted instantiation: f_sched.c:k5_htonll
Unexecuted instantiation: f_tables.c:k5_htonll
Unexecuted instantiation: weak_key.c:k5_htonll
Unexecuted instantiation: md4.c:k5_htonll
Unexecuted instantiation: md5.c:k5_htonll
Unexecuted instantiation: shs.c:k5_htonll
Unexecuted instantiation: sha256.c:k5_htonll
Unexecuted instantiation: sha512.c:k5_htonll
Unexecuted instantiation: utf8_conv.c:k5_htonll
Unexecuted instantiation: bcmp.c:k5_htonll
Unexecuted instantiation: k5buf.c:k5_htonll
Unexecuted instantiation: utf8.c:k5_htonll
761
static inline uint64_t
762
k5_ntohll (uint64_t val)
763
0
{
764
0
    return k5_htonll (val);
765
0
}
Unexecuted instantiation: fuzz_aes.c:k5_ntohll
Unexecuted instantiation: key.c:k5_ntohll
Unexecuted instantiation: keyblocks.c:k5_ntohll
Unexecuted instantiation: aes.c:k5_ntohll
Unexecuted instantiation: aead.c:k5_ntohll
Unexecuted instantiation: default_state.c:k5_ntohll
Unexecuted instantiation: etypes.c:k5_ntohll
Unexecuted instantiation: prf_aes2.c:k5_ntohll
Unexecuted instantiation: prf_cmac.c:k5_ntohll
Unexecuted instantiation: prf_dk.c:k5_ntohll
Unexecuted instantiation: prf_rc4.c:k5_ntohll
Unexecuted instantiation: random_to_key.c:k5_ntohll
Unexecuted instantiation: s2k_pbkdf2.c:k5_ntohll
Unexecuted instantiation: s2k_rc4.c:k5_ntohll
Unexecuted instantiation: cmac.c:k5_ntohll
Unexecuted instantiation: hmac.c:k5_ntohll
Unexecuted instantiation: kdf.c:k5_ntohll
Unexecuted instantiation: pbkdf2.c:k5_ntohll
Unexecuted instantiation: des_keys.c:k5_ntohll
Unexecuted instantiation: f_parity.c:k5_ntohll
Unexecuted instantiation: aescrypt.c:k5_ntohll
Unexecuted instantiation: aestab.c:k5_ntohll
Unexecuted instantiation: aeskey.c:k5_ntohll
Unexecuted instantiation: des3.c:k5_ntohll
Unexecuted instantiation: rc4.c:k5_ntohll
Unexecuted instantiation: camellia.c:k5_ntohll
Unexecuted instantiation: hash_md4.c:k5_ntohll
Unexecuted instantiation: hash_md5.c:k5_ntohll
Unexecuted instantiation: hash_sha1.c:k5_ntohll
Unexecuted instantiation: hash_sha2.c:k5_ntohll
Unexecuted instantiation: derive.c:k5_ntohll
Unexecuted instantiation: enc_dk_cmac.c:k5_ntohll
Unexecuted instantiation: enc_dk_hmac.c:k5_ntohll
Unexecuted instantiation: enc_etm.c:k5_ntohll
Unexecuted instantiation: enc_raw.c:k5_ntohll
Unexecuted instantiation: enc_rc4.c:k5_ntohll
Unexecuted instantiation: nfold.c:k5_ntohll
Unexecuted instantiation: prng.c:k5_ntohll
Unexecuted instantiation: d3_aead.c:k5_ntohll
Unexecuted instantiation: d3_kysched.c:k5_ntohll
Unexecuted instantiation: f_aead.c:k5_ntohll
Unexecuted instantiation: f_sched.c:k5_ntohll
Unexecuted instantiation: f_tables.c:k5_ntohll
Unexecuted instantiation: weak_key.c:k5_ntohll
Unexecuted instantiation: md4.c:k5_ntohll
Unexecuted instantiation: md5.c:k5_ntohll
Unexecuted instantiation: shs.c:k5_ntohll
Unexecuted instantiation: sha256.c:k5_ntohll
Unexecuted instantiation: sha512.c:k5_ntohll
Unexecuted instantiation: utf8_conv.c:k5_ntohll
Unexecuted instantiation: bcmp.c:k5_ntohll
Unexecuted instantiation: k5buf.c:k5_ntohll
Unexecuted instantiation: utf8.c:k5_ntohll
766
767
/* Make the interfaces to getpwnam and getpwuid consistent.
768
   Model the wrappers on the POSIX thread-safe versions, but
769
   use the unsafe system versions if the safe ones don't exist
770
   or we can't figure out their interfaces.  */
771
772
/* int k5_getpwnam_r(const char *, blah blah) */
773
#ifdef HAVE_GETPWNAM_R
774
# ifndef GETPWNAM_R_4_ARGS
775
/* POSIX */
776
#  define k5_getpwnam_r(NAME, REC, BUF, BUFSIZE, OUT)   \
777
        (getpwnam_r(NAME,REC,BUF,BUFSIZE,OUT) == 0      \
778
         ? (*(OUT) == NULL ? -1 : 0) : -1)
779
# else
780
/* POSIX drafts? */
781
#  ifdef GETPWNAM_R_RETURNS_INT
782
#   define k5_getpwnam_r(NAME, REC, BUF, BUFSIZE, OUT)  \
783
        (getpwnam_r(NAME,REC,BUF,BUFSIZE) == 0          \
784
         ? (*(OUT) = REC, 0)                            \
785
         : (*(OUT) = NULL, -1))
786
#  else
787
#   define k5_getpwnam_r(NAME, REC, BUF, BUFSIZE, OUT)  \
788
        (*(OUT) = getpwnam_r(NAME,REC,BUF,BUFSIZE), *(OUT) == NULL ? -1 : 0)
789
#  endif
790
# endif
791
#else /* no getpwnam_r, or can't figure out #args or return type */
792
/* Will get warnings about unused variables.  */
793
# define k5_getpwnam_r(NAME, REC, BUF, BUFSIZE, OUT) \
794
        (*(OUT) = getpwnam(NAME), *(OUT) == NULL ? -1 : 0)
795
#endif
796
797
/* int k5_getpwuid_r(uid_t, blah blah) */
798
#ifdef HAVE_GETPWUID_R
799
# ifndef GETPWUID_R_4_ARGS
800
/* POSIX */
801
#  define k5_getpwuid_r(UID, REC, BUF, BUFSIZE, OUT)    \
802
        (getpwuid_r(UID,REC,BUF,BUFSIZE,OUT) == 0       \
803
         ? (*(OUT) == NULL ? -1 : 0) : -1)
804
# else
805
/* POSIX drafts?  Yes, I mean to test GETPWNAM... here.  Less junk to
806
   do at configure time.  */
807
#  ifdef GETPWNAM_R_RETURNS_INT
808
#   define k5_getpwuid_r(UID, REC, BUF, BUFSIZE, OUT)   \
809
        (getpwuid_r(UID,REC,BUF,BUFSIZE) == 0           \
810
         ? (*(OUT) = REC, 0)                            \
811
         : (*(OUT) = NULL, -1))
812
#  else
813
#   define k5_getpwuid_r(UID, REC, BUF, BUFSIZE, OUT)  \
814
        (*(OUT) = getpwuid_r(UID,REC,BUF,BUFSIZE), *(OUT) == NULL ? -1 : 0)
815
#  endif
816
# endif
817
#else /* no getpwuid_r, or can't figure out #args or return type */
818
/* Will get warnings about unused variables.  */
819
# define k5_getpwuid_r(UID, REC, BUF, BUFSIZE, OUT) \
820
        (*(OUT) = getpwuid(UID), *(OUT) == NULL ? -1 : 0)
821
#endif
822
823
/* Ensure, if possible, that the indicated file descriptor won't be
824
   kept open if we exec another process (e.g., launching a ccapi
825
   server).  If we don't know how to do it... well, just go about our
826
   business.  Probably most callers won't check the return status
827
   anyways.  */
828
829
/* Macros make the Sun compiler happier, and all variants of this do a
830
   single evaluation of the argument, and fcntl and fileno should
831
   produce reasonable error messages on type mismatches, on any system
832
   with F_SETFD.  */
833
#ifdef F_SETFD
834
# ifdef FD_CLOEXEC
835
0
#  define set_cloexec_fd(FD)    ((void)fcntl((FD), F_SETFD, FD_CLOEXEC))
836
# else
837
#  define set_cloexec_fd(FD)    ((void)fcntl((FD), F_SETFD, 1))
838
# endif
839
#else
840
# define set_cloexec_fd(FD)     ((void)(FD))
841
#endif
842
#define set_cloexec_file(F)     set_cloexec_fd(fileno(F))
843
844
/* Since the original ANSI C spec left it undefined whether or
845
   how you could copy around a va_list, C 99 added va_copy.
846
   For old implementations, let's do our best to fake it.
847
848
   XXX Doesn't yet handle implementations with __va_copy (early draft)
849
   or GCC's __builtin_va_copy.  */
850
#if defined(HAS_VA_COPY) || defined(va_copy)
851
/* Do nothing.  */
852
#elif defined(CAN_COPY_VA_LIST)
853
#define va_copy(dest, src)      ((dest) = (src))
854
#else
855
/* Assume array type, but still simply copyable.
856
857
   There is, theoretically, the possibility that va_start will
858
   allocate some storage pointed to by the va_list, and in that case
859
   we'll just lose.  If anyone cares, we could try to devise a test
860
   for that case.  */
861
#define va_copy(dest, src)      memcpy(dest, src, sizeof(va_list))
862
#endif
863
864
/* Provide strlcpy/strlcat interfaces. */
865
#ifndef HAVE_STRLCPY
866
#define strlcpy krb5int_strlcpy
867
#define strlcat krb5int_strlcat
868
extern size_t krb5int_strlcpy(char *dst, const char *src, size_t siz);
869
extern size_t krb5int_strlcat(char *dst, const char *src, size_t siz);
870
#endif
871
872
/* Provide fnmatch interface. */
873
#ifndef HAVE_FNMATCH
874
#define fnmatch k5_fnmatch
875
int k5_fnmatch(const char *pattern, const char *string, int flags);
876
#define FNM_NOMATCH     1       /* Match failed. */
877
#define FNM_NOSYS       2       /* Function not implemented. */
878
#define FNM_NORES       3       /* Out of resources */
879
#define FNM_NOESCAPE    0x01    /* Disable backslash escaping. */
880
#define FNM_PATHNAME    0x02    /* Slash must be matched by slash. */
881
#define FNM_PERIOD      0x04    /* Period must be matched by period. */
882
#define FNM_CASEFOLD    0x08    /* Pattern is matched case-insensitive */
883
#define FNM_LEADING_DIR 0x10    /* Ignore /<tail> after Imatch. */
884
#endif
885
886
/* Provide [v]asprintf interfaces.  */
887
#ifndef HAVE_VSNPRINTF
888
#ifdef _WIN32
889
static inline int
890
vsnprintf(char *str, size_t size, const char *format, va_list args)
891
{
892
    va_list args_copy;
893
    int length;
894
895
    va_copy(args_copy, args);
896
    length = _vscprintf(format, args_copy);
897
    va_end(args_copy);
898
    if (size > 0) {
899
        _vsnprintf(str, size, format, args);
900
        str[size - 1] = '\0';
901
    }
902
    return length;
903
}
904
static inline int
905
snprintf(char *str, size_t size, const char *format, ...)
906
{
907
    va_list args;
908
    int n;
909
910
    va_start(args, format);
911
    n = vsnprintf(str, size, format, args);
912
    va_end(args);
913
    return n;
914
}
915
#else /* not win32 */
916
#error We need an implementation of vsnprintf.
917
#endif /* win32? */
918
#endif /* no vsnprintf */
919
920
#ifndef HAVE_VASPRINTF
921
922
extern int krb5int_vasprintf(char **, const char *, va_list)
923
#if !defined(__cplusplus) && (__GNUC__ > 2)
924
    __attribute__((__format__(__printf__, 2, 0)))
925
#endif
926
    ;
927
extern int krb5int_asprintf(char **, const char *, ...)
928
#if !defined(__cplusplus) && (__GNUC__ > 2)
929
    __attribute__((__format__(__printf__, 2, 3)))
930
#endif
931
    ;
932
933
#define vasprintf krb5int_vasprintf
934
/* Assume HAVE_ASPRINTF iff HAVE_VASPRINTF.  */
935
#define asprintf krb5int_asprintf
936
937
#elif defined(NEED_VASPRINTF_PROTO)
938
939
extern int vasprintf(char **, const char *, va_list)
940
#if !defined(__cplusplus) && (__GNUC__ > 2)
941
    __attribute__((__format__(__printf__, 2, 0)))
942
#endif
943
    ;
944
extern int asprintf(char **, const char *, ...)
945
#if !defined(__cplusplus) && (__GNUC__ > 2)
946
    __attribute__((__format__(__printf__, 2, 3)))
947
#endif
948
    ;
949
950
#endif /* have vasprintf and prototype? */
951
952
/* Return true if the snprintf return value RESULT reflects a buffer
953
   overflow for the buffer size SIZE.
954
955
   We cast the result to unsigned int for two reasons.  First, old
956
   implementations of snprintf (such as the one in Solaris 9 and
957
   prior) return -1 on a buffer overflow.  Casting the result to -1
958
   will convert that value to UINT_MAX, which should compare larger
959
   than any reasonable buffer size.  Second, comparing signed and
960
   unsigned integers will generate warnings with some compilers, and
961
   can have unpredictable results, particularly when the relative
962
   widths of the types is not known (size_t may be the same width as
963
   int or larger).
964
*/
965
#define SNPRINTF_OVERFLOW(result, size) \
966
0
    ((unsigned int)(result) >= (size_t)(size))
967
968
#if defined(_WIN32) || !defined(HAVE_STRERROR_R) || defined(STRERROR_R_CHAR_P)
969
#define strerror_r k5_strerror_r
970
#endif
971
extern int k5_strerror_r(int errnum, char *buf, size_t buflen);
972
973
#ifndef HAVE_MKSTEMP
974
extern int krb5int_mkstemp(char *);
975
#define mkstemp krb5int_mkstemp
976
#endif
977
978
#ifndef HAVE_GETTIMEOFDAY
979
extern int krb5int_gettimeofday(struct timeval *tp, void *ignore);
980
#define gettimeofday krb5int_gettimeofday
981
#endif
982
983
/*
984
 * Attempt to zero memory in a way that compilers won't optimize out.
985
 *
986
 * This mechanism should work even for heap storage about to be freed,
987
 * or automatic storage right before we return from a function.
988
 *
989
 * Then, even if we leak uninitialized memory someplace, or UNIX
990
 * "core" files get created with world-read access, some of the most
991
 * sensitive data in the process memory will already be safely wiped.
992
 *
993
 * We're not going so far -- yet -- as to try to protect key data that
994
 * may have been written into swap space....
995
 */
996
#ifdef _WIN32
997
# define zap(ptr, len) SecureZeroMemory(ptr, len)
998
#elif defined(__STDC_LIB_EXT1__)
999
/*
1000
 * Use memset_s() which cannot be optimized out.  Avoid memset_s(NULL, 0, 0, 0)
1001
 * which would cause a runtime constraint violation.
1002
 */
1003
static inline void zap(void *ptr, size_t len)
1004
{
1005
    if (len > 0)
1006
        memset_s(ptr, len, 0, len);
1007
}
1008
#elif defined(HAVE_EXPLICIT_BZERO)
1009
304
# define zap(ptr, len) explicit_bzero(ptr, len)
1010
#elif defined(HAVE_EXPLICIT_MEMSET)
1011
# define zap(ptr, len) explicit_memset(ptr, 0, len)
1012
#elif defined(__GNUC__) || defined(__clang__)
1013
/*
1014
 * Use an asm statement which declares a memory clobber to force the memset to
1015
 * be carried out.  Avoid memset(NULL, 0, 0) which has undefined behavior.
1016
 */
1017
static inline void zap(void *ptr, size_t len)
1018
{
1019
    if (len > 0)
1020
        memset(ptr, 0, len);
1021
    __asm__ __volatile__("" : : "g" (ptr) : "memory");
1022
}
1023
#else
1024
/*
1025
 * Use a function from libkrb5support to defeat inlining unless link-time
1026
 * optimization is used.  The function uses a volatile pointer, which prevents
1027
 * current compilers from optimizing out the memset.
1028
 */
1029
# define zap(ptr, len) krb5int_zap(ptr, len)
1030
#endif
1031
1032
extern void krb5int_zap(void *ptr, size_t len);
1033
1034
/*
1035
 * Return 0 if the n-byte memory regions p1 and p2 are equal, and nonzero if
1036
 * they are not.  The function is intended to take the same amount of time
1037
 * regardless of how many bytes of p1 and p2 are equal.
1038
 */
1039
int k5_bcmp(const void *p1, const void *p2, size_t n);
1040
1041
/*
1042
 * Split a path into parent directory and basename.  Either output parameter
1043
 * may be NULL if the caller doesn't need it.  parent_out will be empty if path
1044
 * has no basename.  basename_out will be empty if path ends with a path
1045
 * separator.  Returns 0 on success or ENOMEM on allocation failure.
1046
 */
1047
long k5_path_split(const char *path, char **parent_out, char **basename_out);
1048
1049
/*
1050
 * Compose two path components, inserting the platform-appropriate path
1051
 * separator if needed.  If path2 is an absolute path, path1 will be discarded
1052
 * and path_out will be a copy of path2.  Returns 0 on success or ENOMEM on
1053
 * allocation failure.
1054
 */
1055
long k5_path_join(const char *path1, const char *path2, char **path_out);
1056
1057
/* Return 1 if path is absolute, 0 if it is relative. */
1058
int k5_path_isabs(const char *path);
1059
1060
/*
1061
 * Localization macros.  If we have gettext, define _ appropriately for
1062
 * translating a string.  If we do not have gettext, define _ and
1063
 * bindtextdomain as no-ops.  N_ is always a no-op; it marks a string for
1064
 * extraction to pot files but does not translate it.
1065
 */
1066
#ifdef ENABLE_NLS
1067
#include <libintl.h>
1068
#define KRB5_TEXTDOMAIN "mit-krb5"
1069
#define _(s) dgettext(KRB5_TEXTDOMAIN, s)
1070
#else
1071
#define _(s) s
1072
#define dgettext(d, m) m
1073
#define ngettext(m1, m2, n) (((n) == 1) ? m1 : m2)
1074
#define bindtextdomain(p, d)
1075
#endif
1076
#define N_(s) s
1077
1078
#if !defined(HAVE_GETOPT) || !defined(HAVE_UNISTD_H)
1079
/* Data objects imported from DLLs must be declared as such on Windows. */
1080
#if defined(_WIN32) && !defined(K5_GETOPT_C)
1081
#define K5_GETOPT_DECL __declspec(dllimport)
1082
#else
1083
#define K5_GETOPT_DECL
1084
#endif
1085
K5_GETOPT_DECL extern int k5_opterr;
1086
K5_GETOPT_DECL extern int k5_optind;
1087
K5_GETOPT_DECL extern int k5_optopt;
1088
K5_GETOPT_DECL extern char *k5_optarg;
1089
#define opterr k5_opterr
1090
#define optind k5_optind
1091
#define optopt k5_optopt
1092
#define optarg k5_optarg
1093
1094
extern int k5_getopt(int nargc, char * const nargv[], const char *ostr);
1095
#define getopt k5_getopt
1096
#endif /* HAVE_GETOPT */
1097
1098
#ifdef HAVE_GETOPT_LONG
1099
#include <getopt.h>
1100
#else
1101
1102
struct option
1103
{
1104
  const char *name;
1105
  int has_arg;
1106
  int *flag;
1107
  int val;
1108
};
1109
1110
#define no_argument       0
1111
#define required_argument 1
1112
#define optional_argument 2
1113
1114
extern int k5_getopt_long(int nargc, char **nargv, char *options,
1115
                          struct option *long_options, int *index);
1116
#define getopt_long k5_getopt_long
1117
#endif /* HAVE_GETOPT_LONG */
1118
1119
#if defined(_WIN32)
1120
/* On Windows there is never a need to ignore the process environment. */
1121
#define secure_getenv getenv
1122
#elif !defined(HAVE_SECURE_GETENV)
1123
#define secure_getenv k5_secure_getenv
1124
extern char *k5_secure_getenv(const char *name);
1125
#endif
1126
1127
/* Set *fnames_out to a null-terminated list of filenames within dirname,
1128
 * sorted according to strcmp().  Return 0 on success, or ENOENT/ENOMEM. */
1129
int k5_dir_filenames(const char *dirname, char ***fnames_out);
1130
void k5_free_filenames(char **fnames);
1131
1132
#ifdef __cplusplus
1133
}
1134
#endif
1135
1136
#endif /* K5_PLATFORM_H */