Skip to content

Commit

Permalink
bindings/go/blst.tgo: add SrcRoot variable to hold the source code root.
Browse files Browse the repository at this point in the history
  • Loading branch information
dot-asm committed Jul 7, 2024
1 parent fa1788b commit 4b4211e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bindings/go/blst.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package blst
// #cgo loong64 mips64 mips64le ppc64 ppc64le riscv64 s390x CFLAGS: -D__BLST_NO_ASM__
//
// #include "blst.h"
// const char *go_blst_src_server_c();
//
// #if defined(__x86_64__) && (defined(__unix__) || defined(__APPLE__))
// # include <signal.h>
Expand Down Expand Up @@ -156,6 +157,7 @@ import "C"
import (
"fmt"
"math/bits"
"path/filepath"
"runtime"
"sync"
"sync/atomic"
Expand Down Expand Up @@ -217,6 +219,13 @@ var cgo_p1Generator = *C.blst_p1_generator()
var cgo_p2Generator = *C.blst_p2_generator()
var cgo_fp12One = *C.blst_fp12_one()

var SrcRoot = initSrcRoot()

func initSrcRoot() string {
path := C.GoString(C.go_blst_src_server_c())
return filepath.Dir(filepath.Dir(path))
}

// Secret key
func (sk *SecretKey) Zeroize() {
var zero SecretKey
Expand Down
8 changes: 8 additions & 0 deletions bindings/go/blst.tgo
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ package blst
// #cgo loong64 mips64 mips64le ppc64 ppc64le riscv64 s390x CFLAGS: -D__BLST_NO_ASM__
//
// #include "blst.h"
// const char *go_blst_src_server_c();
//
// #if defined(__x86_64__) && (defined(__unix__) || defined(__APPLE__))
// # include <signal.h>
Expand Down Expand Up @@ -207,6 +208,13 @@ var cgo_p1Generator = *C.blst_p1_generator()
var cgo_p2Generator = *C.blst_p2_generator()
var cgo_fp12One = *C.blst_fp12_one()

var SrcRoot = initSrcRoot()

func initSrcRoot() string {
path := C.GoString(C.go_blst_src_server_c())
return filepath.Dir(filepath.Dir(path))
}

//
// Secret key
//
Expand Down

0 comments on commit 4b4211e

Please sign in to comment.