]>
git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_cryptkit/lib/byteRep.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 * byteRep.h - FEE portable byte representation support
16 * Added signature routines.
18 * Split off from ckutilities.h
21 #ifndef _CK_BYTEREP_H_
22 #define _CK_BYTEREP_H_
25 #include "giantIntegers.h"
27 #include "curveParams.h"
34 * Support for bytestream key and signature representation.
36 int intToByteRep(int i
, unsigned char *buf
);
37 int shortToByteRep(short s
, unsigned char *buf
);
38 int giantToByteRep(giant g
, unsigned char *buf
);
39 int keyToByteRep(key k
, unsigned char *buf
);
40 int curveParamsToByteRep(curveParams
*cp
, unsigned char *buf
);
41 int sigToByteRep(int magic
,
48 int lengthOfByteRepGiant(giant g
);
49 int lengthOfByteRepKey(key k
);
50 int lengthOfByteRepCurveParams(curveParams
*cp
);
51 int lengthOfByteRepSig(giant g0
,
54 int byteRepToInt(const unsigned char *buf
);
55 unsigned short byteRepToShort(const unsigned char *buf
);
56 giant
byteRepToGiant(const unsigned char *buf
,
59 key
byteRepToKey(const unsigned char *buf
,
63 unsigned *keyLen
); // returned
64 curveParams
*byteRepToCurveParams(const unsigned char *buf
,
67 int byteRepToSig(const unsigned char *buf
,
70 int *sigMagic
, // RETURNED
71 int *sigVersion
, // RETURNED
72 int *sigMinVersion
, // RETURNED
73 giant
*g0
, // alloc'd & RETURNED
74 giant
*g1
); // alloc'd & RETURNED
80 #endif /*_CK_BYTEREP_H_*/