core/crypto: Use panic_contextless instead of intrinsics.trap

This commit is contained in:
Yawning Angel
2025-03-23 19:14:33 +09:00
parent 4c28f6d170
commit e4e76f27f6
13 changed files with 21 additions and 33 deletions
+1 -2
View File
@@ -1,6 +1,5 @@
package _chacha20
import "base:intrinsics"
import "core:encoding/endian"
import "core:math/bits"
import "core:mem"
@@ -47,7 +46,7 @@ Context :: struct {
// HChaCha call can be suitably accelerated.
init :: proc "contextless" (ctx: ^Context, key, iv: []byte, is_xchacha: bool) {
if len(key) != KEY_SIZE || len(iv) != IV_SIZE {
intrinsics.trap()
panic_contextless("chacha20: invalid key or IV size")
}
k, n := key, iv
@@ -13,5 +13,5 @@ stream_blocks :: proc(ctx: ^_chacha20.Context, dst, src: []byte, nr_blocks: int)
}
hchacha20 :: proc "contextless" (dst, key, iv: []byte) {
intrinsics.trap()
panic_contextless("crypto/chacha20: simd256 implementation unsupported")
}