]>
git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_cryptkit/lib/ellipticProj.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 * ellipticProj.h - declaration of elliptic projective algebra routines.
16 * Changed to compile with C++.
21 #ifndef _CRYPTKIT_ELLIPTIC_PROJ_H_
22 #define _CRYPTKIT_ELLIPTIC_PROJ_H_
26 #include "giantIntegers.h"
27 #include "curveParams.h"
38 typedef pointProjStruct
*pointProj
;
40 pointProj
/* Allocates a new projective point. */
41 newPointProj(unsigned numDigits
);
43 void /* Frees point. */
44 freePointProj(pointProj pt
);
46 void /* Copies point to point; pt2 := pt1. */
47 ptopProj(pointProj pt1
, pointProj pt2
);
49 void /* Point doubling. */
50 ellDoubleProj(pointProj pt
, curveParams
*cp
);
52 void /* Point adding; pt0 := pt0 - pt1. */
53 ellAddProj(pointProj pt0
, pointProj pt1
, curveParams
*cp
);
55 void /* Point negation; pt := -pt. */
56 ellNegProj(pointProj pt
, curveParams
*cp
);
58 void /* Point subtraction; pt0 := pt0 - pt1. */
59 ellSubProj(pointProj pt0
, pointProj pt1
, curveParams
*cp
);
61 void /* pt := pt * k, result normalized */
62 ellMulProjSimple(pointProj pt0
, giant k
, curveParams
*cp
);
64 void /* General elliptic mul; pt1 := k*pt0. */
65 ellMulProj(pointProj pt0
, pointProj pt1
, giant k
, curveParams
*cp
);
67 void /* Generate normalized point (X, Y, 1) from given (x,y,z). */
68 normalizeProj(pointProj pt
, curveParams
*cp
);
70 void /* Find a point (x, y, 1) on the curve. */
71 findPointProj(pointProj pt
, giant seed
, curveParams
*cp
);
73 #endif /* _CRYPTKIT_ELLIPTIC_PROJ_H_ */