Merge branch 'jrose/remove-hkdf-version'

This commit is contained in:
Jordan Rose 2022-01-25 17:33:18 -08:00
commit 0118a00436
5 changed files with 8 additions and 9 deletions

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2021 Open Whisper Systems. All rights reserved.
// Copyright (c) 2022 Open Whisper Systems. All rights reserved.
//
import Foundation
@ -1063,7 +1063,7 @@ fileprivate extension GroupsV2Migration {
}
let migrationInfo = "GV2 Migration"
let masterKey = try migrationInfo.utf8.withContiguousStorageIfAvailable {
try hkdf(outputLength: GroupMasterKey.SIZE, version: 3, inputKeyMaterial: v1GroupId, salt: [], info: $0)
try hkdf(outputLength: GroupMasterKey.SIZE, inputKeyMaterial: v1GroupId, salt: [], info: $0)
}!
return Data(masterKey)
}

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2021 Open Whisper Systems. All rights reserved.
// Copyright (c) 2022 Open Whisper Systems. All rights reserved.
//
import CommonCrypto
@ -60,7 +60,7 @@ public class OWSProvisioningCipher: NSObject {
let infoData = ProvisioningCipher.messageInfo
let derivedSecret: [UInt8] = try infoData.utf8.withContiguousStorageIfAvailable {
let totalLength = Self.cipherKeyLength + Self.macKeyLength
return try hkdf(outputLength: totalLength, version: 3, inputKeyMaterial: sharedSecret, salt: [], info: $0)
return try hkdf(outputLength: totalLength, inputKeyMaterial: sharedSecret, salt: [], info: $0)
}!
let cipherKey = derivedSecret[0..<Self.cipherKeyLength]
let macKey = derivedSecret[Self.cipherKeyLength...]

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2021 Open Whisper Systems. All rights reserved.
// Copyright (c) 2022 Open Whisper Systems. All rights reserved.
//
import Foundation
@ -70,7 +70,7 @@ public class ProvisioningCipher {
with: primaryDeviceEphemeralPublicKey)
let keyBytes = try Self.messageInfo.utf8.withContiguousStorageIfAvailable {
try hkdf(outputLength: 64, version: 3, inputKeyMaterial: agreement, salt: [], info: $0)
try hkdf(outputLength: 64, inputKeyMaterial: agreement, salt: [], info: $0)
}!
let cipherKey = Array(keyBytes[0..<32])

View File

@ -1082,7 +1082,7 @@ public class StickerManager: NSObject {
let stickerKeyInfo = "Sticker Pack"
let stickerKeyLength = 64
let stickerKey = try stickerKeyInfo.utf8.withContiguousStorageIfAvailable {
try hkdf(outputLength: stickerKeyLength, version: 3, inputKeyMaterial: packKey, salt: [], info: $0)
try hkdf(outputLength: stickerKeyLength, inputKeyMaterial: packKey, salt: [], info: $0)
}!
let temporaryDecryptedFile = OWSFileSystem.temporaryFileUrl(isAvailableWhileDeviceLocked: true)

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2021 Open Whisper Systems. All rights reserved.
// Copyright (c) 2022 Open Whisper Systems. All rights reserved.
//
import Foundation
@ -333,7 +333,6 @@ public class RemoteAttestationKeys: NSObject {
let derivedMaterial = try hkdf(
outputLength: Int(kAES256_KeyByteLength) * 2,
version: 3,
inputKeyMaterial: masterSecret,
salt: publicKeys,
info: []