1/*
2	File:		ECDSA_Profile.h
3
4	Contains:	ECDSA Profiling support.
5
6	Written by:	Doug Mitchell
7
8	Copyright:	Copyright 1998 by Apple Computer, Inc., all rights reserved.
9
10	Change History (most recent first):
11
12		 <7>	10/06/98	ap		Changed to compile with C++.
13
14	To Do:
15*/
16
17/* Copyright (c) 1998 Apple Computer, Inc.  All rights reserved.
18 *
19 * NOTICE: USE OF THE MATERIALS ACCOMPANYING THIS NOTICE IS SUBJECT
20 * TO THE TERMS OF THE SIGNED "FAST ELLIPTIC ENCRYPTION (FEE) REFERENCE
21 * SOURCE CODE EVALUATION AGREEMENT" BETWEEN APPLE COMPUTER, INC. AND THE
22 * ORIGINAL LICENSEE THAT OBTAINED THESE MATERIALS FROM APPLE COMPUTER,
23 * INC.  ANY USE OF THESE MATERIALS NOT PERMITTED BY SUCH AGREEMENT WILL
24 * EXPOSE YOU TO LIABILITY.
25 ***************************************************************************
26 */
27
28#ifndef	_CK_ECDSA_PROFILE_H_
29#define _CK_ECDSA_PROFILE_H_
30
31#include "ckconfig.h"
32
33#if CRYPTKIT_ECDSA_ENABLE
34
35#include "feeDebug.h"
36
37#ifdef	FEE_DEBUG
38#define ECDSA_PROFILE	0
39#else	/* FEE_DEBUG */
40#define ECDSA_PROFILE	0	/* always off */
41#endif	/* FEE_DEBUG */
42
43#if	ECDSA_PROFILE
44
45#include <kern/time_stamp.h>
46
47/*
48 * Unlike the profiling macros in feeDebug.h, these are intended to
49 * be used for fragments of code, not entire functions.
50 */
51#define SIGPROF_START 				\
52{						\
53	struct tsval _profStartTime;		\
54	struct tsval _profEndTime;		\
55	kern_timestamp(&_profStartTime);
56
57/*
58 * This one goes at the end of the routine, just before the (only) return.
59 * There must be a static accumulator (an unsigned int) on a per-routine basis.
60 */
61#define SIGPROF_END(accum)						\
62	kern_timestamp(&_profEndTime);					\
63	accum += (_profEndTime.low_val - _profStartTime.low_val);	\
64}
65
66
67/*
68 * Accumulators.
69 */
70extern unsigned signStep1;
71extern unsigned signStep2;
72extern unsigned signStep34;
73extern unsigned signStep5;
74extern unsigned signStep67;
75extern unsigned signStep8;
76extern unsigned vfyStep1;
77extern unsigned vfyStep3;
78extern unsigned vfyStep4;
79extern unsigned vfyStep5;
80extern unsigned vfyStep6;
81extern unsigned vfyStep7;
82
83#else	/* ECDSA_PROFILE */
84
85#define SIGPROF_START
86#define SIGPROF_END(accum)
87
88#endif	/* ECDSA_PROFILE */
89
90#endif	/* CRYPTKIT_ECDSA_ENABLE */
91#endif	/* _CK_ECDSA_PROFILE_H_ */
92