Check for patched go crypto lib at runtime (#4671)

Panic if the used crypto library is not being used for compiling
This commit is contained in:
Andreas Linde 2022-10-01 19:15:29 +02:00 • committed by GitHub
parent a9600a4bd6
commit 940f6f100f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,6 +19,7 @@ import (
"github.com/evcc-io/evcc/util"
"github.com/evcc-io/evcc/util/machine"
"github.com/libp2p/zeroconf/v2"
"golang.org/x/crypto/cryptobyte"
)
var EEBUSDetails = communication.ManufacturerDetails{
@ -92,6 +93,13 @@ func NewEEBus(other map[string]interface{}) (*EEBus, error) {
return nil, err
}
// Test if go is patched for accepting the buggy Elli certificate
var res bool
b := cryptobyte.String([]byte{0x01, 0x01, 0x01})
if ok := b.ReadASN1Boolean(&res); !ok {
panic("EEBUS needs a patched go crypto library. Run `make patch-asn1` before compiling.")
}
srv := &server.Server{
Log: log.TRACE,
Addr: cc.Uri,