Skip to content

secureenclave: remove deprecated crypto APIs, bump to go 1.26.5 - #61

Merged
brhoades merged 4 commits into
mainfrom
billy/bump-go-and-secureenclave
Jul 27, 2026
Merged

secureenclave: remove deprecated crypto APIs, bump to go 1.26.5#61
brhoades merged 4 commits into
mainfrom
billy/bump-go-and-secureenclave

Conversation

@brhoades

@brhoades brhoades commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

We previously noted that a few crypto APIs were deprecated, even back in #37 we added lint excludes. I don't believe there was a way around it at the time for ecdsa, though? Go 1.26 further deprecated the ecdsa.PublicKey fields for X and Y after 1.25 added ecdsa.ParseUncompressedPublicKey, per the changelog:

The new ParseRawPrivateKey, ParseUncompressedPublicKey, PrivateKey.Bytes, and PublicKey.Bytes functions and methods implement low-level encodings, replacing the need to use crypto/elliptic or math/big functions and methods.

I'm no cryptographer, but this looks like what's required to remove our deprecated usage, since we can now directly parse a public key from some bytes. It also ended up being a roadblock when upgrading actionlint.

Changes:

  • Swapped out /pkg/secureenclave's to use the new APIs described above.
  • Added docs about working around openssl errors on MacOS.

TPM Error

I added documentation about openssl after running into this error on TPM tests:

❯ go test -v -count 1 ./pkg/tpm
# github.com/google/go-tpm-tools/simulator/internal
In file included from ../../go/pkg/mod/github.com/google/go-tpm-tools@v0.3.11/simulator/internal/internal_cgo.go:45:
In file included from ../../go/pkg/mod/github.com/google/go-tpm-tools@v0.3.11/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Tpm.h:47:
In file included from ../../go/pkg/mod/github.com/google/go-tpm-tools@v0.3.11/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/LibSupport.h:63:
../../go/pkg/mod/github.com/google/go-tpm-tools@v0.3.11/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ossl/TpmToOsslSym.h:47:10: fatal error: 'openssl/aes.h' file not found
   47 | #include <openssl/aes.h>
      |          ^~~~~~~~~~~~~~~
1 error generated.
FAIL	github.com/kolide/krypto/pkg/tpm [build failed]
FAIL

Test Results

Running the secureenclave tests pass:

=== RUN   TestSecureEnclaveTestRunner
=== PAUSE TestSecureEnclaveTestRunner
=== CONT  TestSecureEnclaveTestRunner
    secureenclave_test.go:39: 
        executing wrapped tests with codesigned app and entitlements
    secureenclave_test.go:73: === RUN   TestPublicKeyKnownGood
        === PAUSE TestPublicKeyKnownGood
        === RUN   TestPublicKeyLookUpHashNilCoordinates
        === PAUSE TestPublicKeyLookUpHashNilCoordinates
        === RUN   TestSecureEnclaveTestRunner
        === PAUSE TestSecureEnclaveTestRunner
        === RUN   TestSecureEnclaveSigning
        === PAUSE TestSecureEnclaveSigning
        === RUN   TestSecureEnclaveErrors
        === PAUSE TestSecureEnclaveErrors
        === CONT  TestPublicKeyKnownGood
        === CONT  TestSecureEnclaveErrors
        === CONT  TestSecureEnclaveSigning
        === CONT  TestPublicKeyLookUpHashNilCoordinates
        === NAME  TestSecureEnclaveErrors
            secureenclave_test.go:115: 
                running wrapped tests with codesigned app and entitlements
        === CONT  TestSecureEnclaveTestRunner
        --- PASS: TestSecureEnclaveErrors (0.00s)
        === NAME  TestSecureEnclaveSigning
            secureenclave_test.go:83: 
                running wrapped tests with codesigned app and entitlements
        === NAME  TestSecureEnclaveTestRunner
            secureenclave_test.go:36: 
                skipping because SECURE_ENCLAVE_TEST_WRAPPED env var was not empty, this is the execution of the codesigned app with entitlements
        --- SKIP: TestSecureEnclaveTestRunner (0.00s)
        --- PASS: TestPublicKeyLookUpHashNilCoordinates (0.00s)
        --- PASS: TestPublicKeyKnownGood (0.00s)
        --- PASS: TestSecureEnclaveSigning (0.03s)
        PASS
        coverage: 84.5% of statements
        
--- PASS: TestSecureEnclaveTestRunner (7.32s)
PASS
ok  	github.com/kolide/krypto/pkg/secureenclave	(cached)

@brhoades
brhoades force-pushed the billy/bump-go-and-secureenclave branch from a8b9698 to f4077ec Compare July 24, 2026 21:24
@brhoades
brhoades force-pushed the billy/bump-go-and-secureenclave branch 6 times, most recently from edb841d to 2e9cc8e Compare July 24, 2026 21:52
brhoades added 3 commits July 27, 2026 11:04
Go 1.26 deprecates the X and Y fields and 1.25 added the new API that we
needed to make it work.
@brhoades
brhoades force-pushed the billy/bump-go-and-secureenclave branch from 2e9cc8e to dc89305 Compare July 27, 2026 18:05
@brhoades brhoades changed the title secureenclave: remove use of deprecated fields and elliptic.Marshal, bump to go 1.26.5 secureenclave: remove deprecated crypto APIs, bump to go 1.26.5 Jul 27, 2026
Comment on lines +160 to +162
// PublicKey.Bytes below panics on nil coordinates This is fully cargo culted:
// I don't know if this actually occurs in production use.
//nolint:staticcheck

@brhoades brhoades Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if we need this. The comment here is true, but whether it can actually happen outside of a test? 🤷

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I know the answer to this either. I don't believe I've seen the public key has nil XY coordinates error in logs before, and I'm not seeing it in an extremely cursory search of Cloud Log

@brhoades
brhoades marked this pull request as ready for review July 27, 2026 18:41
@brhoades
brhoades requested a review from RebeccaMahany July 27, 2026 18:41
Comment thread .github/workflows/actionlint.yml
Comment on lines +160 to +162
// PublicKey.Bytes below panics on nil coordinates This is fully cargo culted:
// I don't know if this actually occurs in production use.
//nolint:staticcheck

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I know the answer to this either. I don't believe I've seen the public key has nil XY coordinates error in logs before, and I'm not seeing it in an extremely cursory search of Cloud Log

@brhoades
brhoades merged commit 02e9caa into main Jul 27, 2026
14 checks passed
@brhoades
brhoades deleted the billy/bump-go-and-secureenclave branch July 27, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants