mirror of
https://github.com/apple/swift-crypto
synced 2026-11-26 04:47:49 +00:00
Adding MARK delimiter for different curves within gyb generated files. (#19)
This commit is contained in:
1 parent
de232cbd67
commit
77b30226ac
8 files changed
+38
-6
No files matched your search
@@ -19,6 +19,7 @@ import Foundation
|
||||
// any edits of this file WILL be overwritten and thus discarded
|
||||
// see section `gyb` in `README` for details.
|
||||
|
||||
// MARK: - AES.GCM + Nonce
|
||||
extension AES.GCM {
|
||||
public struct Nonce: ContiguousBytes, Sequence {
|
||||
let bytes: Data
|
||||
@@ -48,6 +49,7 @@ extension AES.GCM {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - ChaChaPoly + Nonce
|
||||
extension ChaChaPoly {
|
||||
public struct Nonce: ContiguousBytes, Sequence {
|
||||
let bytes: Data
|
||||
|
||||
@@ -28,6 +28,7 @@ nonceSize = cipher["recommendedNonceSize"]
|
||||
nonceValidation = cipher["nonceValidation"]
|
||||
}%
|
||||
|
||||
// MARK: - ${name} + Nonce
|
||||
extension ${name} {
|
||||
public struct Nonce: ContiguousBytes, Sequence {
|
||||
let bytes: Data
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
// any edits of this file WILL be overwritten and thus discarded
|
||||
// see section `gyb` in `README` for details.
|
||||
|
||||
// MARK: - SHA256Digest + DigestPrivate
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, macCatalyst 13.0, *)
|
||||
public struct SHA256Digest: DigestPrivate {
|
||||
let bytes: (UInt64, UInt64, UInt64, UInt64)
|
||||
@@ -65,6 +66,7 @@ public struct SHA256Digest: DigestPrivate {
|
||||
}
|
||||
|
||||
|
||||
// MARK: - SHA384Digest + DigestPrivate
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, macCatalyst 13.0, *)
|
||||
public struct SHA384Digest: DigestPrivate {
|
||||
let bytes: (UInt64, UInt64, UInt64, UInt64, UInt64, UInt64)
|
||||
@@ -114,6 +116,7 @@ public struct SHA384Digest: DigestPrivate {
|
||||
}
|
||||
|
||||
|
||||
// MARK: - SHA512Digest + DigestPrivate
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, macCatalyst 13.0, *)
|
||||
public struct SHA512Digest: DigestPrivate {
|
||||
let bytes: (UInt64, UInt64, UInt64, UInt64, UInt64, UInt64, UInt64, UInt64)
|
||||
@@ -165,6 +168,7 @@ public struct SHA512Digest: DigestPrivate {
|
||||
}
|
||||
|
||||
extension Insecure {
|
||||
// MARK: - SHA1Digest + DigestPrivate
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, macCatalyst 13.0, *)
|
||||
public struct SHA1Digest: DigestPrivate {
|
||||
let bytes: (UInt64, UInt64, UInt64)
|
||||
@@ -211,6 +215,7 @@ public struct SHA1Digest: DigestPrivate {
|
||||
}
|
||||
}
|
||||
extension Insecure {
|
||||
// MARK: - MD5Digest + DigestPrivate
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, macCatalyst 13.0, *)
|
||||
public struct MD5Digest: DigestPrivate {
|
||||
let bytes: (UInt64, UInt64)
|
||||
|
||||
@@ -35,6 +35,7 @@ digests_and_length = [{"name": "SHA256", "count": 32},{"name": "SHA384","count":
|
||||
protocol_suffix = ""
|
||||
}%
|
||||
${protocol_prefix}
|
||||
// MARK: - ${name}Digest + DigestPrivate
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, macCatalyst 13.0, *)
|
||||
public struct ${name}Digest: DigestPrivate {
|
||||
let bytes: (${(wordsCount-1)*"UInt64, "+"UInt64"})
|
||||
|
||||
@@ -23,12 +23,15 @@ typealias NISTCurvePrivateKeyImpl = OpenSSLNISTCurvePrivateKeyImpl
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
|
||||
// MARK: - Generated file, do NOT edit
|
||||
// any edits of this file WILL be overwritten and thus discarded
|
||||
// see section `gyb` in `README` for details.
|
||||
|
||||
// MARK: - P256 + Signing
|
||||
extension P256 {
|
||||
public enum Signing {
|
||||
|
||||
public struct PublicKey: NISTECPublicKey {
|
||||
var impl: NISTCurvePublicKeyImpl<P256.CurveDetails>
|
||||
|
||||
@@ -81,9 +84,10 @@ extension P256 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - P256 + KeyAgreement
|
||||
extension P256 {
|
||||
public enum KeyAgreement {
|
||||
|
||||
public struct PublicKey: NISTECPublicKey {
|
||||
var impl: NISTCurvePublicKeyImpl<P256.CurveDetails>
|
||||
|
||||
@@ -136,9 +140,10 @@ extension P256 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - P384 + Signing
|
||||
extension P384 {
|
||||
public enum Signing {
|
||||
|
||||
public struct PublicKey: NISTECPublicKey {
|
||||
var impl: NISTCurvePublicKeyImpl<P384.CurveDetails>
|
||||
|
||||
@@ -191,9 +196,10 @@ extension P384 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - P384 + KeyAgreement
|
||||
extension P384 {
|
||||
public enum KeyAgreement {
|
||||
|
||||
public struct PublicKey: NISTECPublicKey {
|
||||
var impl: NISTCurvePublicKeyImpl<P384.CurveDetails>
|
||||
|
||||
@@ -246,9 +252,10 @@ extension P384 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - P521 + Signing
|
||||
extension P521 {
|
||||
public enum Signing {
|
||||
|
||||
public struct PublicKey: NISTECPublicKey {
|
||||
var impl: NISTCurvePublicKeyImpl<P521.CurveDetails>
|
||||
|
||||
@@ -301,9 +308,10 @@ extension P521 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - P521 + KeyAgreement
|
||||
extension P521 {
|
||||
public enum KeyAgreement {
|
||||
|
||||
public struct PublicKey: NISTECPublicKey {
|
||||
var impl: NISTCurvePublicKeyImpl<P521.CurveDetails>
|
||||
|
||||
@@ -357,6 +365,7 @@ extension P521 {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - P256 + DH
|
||||
extension P256.KeyAgreement.PrivateKey: DiffieHellmanKeyAgreement {
|
||||
/// Performs a key agreement with provided public key share.
|
||||
///
|
||||
@@ -371,6 +380,7 @@ extension P256.KeyAgreement.PrivateKey: DiffieHellmanKeyAgreement {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// MARK: - P384 + DH
|
||||
extension P384.KeyAgreement.PrivateKey: DiffieHellmanKeyAgreement {
|
||||
/// Performs a key agreement with provided public key share.
|
||||
///
|
||||
@@ -385,6 +395,7 @@ extension P384.KeyAgreement.PrivateKey: DiffieHellmanKeyAgreement {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// MARK: - P521 + DH
|
||||
extension P521.KeyAgreement.PrivateKey: DiffieHellmanKeyAgreement {
|
||||
/// Performs a key agreement with provided public key share.
|
||||
///
|
||||
|
||||
@@ -23,18 +23,21 @@ typealias NISTCurvePrivateKeyImpl = OpenSSLNISTCurvePrivateKeyImpl
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
|
||||
// MARK: - Generated file, do NOT edit
|
||||
// any edits of this file WILL be overwritten and thus discarded
|
||||
// see section `gyb` in `README` for details.
|
||||
|
||||
%{
|
||||
NIST_CURVES = ["P256", "P384", "P521"]
|
||||
CURVES_FUNC = ["Signing", "KeyAgreement"]
|
||||
}%
|
||||
% for CURVE in NIST_CURVES:
|
||||
% for FUNC in CURVES_FUNC:
|
||||
|
||||
// MARK: - ${CURVE} + ${FUNC}
|
||||
extension ${CURVE} {
|
||||
public enum ${FUNC} {
|
||||
|
||||
public struct PublicKey: NISTECPublicKey {
|
||||
var impl: NISTCurvePublicKeyImpl<${CURVE}.CurveDetails>
|
||||
|
||||
@@ -91,6 +94,7 @@ extension ${CURVE} {
|
||||
% end
|
||||
|
||||
% for CURVE in NIST_CURVES:
|
||||
// MARK: - ${CURVE} + DH
|
||||
extension ${CURVE}.KeyAgreement.PrivateKey: DiffieHellmanKeyAgreement {
|
||||
/// Performs a key agreement with provided public key share.
|
||||
///
|
||||
|
||||
@@ -32,6 +32,7 @@ protocol NISTSigning {
|
||||
associatedtype ECDSASignature: NISTECDSASignature
|
||||
}
|
||||
|
||||
// MARK: - P256 + Signing
|
||||
/// An ECDSA (Elliptic Curve Digital Signature Algorithm) Signature
|
||||
extension P256.Signing {
|
||||
public struct ECDSASignature: ContiguousBytes, NISTECDSASignature {
|
||||
@@ -91,6 +92,7 @@ extension P256.Signing {
|
||||
|
||||
extension P256.Signing: NISTSigning {}
|
||||
|
||||
// MARK: - P256 + PrivateKey
|
||||
extension P256.Signing.PrivateKey: DigestSigner {
|
||||
/// Generates an ECDSA signature over the P256 elliptic curve.
|
||||
///
|
||||
@@ -147,6 +149,7 @@ extension P256.Signing.PublicKey: DigestValidator {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - P384 + Signing
|
||||
/// An ECDSA (Elliptic Curve Digital Signature Algorithm) Signature
|
||||
extension P384.Signing {
|
||||
public struct ECDSASignature: ContiguousBytes, NISTECDSASignature {
|
||||
@@ -206,6 +209,7 @@ extension P384.Signing {
|
||||
|
||||
extension P384.Signing: NISTSigning {}
|
||||
|
||||
// MARK: - P384 + PrivateKey
|
||||
extension P384.Signing.PrivateKey: DigestSigner {
|
||||
/// Generates an ECDSA signature over the P384 elliptic curve.
|
||||
///
|
||||
@@ -262,6 +266,7 @@ extension P384.Signing.PublicKey: DigestValidator {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - P521 + Signing
|
||||
/// An ECDSA (Elliptic Curve Digital Signature Algorithm) Signature
|
||||
extension P521.Signing {
|
||||
public struct ECDSASignature: ContiguousBytes, NISTECDSASignature {
|
||||
@@ -321,6 +326,7 @@ extension P521.Signing {
|
||||
|
||||
extension P521.Signing: NISTSigning {}
|
||||
|
||||
// MARK: - P521 + PrivateKey
|
||||
extension P521.Signing.PrivateKey: DigestSigner {
|
||||
/// Generates an ECDSA signature over the P521 elliptic curve.
|
||||
///
|
||||
|
||||
@@ -40,6 +40,7 @@ protocol NISTSigning {
|
||||
CURVE = CURVE_AND_HF["curve"]
|
||||
HF = CURVE_AND_HF["hf"]
|
||||
}%
|
||||
// MARK: - ${CURVE} + Signing
|
||||
/// An ECDSA (Elliptic Curve Digital Signature Algorithm) Signature
|
||||
extension ${CURVE}.Signing {
|
||||
public struct ECDSASignature: ContiguousBytes, NISTECDSASignature {
|
||||
@@ -99,6 +100,7 @@ extension ${CURVE}.Signing {
|
||||
|
||||
extension ${CURVE}.Signing: NISTSigning {}
|
||||
|
||||
// MARK: - ${CURVE} + PrivateKey
|
||||
extension ${CURVE}.Signing.PrivateKey: DigestSigner {
|
||||
/// Generates an ECDSA signature over the ${CURVE} elliptic curve.
|
||||
///
|
||||
|
||||
Reference in new issue
Block a user