Files
podman/vendor/github.com/containers/libtrust/ec_key_no_openssl.go
Miloslav Trmač d3f59bedb3 Update c/image to v4.0.1 and buildah to 1.11.3
This requires updating all import paths throughout, and a matching
buildah update to interoperate.

I can't figure out the reason for go.mod tracking
	github.com/containers/image v3.0.2+incompatible // indirect
((go mod graph) lists it as a direct dependency of libpod, but
(go list -json -m all) lists it as an indirect dependency),
but at least looking at the vendor subdirectory, it doesn't seem
to be actually used in the built binaries.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2019-10-04 20:18:23 +02:00

24 lines
466 B
Go

// +build !libtrust_openssl
package libtrust
import (
"crypto"
"crypto/ecdsa"
"crypto/rand"
"fmt"
"io"
"math/big"
)
func (k *ecPrivateKey) sign(data io.Reader, hashID crypto.Hash) (r, s *big.Int, err error) {
hasher := k.signatureAlgorithm.HashID().New()
_, err = io.Copy(hasher, data)
if err != nil {
return nil, nil, fmt.Errorf("error reading data to sign: %s", err)
}
hash := hasher.Sum(nil)
return ecdsa.Sign(rand.Reader, k.PrivateKey, hash)
}