diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index bf3c7f6..9ce1904 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -16,13 +16,15 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.17 + go-version: 1.23 - name: Build run: go build -v ./... - name: Test run: go test -v ./... + env: + CGO_ENABLED: "0" build_windows: runs-on: windows-latest @@ -32,10 +34,12 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.17 + go-version: 1.23 - name: Build run: go build -v ./... - name: Test run: go test -v ./... + env: + CGO_ENABLED: "0" diff --git a/.gitignore b/.gitignore index 4cb344e..95225ea 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ vmextension/testdir/ vendor/ pkg/utils/configTemp/ pkg/utils/downloadTemp/ +pkg/settings/testdir/ diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..4aea389 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "go.testEnvVars": { + "CGO_ENABLED": "0" + } +} diff --git a/pkg/encrypt/encrypt_windows.go b/pkg/encrypt/encrypt_windows.go index e6faf95..1175189 100644 --- a/pkg/encrypt/encrypt_windows.go +++ b/pkg/encrypt/encrypt_windows.go @@ -5,10 +5,11 @@ package encrypt import ( "encoding/hex" "fmt" - "github.com/Azure/azure-extension-platform/pkg/internal/crypto" - "golang.org/x/sys/windows" "syscall" "unsafe" + + "github.com/Azure/azure-extension-platform/pkg/internal/crypto" + "golang.org/x/sys/windows" ) const ( @@ -30,7 +31,7 @@ func (cHandler *certHandler) GetThumbprint() (certThumbprint string, err error) func (cHandler *certHandler) Encrypt(bytesToEncrypt []byte) (encryptedBytes []byte, err error) { alg := szOID_RSA_RC4 - buffer := []byte(alg) + buffer := append([]byte(alg), 0) // null-terminate for the C API procCryptEncryptMessage := crypto.Modcrypt32.NewProc("CryptEncryptMessage") cai := crypto.CryptAlgorithmIdentifier{ PszObjID: uintptr(unsafe.Pointer(&buffer[0])),