-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to Developer Beta 3 build. (#46)
- Loading branch information
Showing
13 changed files
with
1,120 additions
and
4,910 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
Sources/Crypto/ASN1/Basic ASN1 Types/ArraySliceBigint.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the SwiftCrypto open source project | ||
// | ||
// Copyright (c) 2019-2020 Apple Inc. and the SwiftCrypto project authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE.txt for license information | ||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API | ||
@_exported import CryptoKit | ||
#else | ||
|
||
// For temporary purposes we pretend that ArraySlice is our "bigint" type. We don't really need anything else. | ||
extension ArraySlice: ASN1Serializable where Element == UInt8 { } | ||
|
||
extension ArraySlice: ASN1Parseable where Element == UInt8 { } | ||
|
||
extension ArraySlice: ASN1IntegerRepresentable where Element == UInt8 { | ||
// We only use unsigned "bigint"s | ||
static var isSigned: Bool { | ||
return false | ||
} | ||
|
||
init(asn1IntegerBytes: ArraySlice<UInt8>) throws { | ||
self = asn1IntegerBytes | ||
} | ||
|
||
func withBigEndianIntegerBytes<ReturnType>(_ body: (ArraySlice<UInt8>) throws -> ReturnType) rethrows -> ReturnType { | ||
return try body(self) | ||
} | ||
} | ||
#endif |
Oops, something went wrong.