2 * Copyright (c) 1999, 2000-2001 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
29 Contains: Public header file for Counterpane's Yarrow Pseudo-random
32 Written by: Counterpane, Inc.
34 Copyright: (c) 2000 by Apple Computer, Inc., all rights reserved.
36 Change History (most recent first):
38 02/10/99 dpm Created, based on Counterpane source.
44 Main header file for Counterpane's Yarrow Pseudo-random number generator.
50 #if defined(macintosh) || defined(__APPLE__)
51 #include "WindowsTypesForMac.h"
54 #if defined(__cplusplus)
59 typedef enum prng_error_status
{
62 PRNG_ERR_WRONG_CALLER
,
64 PRNG_ERR_NULL_POINTER
,
66 PRNG_ERR_OUT_OF_BOUNDS
,
68 PRNG_ERR_NOT_ENOUGH_ENTROPY
,
81 USER_SOURCES
/* Leave as last source */
85 /* Declare YARROWAPI as __declspec(dllexport) before
86 including this file in the actual DLL */
88 #if defined(macintosh) || defined(__APPLE__)
91 #define YARROWAPI __declspec(dllimport)
95 /* Public function forward declarations */
97 #if defined(macintosh) || defined(__APPLE__)
100 * 1. PrngRef context for all functions. Thus no global variables.
101 * 2. Strong enum typing (prng_error_status instead of int return).
104 typedef struct PRNG
*PrngRef
;
106 YARROWAPI prng_error_status
109 YARROWAPI prng_error_status
112 YARROWAPI prng_error_status
117 /* this one has no context */
118 YARROWAPI prng_error_status
124 YARROWAPI prng_error_status
131 YARROWAPI prng_error_status
135 YARROWAPI prng_error_status
139 YARROWAPI prng_error_status
140 prngProcessSeedBuffer(
144 YARROWAPI prng_error_status
149 /* original Counterpane API */
150 YARROWAPI
int prngOutput(BYTE
*outbuf
,UINT outbuflen
);
151 YARROWAPI
int prngStretch(BYTE
*inbuf
,UINT inbuflen
,BYTE
*outbuf
,UINT outbuflen
);
152 YARROWAPI
int prngInput(BYTE
*inbuf
,UINT inbuflen
,UINT poolnum
,UINT estbits
);
153 YARROWAPI
int prngForceReseed(LONGLONG ticks
);
154 YARROWAPI
int prngAllowReseed(LONGLONG ticks
);
155 YARROWAPI
int prngProcessSeedBuffer(BYTE
*buf
,LONGLONG ticks
);
156 YARROWAPI
int prngSlowPoll(UINT pollsize
);
159 #if defined(__cplusplus)