Skip to content

Commit 5e5ce98

Browse files
aykevldeadprogram
authored andcommitted
compiler: add aliases for many hashing packages
This commit adds support for the following packages: - crypto/md5 - crypto/sha1 - crypto/sha256 - crypto/sha512 They would normally need assembly implementations, but with these aliases they already work everywhere.
1 parent a3c4421 commit 5e5ce98

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,10 @@ TEST_PACKAGES = \
190190
container/list \
191191
container/ring \
192192
crypto/des \
193+
crypto/md5 \
194+
crypto/sha1 \
195+
crypto/sha256 \
196+
crypto/sha512 \
193197
encoding \
194198
encoding/ascii85 \
195199
encoding/base32 \

compiler/alias.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ package compiler
1515
import "tinygo.org/x/go-llvm"
1616

1717
var stdlibAliases = map[string]string{
18+
// crypto packages
19+
"crypto/md5.block": "crypto/md5.blockGeneric",
20+
"crypto/sha1.block": "crypto/sha1.blockGeneric",
21+
"crypto/sha1.blockAMD64": "crypto/sha1.blockGeneric",
22+
"crypto/sha256.block": "crypto/sha256.blockGeneric",
23+
"crypto/sha512.blockAMD64": "crypto/sha512.blockGeneric",
24+
1825
// math package
1926
"math.Asin": "math.asin",
2027
"math.Asinh": "math.asinh",

compiler/compiler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
// Version of the compiler pacakge. Must be incremented each time the compiler
2424
// package changes in a way that affects the generated LLVM module.
2525
// This version is independent of the TinyGo version number.
26-
const Version = 14 // last change: add math assembly aliases
26+
const Version = 15 // last change: add crypto assembly aliases
2727

2828
func init() {
2929
llvm.InitializeAllTargets()

0 commit comments

Comments
 (0)