]> git.saurik.com Git - apple/xnu.git/blame - bsd/dev/random/YarrowCoreLib/src/smf.h
xnu-792.6.56.tar.gz
[apple/xnu.git] / bsd / dev / random / YarrowCoreLib / src / smf.h
CommitLineData
0b4e3aa0
A
1/*
2 * Copyright (c) 1999, 2000-2001 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
ff6e181a
A
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
0b4e3aa0 12 *
ff6e181a
A
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
0b4e3aa0
A
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
ff6e181a
A
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
0b4e3aa0
A
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24/*
25 File: smf.h
26
27 Contains: Secure malloc/free API.
28
29 Written by: Doug Mitchell
30
31 Copyright: (c) 2000 by Apple Computer, Inc., all rights reserved.
32
33 Change History (most recent first):
34
35 02/10/00 dpm Created, based on Counterpane's Yarrow code.
36
37*/
38
39#ifndef _YARROW_SMF_H_
40#define _YARROW_SMF_H_
41
42#if defined(__cplusplus)
43extern "C" {
44#endif
45
46/* smf.h */
47
48 /*
49 Header file for secure malloc and free routines used by the Counterpane
50 PRNG. Use this code to set up a memory-mapped file out of the system
51 paging file, allocate and free memory from it, and then return
52 the memory to the system registry after having securely overwritten it.
53 Details of the secure overwrite can be found in Gutmann 1996 (Usenix).
54 Trying to explain it here will cause my head to begin to hurt.
55 Ari Benbasat (pigsfly@unixg.ubc.ca)
56 */
57
58
59
60#if defined(macintosh) || defined(__APPLE__)
61#include "macOnly.h"
62#define MMPTR void *
63
64#ifndef SMFAPI
65#define SMFAPI
66#endif
67
68#else /* original Yarrow */
69
70/* Declare HOOKSAPI as __declspec(dllexport) before
71 including this file in the actual DLL */
72#ifndef SMFAPI
73#define SMFAPI __declspec(dllimport)
74#endif
75#define MMPTR BYTE
76
77#endif /* macintosh */
78
79
80#define MM_NULL 0
81
82/* Function forward declarations */
91447636 83SMFAPI void mmInit( void );
0b4e3aa0
A
84SMFAPI MMPTR mmMalloc(DWORD request);
85SMFAPI void mmFree(MMPTR ptrnum);
86SMFAPI LPVOID mmGetPtr(MMPTR ptrnum);
87SMFAPI void mmReturnPtr(MMPTR ptrnum);
88#if 0
89SMFAPI void mmFreePtr(LPVOID ptr);
90#endif
91
92#if defined(__cplusplus)
93}
94#endif
95
96#endif /* _YARROW_SMF_H_*/