Skip to content

Commit d8ac107

Browse files
committed
migrate hammer
1 parent 810af86 commit d8ac107

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

internal/hammer/loadtest/workers.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,20 @@ package loadtest
1717
import (
1818
"context"
1919
"crypto/sha256"
20+
"crypto/x509"
2021
"encoding/base64"
2122
"encoding/json"
2223
"errors"
2324
"fmt"
2425
"math/rand/v2"
2526
"time"
2627

27-
"slices"
28-
29-
"github.com/google/certificate-transparency-go/x509"
3028
"github.com/transparency-dev/formats/log"
3129
"github.com/transparency-dev/merkle/proof"
3230
"github.com/transparency-dev/merkle/rfc6962"
3331
"github.com/transparency-dev/static-ct/internal/client"
3432
"github.com/transparency-dev/static-ct/internal/types"
33+
"github.com/transparency-dev/static-ct/internal/x509util"
3534
"github.com/transparency-dev/trillian-tessera/api/layout"
3635
"github.com/transparency-dev/trillian-tessera/ctonly"
3736
"k8s.io/klog/v2"
@@ -427,7 +426,7 @@ func entryFromChain(chain []*x509.Certificate, isPrecert bool, timestamp uint64)
427426

428427
// Next, post-process the DER-encoded TBSCertificate, to remove the CT poison
429428
// extension and possibly update the issuer field.
430-
defangedTBS, err := x509.BuildPrecertTBS(cert.RawTBSCertificate, preIssuer)
429+
defangedTBS, err := x509util.BuildPrecertTBS(cert.RawTBSCertificate, preIssuer)
431430
if err != nil {
432431
return nil, fmt.Errorf("failed to remove poison extension: %v", err)
433432
}
@@ -445,6 +444,15 @@ func entryFromChain(chain []*x509.Certificate, isPrecert bool, timestamp uint64)
445444
// isPreIssuer indicates whether a certificate is a pre-cert issuer with the specific
446445
// certificate transparency extended key usage.
447446
// Copied from certificate-transparency-go/serialization.go and internal/scti/handlers.go.
448-
func isPreIssuer(issuer *x509.Certificate) bool {
449-
return slices.Contains(issuer.ExtKeyUsage, x509.ExtKeyUsageCertificateTransparency)
447+
// TODO(phboneff): unify these.
448+
func isPreIssuer(cert *x509.Certificate) bool {
449+
// Look for the extension in the Extensions field and not ExtKeyUsage
450+
// since the base TLS library does not recognize this extension as
451+
// an ExtKeyUsage.
452+
for _, ext := range cert.Extensions {
453+
if types.OIDExtKeyUsageCertificateTransparency.Equal(ext.Id) {
454+
return true
455+
}
456+
}
457+
return false
450458
}

0 commit comments

Comments
 (0)