X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/80e2389990082500d76eb566d4946be3e786c3ef..d8f41ccd20de16f8ebe2ccc84d47bf1cb2b26bbb:/sec/Security/SecOTRIdentityPriv.h diff --git a/sec/Security/SecOTRIdentityPriv.h b/sec/Security/SecOTRIdentityPriv.h deleted file mode 100644 index 2ade61e8..00000000 --- a/sec/Security/SecOTRIdentityPriv.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * SecOTRIdentityPriv.h - * libsecurity_libSecOTR - * - * Created by Mitch Adler on 2/9/11. - * Copyright 2011 Apple Inc. All rights reserved. - * - */ - -#ifndef _SECOTRIDENTITYPRIV_H_ - -#include -#include - -#include - -#include - -#include // DIGEST_LENGTH -#include - -__BEGIN_DECLS - -extern CFStringRef sErrorDomain; - -// OAEP Padding, uses lots of space. Might need this to be data -// Driven when we support more key types. -#define kPaddingOverhead (2 + 2 * CC_SHA1_DIGEST_LENGTH + 1) - -// -// Identity opaque structs -// - -#define kMPIDHashSize CC_SHA1_DIGEST_LENGTH - -struct _SecOTRFullIdentity { - CFRuntimeBase _base; - - SecKeyRef publicSigningKey; - SecKeyRef privateSigningKey; - - uint8_t publicIDHash[kMPIDHashSize]; -}; - - -struct _SecOTRPublicIdentity { - CFRuntimeBase _base; - - SecKeyRef publicSigningKey; - - bool wantsHashes; - - uint8_t hash[kMPIDHashSize]; -}; - -enum SecOTRError { - secOTRErrorLocal, - secOTRErrorOSError, -}; - -const SecAsn1AlgId *kOTRSignatureAlgIDPtr; -void EnsureOTRAlgIDInited(void); - -// Private functions for Public and Full IDs -SecOTRFullIdentityRef SecOTRFullIdentityCreateWithSize(CFAllocatorRef allocator, int bits); - -bool SecOTRFIAppendSignature(SecOTRFullIdentityRef fullID, - CFDataRef dataToHash, - CFMutableDataRef appendTo, - CFErrorRef *error); - -void SecOTRFIAppendPublicHash(SecOTRFullIdentityRef fullID, CFMutableDataRef appendTo); -bool SecOTRFIComparePublicHash(SecOTRFullIdentityRef fullID, const uint8_t hash[kMPIDHashSize]); - -size_t SecOTRFISignatureSize(SecOTRFullIdentityRef privateID); - -bool SecOTRPIVerifySignature(SecOTRPublicIdentityRef publicID, - const uint8_t *dataToHash, size_t amountToHash, - const uint8_t *signatureStart, size_t signatureSize, CFErrorRef *error); - -bool SecOTRPIEqualToBytes(SecOTRPublicIdentityRef id, const uint8_t*bytes, CFIndex size); -bool SecOTRPIEqual(SecOTRPublicIdentityRef left, SecOTRPublicIdentityRef right); - -size_t SecOTRPISignatureSize(SecOTRPublicIdentityRef publicID); - -void SecOTRPICopyHash(SecOTRPublicIdentityRef publicID, uint8_t hash[kMPIDHashSize]); -void SecOTRPIAppendHash(SecOTRPublicIdentityRef publicID, CFMutableDataRef appendTo); - -bool SecOTRPICompareHash(SecOTRPublicIdentityRef publicID, const uint8_t hash[kMPIDHashSize]); - -// Utility streaming functions -OSStatus insertSize(CFIndex size, uint8_t* here); -OSStatus appendSize(CFIndex size, CFMutableDataRef into); -OSStatus readSize(const uint8_t** data, size_t* limit, uint16_t* size); - -OSStatus appendPublicOctets(SecKeyRef fromKey, CFMutableDataRef appendTo); -OSStatus appendPublicOctetsAndSize(SecKeyRef fromKey, CFMutableDataRef appendTo); -OSStatus appendSizeAndData(CFDataRef data, CFMutableDataRef appendTo); - -SecKeyRef CreateECPrivateKeyFrom(CFAllocatorRef allocator, const uint8_t** data, size_t* limit); -SecKeyRef CreateECPublicKeyFrom(CFAllocatorRef allocator, const uint8_t** data, size_t* limit); - -void SecOTRCreateError(enum SecOTRError family, CFIndex errorCode, CFStringRef descriptionString, CFErrorRef previousError, CFErrorRef *newError); - -__END_DECLS - -#endif