]>
git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_cryptkit/lib/feeDigitalSignature.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 * feeDigitalSignature.h - generic, portable FEE Digital Signature object
19 #ifndef _CK_FEEDIGITALSIG_H_
20 #define _CK_FEEDIGITALSIG_H_
22 #if !defined(__MACH__)
24 #include <feePublicKey.h>
26 #include <security_cryptkit/feeTypes.h>
27 #include <security_cryptkit/feePublicKey.h>
34 #define FEE_SIG_MAGIC 0xfee00516
37 * Opaque signature handle.
42 * Create new feeSig object, including a random large integer 'Pm' for
43 * possible use in salting a feeHash object.
45 feeSig
feeSigNewWithKey(
47 feeRandFcn randFcn
, /* optional */
48 void *randRef
); /* optional */
54 * Obtain a malloc'd Pm after or feeSigNewWithKey() feeSigParse()
56 unsigned char *feeSigPm(
58 unsigned *PmLen
); /* RETURNED */
61 * Sign specified block of data (most likely a hash result) using
62 * specified feePubKey.
66 const unsigned char *data
, // data to be signed
67 unsigned dataLen
, // in bytes
71 * Given a feeSig processed by feeSigSign, obtain a malloc'd byte
72 * array representing the signature.
76 unsigned char **sigData
, // malloc'd and RETURNED
77 unsigned *sigDataLen
); // RETURNED
80 * Obtain a feeSig object by parsing an existing signature block.
81 * Note that if Pm is used to salt a hash of the signed data, this must
82 * be performed prior to hashing.
84 feeReturn
feeSigParse(
85 const unsigned char *sigData
,
87 feeSig
*sig
); // RETURNED
90 * Verify signature, obtained via feeSigParse, for specified
91 * data (most likely a hash result) and feePubKey. Returns FR_Success or
92 * FR_InvalidSignature.
94 feeReturn
feeSigVerify(
96 const unsigned char *data
,
101 * For given key, calculate maximum signature size.
103 feeReturn
feeSigSize(
105 unsigned *maxSigLen
);
111 #endif /*_CK_FEEDIGITALSIG_H_*/