X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/80e2389990082500d76eb566d4946be3e786c3ef..d8f41ccd20de16f8ebe2ccc84d47bf1cb2b26bbb:/sec/Security/SecOTRMath.h diff --git a/sec/Security/SecOTRMath.h b/sec/Security/SecOTRMath.h deleted file mode 100644 index 936e1069..00000000 --- a/sec/Security/SecOTRMath.h +++ /dev/null @@ -1,65 +0,0 @@ -// -// OTRMath.h -// libsecurity_libSecOTR -// -// Created by Mitch Adler on 1/28/11. -// Copyright 2011 Apple Inc. All rights reserved. -// - -#ifndef _SECOTRMATH_H_ -#define _SECOTRMATH_H_ - -#include - -#include -#include -#include - -#define kOTRAuthKeyBytes 16 -#define kOTRAuthMACKeyBytes 32 - -#define kOTRMessageKeyBytes 16 -#define kOTRMessageMacKeyBytes 20 - -#define kExponentiationBits 1536 -#define kExponentiationUnits ccn_nof(kExponentiationBits) -#define kExponentiationBytes ((kExponentiationBits+7)/8) - -#define kSHA256HMAC160Bits 160 -#define kSHA256HMAC160Bytes (kSHA256HMAC160Bits/8) - -// Result and exponent are expected to be kExponentiationUnits big. -void OTRExponentiate(cc_unit* res, const cc_unit* base, const cc_unit* exponent); -void OTRGroupExponentiate(cc_unit* result, const cc_unit* exponent); - -OSStatus GetRandomBytesInLSBs(size_t bytesOfRandomness, size_t n, cc_unit* place); -OSStatus FillWithRandomBytes(size_t n, cc_unit* place); - -typedef enum { - kSSID = 0x00, - kCs = 0x01, - kM1 = 0x02, - kM2 = 0x03, - kM1Prime = 0x04, - kM2Prime = 0x05 -} KeyType; - - -void DeriveOTR256BitsFromS(KeyType whichKey, size_t sSize, const cc_unit* s, size_t keySize, uint8_t* key); -void DeriveOTR128BitPairFromS(KeyType whichHalf, size_t sSize, const cc_unit* s, - size_t firstKeySize, uint8_t* firstKey, - size_t secondKeySize, uint8_t* secondKey); -void DeriveOTR64BitsFromS(KeyType whichKey, size_t sSize, const cc_unit* s, - size_t firstKeySize, uint8_t* firstKey); - - -void AES_CTR_HighHalf_Transform(size_t keySize, const uint8_t* key, - uint64_t highHalf, - size_t howMuch, const uint8_t* from, - uint8_t* to); - -void AES_CTR_IV0_Transform(size_t keySize, const uint8_t* key, - size_t howMuch, const uint8_t* from, - uint8_t* to); - -#endif