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