]> git.saurik.com Git - apple/security.git/blob - sec/Security/SecOTRDHKey.h
Security-55471.14.8.tar.gz
[apple/security.git] / sec / Security / SecOTRDHKey.h
1 //
2 // SecOTRDHKey.h
3 // libsecurity_libSecOTR
4 //
5 // Created by Mitch Adler on 3/2/11.
6 // Copyright 2011 Apple Inc. All rights reserved.
7 //
8 #ifndef _SECOTRDHKEY_H_
9 #define _SECOTRDHKEY_H_
10
11 #include <CoreFoundation/CFBase.h>
12 #include <CoreFoundation/CFData.h>
13 #include <corecrypto/ccn.h>
14
15 __BEGIN_DECLS
16
17 typedef struct _SecOTRFullDHKey* SecOTRFullDHKeyRef;
18 typedef struct _SecOTRPublicDHKey* SecOTRPublicDHKeyRef;
19
20 SecOTRFullDHKeyRef SecOTRFullDHKCreate(CFAllocatorRef allocator);
21 SecOTRFullDHKeyRef SecOTRFullDHKCreateFromBytes(CFAllocatorRef allocator, const uint8_t**bytes, size_t*size);
22
23 void SecFDHKNewKey(SecOTRFullDHKeyRef key);
24 void SecFDHKAppendSerialization(SecOTRFullDHKeyRef fullKey, CFMutableDataRef appendTo);
25 void SecFDHKAppendPublicSerialization(SecOTRFullDHKeyRef fullKey, CFMutableDataRef appendTo);
26 uint8_t* SecFDHKGetHash(SecOTRFullDHKeyRef pubKey);
27
28
29 SecOTRPublicDHKeyRef SecOTRPublicDHKCreateFromFullKey(CFAllocatorRef allocator, SecOTRFullDHKeyRef full);
30 SecOTRPublicDHKeyRef SecOTRPublicDHKCreateFromSerialization(CFAllocatorRef allocator, const uint8_t**bytes, size_t*size);
31 SecOTRPublicDHKeyRef SecOTRPublicDHKCreateFromBytes(CFAllocatorRef allocator, const uint8_t** bytes, size_t *size);
32
33 void SecPDHKAppendSerialization(SecOTRPublicDHKeyRef pubKey, CFMutableDataRef appendTo);
34 uint8_t* SecPDHKGetHash(SecOTRPublicDHKeyRef pubKey);
35
36 void SecPDHKeyGenerateS(SecOTRFullDHKeyRef myKey, SecOTRPublicDHKeyRef theirKey, cc_unit* s);
37
38 bool SecDHKIsGreater(SecOTRFullDHKeyRef myKey, SecOTRPublicDHKeyRef theirKey);
39
40 void SecOTRDHKGenerateOTRKeys(SecOTRFullDHKeyRef myKey, SecOTRPublicDHKeyRef theirKey,
41 uint8_t* sendMessageKey, uint8_t* sendMacKey,
42 uint8_t* receiveMessageKey, uint8_t* receiveMacKey);
43
44 __END_DECLS
45
46 #endif