github.com/0xsequence/ethkit@v1.25.0/go-ethereum/crypto/secp256k1/panic_cb.go (about)

     1  // Copyright 2015 Jeffrey Wilcke, Felix Lange, Gustav Simonsson. All rights reserved.
     2  // Use of this source code is governed by a BSD-style license that can be found in
     3  // the LICENSE file.
     4  
     5  //go:build !gofuzz && cgo
     6  // +build !gofuzz,cgo
     7  
     8  package secp256k1
     9  
    10  import "C"
    11  import "unsafe"
    12  
    13  // Callbacks for converting libsecp256k1 internal faults into
    14  // recoverable Go panics.
    15  
    16  //export ethkitSecp256k1GoPanicIllegal
    17  func ethkitSecp256k1GoPanicIllegal(msg *C.char, data unsafe.Pointer) {
    18  	panic("illegal argument: " + C.GoString(msg))
    19  }
    20  
    21  //export ethkitSecp256k1GoPanicError
    22  func ethkitSecp256k1GoPanicError(msg *C.char, data unsafe.Pointer) {
    23  	panic("internal error: " + C.GoString(msg))
    24  }