]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/internal/codesign: new package
authorCherry Zhang <cherryyz@google.com>
Sun, 22 Nov 2020 02:33:18 +0000 (21:33 -0500)
committerCherry Zhang <cherryyz@google.com>
Tue, 1 Dec 2020 21:41:39 +0000 (21:41 +0000)
commit7430266af4f951df3c113f2c817bc600650e2295
tree83e90309a545c3f2078e8cb3c6727022a3b40008
parent20e251864b7caa1b863814fdf6c26280e1b669b3
cmd/internal/codesign: new package

On macOS/ARM64, the kernel requires that binaries must have a
valid code signature to run. The C toolchain code-signs the
binary at link time. We do the same.

It is more subtle for Go because we stamp the buildid after
linking. As the signature contains hashes of the entire file
(except the signature itself), we must (re)generate the signature
after stamping the buildid.

This CL adds a new codesign package, which provides
functionality to generate the code signature. It is a separate
internal package so it can be used both in the linker and by the
go command. The next CLs will add code-signing to the linker and
the go command.

Updates #38485, #42684.

Change-Id: Id46801a6665beebaab0eb413ff2e64c5b9467059
Reviewed-on: https://go-review.googlesource.com/c/go/+/272254
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/dist/buildtool.go
src/cmd/internal/codesign/codesign.go [new file with mode: 0644]