diff --git a/README.md b/README.md index dadba11c..b586c2ed 100644 --- a/README.md +++ b/README.md @@ -312,7 +312,9 @@ Here are the Go packages that can be imported correctly: * [crypto/sha1](https://pkg.go.dev/crypto/sha1) * [crypto/sha256](https://pkg.go.dev/crypto/sha256) * [crypto/sha512](https://pkg.go.dev/crypto/sha512) (partially) +* [crypto/hmac](https://pkg.go.dev/crypto/hmac) (partially) * [crypto/rand](https://pkg.go.dev/crypto/rand) (partially) +* [crypto/subtle](https://pkg.go.dev/crypto/subtle) (partially) * [regexp](https://pkg.go.dev/regexp) * [regexp/syntax](https://pkg.go.dev/regexp/syntax) * [go/token](https://pkg.go.dev/go/token) diff --git a/internal/build/build.go b/internal/build/build.go index 5e0128db..aa59250a 100644 --- a/internal/build/build.go +++ b/internal/build/build.go @@ -757,12 +757,13 @@ func findDylibDep(exe, lib string) string { type none struct{} var hasAltPkg = map[string]none{ + "crypto/hmac": {}, "crypto/md5": {}, + "crypto/rand": {}, "crypto/sha1": {}, "crypto/sha256": {}, "crypto/sha512": {}, - "crypto/hmac": {}, - "crypto/rand": {}, + "crypto/subtle": {}, "fmt": {}, "hash/crc32": {}, "internal/abi": {}, diff --git a/internal/lib/crypto/sha1/sha1.go b/internal/lib/crypto/sha1/sha1.go index d804ef10..3e82b36a 100644 --- a/internal/lib/crypto/sha1/sha1.go +++ b/internal/lib/crypto/sha1/sha1.go @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package sha1 // llgo:skipall diff --git a/internal/lib/crypto/sha256/sha224.go b/internal/lib/crypto/sha256/sha224.go index 79d9d0da..bcc78050 100644 --- a/internal/lib/crypto/sha256/sha224.go +++ b/internal/lib/crypto/sha256/sha224.go @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package sha256 import ( diff --git a/internal/lib/crypto/sha256/sha256.go b/internal/lib/crypto/sha256/sha256.go index 4e4dcb00..c12df32f 100644 --- a/internal/lib/crypto/sha256/sha256.go +++ b/internal/lib/crypto/sha256/sha256.go @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package sha256 // llgo:skipall diff --git a/internal/lib/crypto/sha512/sha384.go b/internal/lib/crypto/sha512/sha384.go index ecfd18d7..a30e2be6 100644 --- a/internal/lib/crypto/sha512/sha384.go +++ b/internal/lib/crypto/sha512/sha384.go @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package sha512 import ( diff --git a/internal/lib/crypto/sha512/sha512.go b/internal/lib/crypto/sha512/sha512.go index 57790485..7e658d6a 100644 --- a/internal/lib/crypto/sha512/sha512.go +++ b/internal/lib/crypto/sha512/sha512.go @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package sha512 // llgo:skipall diff --git a/internal/lib/crypto/subtle/xor.go b/internal/lib/crypto/subtle/xor.go new file mode 100644 index 00000000..0fdeab90 --- /dev/null +++ b/internal/lib/crypto/subtle/xor.go @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package subtle + +// llgo:skip XORBytes +import ( + _ "unsafe" +)