зеркало из https://github.com/github/putty.git
Move defn of PLATFORM_HAS_SMEMCLR into defs.h.
After I moved parts of misc.c into utils.c, we started getting two versions of smemclr in the Windows builds, because utils.c didn't know to omit its one, having not included the main putty.h. But it was deliberate that utils.c didn't include putty.h, because I wanted it (along with the rest of testcrypt in particular) to be portable to unusual platforms without having to port the whole of the code base. So I've moved into the ubiquitous defs.h just the one decision about whether we're on a platform that will supersede utils.c's definition of smemclr. (Also, in the process of moving it, I've removed the clause that disabled the Windows smemclr in winelib mode, because it looks as if the claim that winelib doesn't have SecureZeroMemory is now out of date.)
This commit is contained in:
Родитель
e1627db3e5
Коммит
188e2525c7
28
defs.h
28
defs.h
|
@ -131,4 +131,32 @@ typedef struct PacketProtocolLayer PacketProtocolLayer;
|
|||
#define NORETURN
|
||||
#endif
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Platform-specific definitions.
|
||||
*
|
||||
* Most of these live in the per-platform header files, of which
|
||||
* puttyps.h selects the appropriate one. But some of the sources
|
||||
* (particularly standalone test applications) would prefer not to
|
||||
* have to include a per-platform header at all, because that makes it
|
||||
* more portable to platforms not supported by the code base as a
|
||||
* whole (for example, compiling purely computational parts of the
|
||||
* code for specialist platforms for test and analysis purposes). So
|
||||
* any definition that has to affect even _those_ modules will have to
|
||||
* go here, with the key constraint being that this code has to come
|
||||
* to _some_ decision even if the compilation platform is not a
|
||||
* recognised one at all.
|
||||
*/
|
||||
|
||||
/* Purely computational code uses smemclr(), so we have to make the
|
||||
* decision here about whether that's provided by utils.c or by a
|
||||
* platform implementation. We define PLATFORM_HAS_SMEMCLR to suppress
|
||||
* utils.c's definition. */
|
||||
#ifdef _WINDOWS
|
||||
/* Windows provides the API function 'SecureZeroMemory', which we use
|
||||
* unless the user has told us not to by defining NO_SECUREZEROMEMORY. */
|
||||
#ifndef NO_SECUREZEROMEMORY
|
||||
#define PLATFORM_HAS_SMEMCLR
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* PUTTY_DEFS_H */
|
||||
|
|
|
@ -101,14 +101,6 @@ struct FontSpec *fontspec_new(
|
|||
#define BOXRESULT (DLGWINDOWEXTRA + sizeof(LONG_PTR))
|
||||
#define DF_END 0x0001
|
||||
|
||||
#ifdef __WINE__
|
||||
#define NO_SECUREZEROMEMORY /* winelib doesn't have this */
|
||||
#endif
|
||||
|
||||
#ifndef NO_SECUREZEROMEMORY
|
||||
#define PLATFORM_HAS_SMEMCLR /* inhibit cross-platform one in misc.c */
|
||||
#endif
|
||||
|
||||
#ifndef __WINE__
|
||||
/* Up-to-date Windows headers warn that the unprefixed versions of
|
||||
* these names are deprecated. */
|
||||
|
|
Загрузка…
Ссылка в новой задаче