Skip to content

Update Swift Crypto with API from CryptoKit @ WWDC20 #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Sources/Crypto/AEADs/AES/GCM/AES-GCM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the SwiftCrypto open source project
//
// Copyright (c) 2019 Apple Inc. and the SwiftCrypto project authors
// Copyright (c) 2019-2020 Apple Inc. and the SwiftCrypto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand Down Expand Up @@ -85,7 +85,6 @@ extension AES {
}

extension AES.GCM {
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, macCatalyst 13.0, *)
public struct SealedBox: AEADSealedBox {
private let combinedRepresentation: Data
private let nonceByteCount: Int
Expand Down Expand Up @@ -124,7 +123,7 @@ extension AES.GCM {
// While we have these values in the internal APIs, we can't use it in inlinable code.
let aesGCMOverhead = 12 + 16

if (combined.count < aesGCMOverhead) {
if combined.count < aesGCMOverhead {
throw CryptoKitError.incorrectParameterSize
}

Expand Down
6 changes: 2 additions & 4 deletions Sources/Crypto/AEADs/ChachaPoly/ChaChaPoly.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the SwiftCrypto open source project
//
// Copyright (c) 2019 Apple Inc. and the SwiftCrypto project authors
// Copyright (c) 2019-2020 Apple Inc. and the SwiftCrypto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand All @@ -24,7 +24,6 @@ typealias ChaChaPolyImpl = OpenSSLChaChaPolyImpl
import Foundation

/// ChaCha20-Poly1305 as described in RFC 7539 with 96-bit nonces.
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, macCatalyst 13.0, *)
public enum ChaChaPoly: Cipher {
static let tagByteCount = 16
static let keyBitsCount = 256
Expand Down Expand Up @@ -87,7 +86,6 @@ public enum ChaChaPoly: Cipher {

extension ChaChaPoly {
@frozen
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, macCatalyst 13.0, *)
public struct SealedBox: AEADSealedBox {
/// The combined representation ( nonce || ciphertext || tag)
public let combined: Data
Expand All @@ -110,7 +108,7 @@ extension ChaChaPoly {
// While we have these values in the internal APIs, we can't use it in inlinable code.
let chachaPolyOverhead = 12 + 16

if (combined.count < chachaPolyOverhead) {
if combined.count < chachaPolyOverhead {
throw CryptoKitError.incorrectParameterSize
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/Crypto/AEADs/Cipher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the SwiftCrypto open source project
//
// Copyright (c) 2019 Apple Inc. and the SwiftCrypto project authors
// Copyright (c) 2019-2020 Apple Inc. and the SwiftCrypto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand Down
2 changes: 1 addition & 1 deletion Sources/Crypto/AEADs/Nonces.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the SwiftCrypto open source project
//
// Copyright (c) 2019 Apple Inc. and the SwiftCrypto project authors
// Copyright (c) 2019-2020 Apple Inc. and the SwiftCrypto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand Down
2 changes: 1 addition & 1 deletion Sources/Crypto/AEADs/Nonces.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the SwiftCrypto open source project
//
// Copyright (c) 2019 Apple Inc. and the SwiftCrypto project authors
// Copyright (c) 2019-2020 Apple Inc. and the SwiftCrypto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand Down
Loading