Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

elliptic.Marshal() function is deprecated #480

Open
1 task done
bendbennett opened this issue Mar 1, 2024 · 0 comments
Open
1 task done

elliptic.Marshal() function is deprecated #480

bendbennett opened this issue Mar 1, 2024 · 0 comments

Comments

@bendbennett
Copy link
Contributor

Terraform CLI and Provider Versions

N/A

Use Cases or Problem Statement

The deprecated elliptic.Marshal function is used within the generateSubjectKeyID function.

The deprecation notice states:

// Deprecated: for ECDH, use the crypto/ecdh package. This function returns an
// encoding equivalent to that of PublicKey.Bytes in crypto/ecdh.

The current implementation is as follows:

pubKeyBytes = elliptic.Marshal(pub.Curve, pub.X, pub.Y)

However, a direct switch to using ecdh results in a nil pointer:

ecdhPubKey, err = pub.ECDH()
pubKeyBytes = ecdhPubKey.Bytes()
=== RUN   TestResourceLocallySignedCert_FromECDSAPrivateKeyResource
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x10092f0e8]

goroutine 227 [running]:
crypto/ecdh.(*PublicKey).Bytes(0x0)
	/opt/homebrew/opt/go/libexec/src/crypto/ecdh/ecdh.go:79 +0x78
github.com/hashicorp/terraform-provider-tls/internal/provider.generateSubjectKeyID({0x101501b00, 0x14000475350})
	/Users/bdb/go/src/github/hashicorp/terraform-provider-tls/internal/provider/common_cert.go:94 +0x398

Proposal

Further investigation is required to determine how best to handle replacement of the deprecated elliptic.Marshal function.

How much impact is this issue causing?

Low

Additional Information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant