Skip to content

Commit

Permalink
Revert "bump go directive to 1.17"
Browse files Browse the repository at this point in the history
This reverts commit c7ff548.
  • Loading branch information
qmuntal committed Apr 18, 2023
1 parent 6ebf3f1 commit 0759933
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG VARIANT=1.17-bullseye
FROM mcr.microsoft.com/devcontainers/go:0-${VARIANT}
FROM mcr.microsoft.com/vscode/devcontainers/go:0-${VARIANT}

RUN apt-get update \
&& apt-get install -y build-essential
8 changes: 3 additions & 5 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
"GO_OPENSSL_VERSION_OVERRIDE": "1.1.0",
},
"onCreateCommand": "sh ${containerWorkspaceFolder}/scripts/openssl.sh ${GO_OPENSSL_VERSION_OVERRIDE}",
"customizations": {
"vscode": {
"extensions": ["golang.go"]
}
},
"extensions": [
"golang.go"
]
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/microsoft/go-crypto-openssl

go 1.17
go 1.16
20 changes: 0 additions & 20 deletions openssl/sha.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,26 +119,6 @@ func (h *evpHash) Write(p []byte) (int, error) {
return len(p), nil
}

func (h *evpHash) WriteString(s string) (int, error) {
// TODO: use unsafe.StringData once we drop support
// for go1.19 and earlier.
hdr := (*struct {
Data *byte
Len int
})(unsafe.Pointer(&s))
if len(s) > 0 && C.go_openssl_EVP_DigestUpdate(h.ctx, unsafe.Pointer(hdr.Data), C.size_t(len(s))) == 0 {
panic("openssl: EVP_DigestUpdate failed")
}
return len(s), nil
}

func (h *evpHash) WriteByte(c byte) error {
if C.go_openssl_EVP_DigestUpdate(h.ctx, unsafe.Pointer(&c), 1) == 0 {
panic("openssl: EVP_DigestUpdate failed")
}
return nil
}

func (h *evpHash) Size() int {
return h.size
}
Expand Down
18 changes: 0 additions & 18 deletions openssl/sha_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"bytes"
"encoding"
"hash"
"io"
"testing"
)

Expand Down Expand Up @@ -63,23 +62,6 @@ func TestSha(t *testing.T) {
if !bytes.Equal(sum, initSum) {
t.Errorf("got:%x want:%x", sum, initSum)
}

bw := h.(io.ByteWriter)
for i := 0; i < len(msg); i++ {
bw.WriteByte(msg[i])
}
h.Reset()
sum = h.Sum(nil)
if !bytes.Equal(sum, initSum) {
t.Errorf("got:%x want:%x", sum, initSum)
}

h.(io.StringWriter).WriteString(string(msg))
h.Reset()
sum = h.Sum(nil)
if !bytes.Equal(sum, initSum) {
t.Errorf("got:%x want:%x", sum, initSum)
}
})
}
}
Expand Down

0 comments on commit 0759933

Please sign in to comment.