]>
git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_cryptkit/lib/feeECDSA.h
fc0cb28b616155f7f6792e14dad946d16c5d23fa
   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  * feeECDSA.h - Elliptic Curve Digital Signature Algorithm (per IEEE 1363) 
  19 #ifndef _CK_FEEECDSA_H_ 
  20 #define _CK_FEEECDSA_H_ 
  22 #if     !defined(__MACH__) 
  25 #include <feePublicKey.h> 
  27 #include <security_cryptkit/ckconfig.h> 
  28 #include <security_cryptkit/feeTypes.h> 
  29 #include <security_cryptkit/feePublicKey.h> 
  33  * Keep this one defined and visible even if we can't actually do ECDSA - feeSigParse() 
  34  * uses it to detect "wriong signature type". 
  36 #define FEE_ECDSA_MAGIC         0xfee00517 
  38 #if     CRYPTKIT_ECDSA_ENABLE 
  46  * Sign specified block of data (most likely a hash result) using 
  47  * specified private key. Result, an enc64-encoded signature block, 
  48  * is returned in *sigData. 
  50 feeReturn 
feeECDSASign(feePubKey pubKey
, 
  51     feeSigFormat  format
,         // Format of the signature DER/RAW 
  52         const unsigned char *data
,      // data to be signed 
  53         unsigned dataLen
,                               // in bytes 
  54         feeRandFcn randFcn
,                             // optional 
  55         void *randRef
,                                  // optional  
  56         unsigned char **sigData
,                // malloc'd and RETURNED 
  57         unsigned *sigDataLen
);                  // RETURNED 
  60  * Verify signature, obtained via feeECDSASign, for specified 
  61  * data (most likely a hash result) and feePubKey. Returns FR_Success or 
  62  * FR_InvalidSignature. 
  64 feeReturn 
feeECDSAVerify(const unsigned char *sigData
, 
  66         const unsigned char *data
, 
  69     feeSigFormat  format
);        // Format of the signature DER/RAW 
  72  * For given key, calculate maximum signature size.  
  74 feeReturn 
feeECDSASigSize( 
  82 #endif  /* CRYPTKIT_ECDSA_ENABLE */ 
  84 #endif  /*_CK_FEEECDSA_H_*/