]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_cryptkit/lib/ECDSA_Profile.h
Security-59754.80.3.tar.gz
[apple/security.git] / OSX / libsecurity_cryptkit / lib / ECDSA_Profile.h
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 #include "feeDebug.h"
33
34 #ifdef FEE_DEBUG
35 #define ECDSA_PROFILE 0
36 #else /* FEE_DEBUG */
37 #define ECDSA_PROFILE 0 /* always off */
38 #endif /* FEE_DEBUG */
39
40 #if ECDSA_PROFILE
41
42 #include <kern/time_stamp.h>
43
44 /*
45 * Unlike the profiling macros in feeDebug.h, these are intended to
46 * be used for fragments of code, not entire functions.
47 */
48 #define SIGPROF_START \
49 { \
50 struct tsval _profStartTime; \
51 struct tsval _profEndTime; \
52 kern_timestamp(&_profStartTime);
53
54 /*
55 * This one goes at the end of the routine, just before the (only) return.
56 * There must be a static accumulator (an unsigned int) on a per-routine basis.
57 */
58 #define SIGPROF_END(accum) \
59 kern_timestamp(&_profEndTime); \
60 accum += (_profEndTime.low_val - _profStartTime.low_val); \
61 }
62
63
64 /*
65 * Accumulators.
66 */
67 extern unsigned signStep1;
68 extern unsigned signStep2;
69 extern unsigned signStep34;
70 extern unsigned signStep5;
71 extern unsigned signStep67;
72 extern unsigned signStep8;
73 extern unsigned vfyStep1;
74 extern unsigned vfyStep3;
75 extern unsigned vfyStep4;
76 extern unsigned vfyStep5;
77 extern unsigned vfyStep6;
78 extern unsigned vfyStep7;
79
80 #else /* ECDSA_PROFILE */
81
82 #define SIGPROF_START
83 #define SIGPROF_END(accum)
84
85 #endif /* ECDSA_PROFILE */
86
87 #endif /* _CK_ECDSA_PROFILE_H_ */