@@ -15,9 +15,6 @@ import (
1515 "fmt"
1616 "hash"
1717 "io"
18-
19- circlPki "github.com/cloudflare/circl/pki"
20- circlSign "github.com/cloudflare/circl/sign"
2118)
2219
2320// verifyHandshakeSignature verifies a signature against pre-hashed
@@ -58,20 +55,7 @@ func verifyHandshakeSignature(sigType uint8, pubkey crypto.PublicKey, hashFunc c
5855 return err
5956 }
6057 default :
61- // [UTLS SECTION BEGINS]
62- // Ported from cloudflare/go
63- scheme := circlSchemeBySigType (sigType )
64- if scheme == nil {
65- return errors .New ("internal error: unknown signature type" )
66- }
67- pubKey , ok := pubkey .(circlSign.PublicKey )
68- if ! ok {
69- return fmt .Errorf ("expected a %s public key, got %T" , scheme .Name (), pubkey )
70- }
71- if ! scheme .Verify (pubKey , signed , sig , nil ) {
72- return fmt .Errorf ("%s verification failure" , scheme .Name ())
73- }
74- // [UTLS SECTION ENDS]
58+ return errors .New ("internal error: unknown signature type" )
7559 }
7660 return nil
7761}
@@ -122,18 +106,7 @@ func typeAndHashFromSignatureScheme(signatureAlgorithm SignatureScheme) (sigType
122106 case Ed25519 :
123107 sigType = signatureEd25519
124108 default :
125- // [UTLS SECTION BEGINS]
126- // Ported from cloudflare/go
127- scheme := circlPki .SchemeByTLSID (uint (signatureAlgorithm ))
128- if scheme == nil {
129- return 0 , 0 , fmt .Errorf ("unsupported signature algorithm: %v" , signatureAlgorithm )
130- }
131- sigType = sigTypeByCirclScheme (scheme )
132- if sigType == 0 {
133- return 0 , 0 , fmt .Errorf ("circl scheme %s not supported" ,
134- scheme .Name ())
135- }
136- // [UTLS SECTION ENDS]
109+ return 0 , 0 , fmt .Errorf ("unsupported signature algorithm: %v" , signatureAlgorithm )
137110 }
138111 switch signatureAlgorithm {
139112 case PKCS1WithSHA1 , ECDSAWithSHA1 :
@@ -147,14 +120,7 @@ func typeAndHashFromSignatureScheme(signatureAlgorithm SignatureScheme) (sigType
147120 case Ed25519 :
148121 hash = directSigning
149122 default :
150- // [UTLS SECTION BEGINS]
151- // Ported from cloudflare/go
152- scheme := circlPki .SchemeByTLSID (uint (signatureAlgorithm ))
153- if scheme == nil {
154- return 0 , 0 , fmt .Errorf ("unsupported signature algorithm: %v" , signatureAlgorithm )
155- }
156- hash = directSigning
157- // [UTLS SECTION ENDS]
123+ return 0 , 0 , fmt .Errorf ("unsupported signature algorithm: %v" , signatureAlgorithm )
158124 }
159125 return sigType , hash , nil
160126}
@@ -174,11 +140,6 @@ func legacyTypeAndHashFromPublicKey(pub crypto.PublicKey) (sigType uint8, hash c
174140 // full signature, and not even OpenSSL bothers with the
175141 // complexity, so we can't even test it properly.
176142 return 0 , 0 , fmt .Errorf ("tls: Ed25519 public keys are not supported before TLS 1.2" )
177- // [UTLS SECTION BEGINS]
178- // Ported from cloudflare/go
179- case circlSign.PublicKey :
180- return 0 , 0 , fmt .Errorf ("tls: circl public keys are not supported before TLS 1.2" )
181- // [UTLS SECTION ENDS]
182143 default :
183144 return 0 , 0 , fmt .Errorf ("tls: unsupported public key: %T" , pub )
184145 }
@@ -249,16 +210,6 @@ func signatureSchemesForCertificate(version uint16, cert *Certificate) []Signatu
249210 }
250211 case ed25519.PublicKey :
251212 sigAlgs = []SignatureScheme {Ed25519 }
252- // [UTLS SECTION BEGINS]
253- // Ported from cloudflare/go
254- case circlSign.PublicKey :
255- scheme := pub .Scheme ()
256- tlsScheme , ok := scheme .(circlPki.TLSScheme )
257- if ! ok {
258- return nil
259- }
260- sigAlgs = []SignatureScheme {SignatureScheme (tlsScheme .TLSIdentifier ())}
261- // [UTLS SECTION ENDS]
262213 default :
263214 return nil
264215 }
0 commit comments