]>
git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_cryptkit/lib/giantPort_PPC.h
1 /* Copyright (c) 1998,2011,2014 Apple Inc. All Rights Reserved.
3 * NOTICE: USE OF THE MATERIALS ACCOMPANYING THIS NOTICE IS SUBJECT
4 * TO THE TERMS OF THE SIGNED "FAST ELLIPTIC ENCRYPTION (FEE) REFERENCE
5 * SOURCE CODE EVALUATION AGREEMENT" BETWEEN APPLE, INC. AND THE
6 * ORIGINAL LICENSEE THAT OBTAINED THESE MATERIALS FROM APPLE,
7 * INC. ANY USE OF THESE MATERIALS NOT PERMITTED BY SUCH AGREEMENT WILL
8 * EXPOSE YOU TO LIABILITY.
9 ***************************************************************************
11 * giantPort_PPC.h - PPC-dependent giant definitions.
16 * Changed to compile with C++.
17 * 06 Apr 1998 at Apple
21 #ifndef _CK_NSGIANT_PORT_PPC_H_
22 #define _CK_NSGIANT_PORT_PPC_H_
26 #include "giantIntegers.h"
32 /**** FIXME - implement asm giant digits! ****/
34 * 0 ==> use function declarations from this file and implementation
36 * 1 ==> use static inline C function in giantPort_Generic.h
40 #define PPC_GIANT_PORT_INLINE 1
42 #define PPC_GIANT_PORT_INLINE 0
45 #define PPC_GIANT_PORT_INLINE 1
47 #if PPC_GIANT_PORT_INLINE
49 #include "giantPort_Generic.h"
51 #else // PPC_GIANT_PORT_INLINE
54 * We'll be using the compiler's 64-bit long long for these routines.
56 * Mask for upper word.
58 #define GIANT_UPPER_DIGIT_MASK (~(unsigned long long(GIANT_DIGIT_MASK)))
61 * Multiple-precision arithmetic routines/macros. C for now, eventually
62 * they'll be in assembly.
66 * Add two digits, return sum. Carry bit returned as an out parameter.
67 * This should work any size giantDigits up to unsigned int.
69 extern giantDigit
giantAddDigits(
72 giantDigit
*carry
); /* RETURNED, 0 or 1 */
75 * Add a single digit value to a double digit accumulator in place.
76 * Carry out of the MSD of the accumulator is not handled.
79 giantDigit
*accLow
, /* IN/OUT */
80 giantDigit
*accHigh
, /* IN/OUT */
85 * Subtract a - b, return difference. Borrow bit returned as an out parameter.
87 giantDigit
giantSubDigits(
90 giantDigit
*borrow
); /* RETURNED, 0 or 1 */
94 * Multiply two digits, return two digits.
99 giantDigit
*lowProduct
, /* RETURNED, low digit */
100 giantDigit
*hiProduct
); /* RETURNED, high digit */
103 * Multiply a vector of giantDigits, candVector, by a single giantDigit,
104 * plierDigit, adding results into prodVector. Returns m.s. digit from
105 * final multiply; only candLength digits of *prodVector will be written.
107 giantDigit
VectorMultiply(
108 giantDigit plierDigit
,
109 giantDigit
*candVector
,
111 giantDigit
*prodVector
);
117 #endif /* !PPC_GIANT_PORT_INLINE */
119 #endif /*_CK_NSGIANT_PORT_PPC_H_*/