Custom LibOQS wrapper for Go
-
Make sure your $GOPATH is set:
echo $GOPATH
-
Clone this repository into your go path:
git clone https://github.com/Muzosh/liboqs-go $GOPATH/src/github.com/Muzosh/liboqs-go
-
On the system, where Go code will be compiled, build LibOQS (you can use
build-liboqs.sh
script from this repository) or if already built, specify its location byexport LIBOQS_ROOT=/path/to/liboqs
-
In your Go code use:
import "github.com/Muzosh/liboqs-go/oqsgo"
and thenoqsgo.XY()
-
Before building or running the Go code, export these environment variables:1
export LIBOQS_ROOT="CHANGE_ME: <path-to-liboqs-repo>" export DYLD_FALLBACK_LIBRARY_PATH="$DYLD_FALLBACK_LIBRARY_PATH:$LIBOQS_ROOT/build/lib" # only for macOS export CGO_CPPFLAGS="-I$LIBOQS_ROOT/build/include" export CGO_LDFLAGS="-L$LIBOQS_ROOT/build/lib -loqs"
-
Get the module:
go get github.com/Muzosh/liboqs-go/oqsgo
-
In your Go code use:
import "github.com/Muzosh/liboqs-go/oqsgo"
and thenoqsgo.XY()
-
If you don't have libOQS on the system, clone and build it wherever you like:
git clone -b main https://github.com/open-quantum-safe/liboqs.git && cd liboqs && cmake -GNinja -DBUILD_SHARED_LIBS=ON -B ./build . && ninja -j $(nproc) -C ./build
-
Before building or running the code, export there environment variables:
export LIBOQS_ROOT="CHANGE_ME: <path-to-liboqs-repo>" export DYLD_FALLBACK_LIBRARY_PATH="$DYLD_FALLBACK_LIBRARY_PATH:$LIBOQS_ROOT/build/lib" # only for macOS export CGO_CPPFLAGS="-I$LIBOQS_ROOT/build/include" export CGO_LDFLAGS="-L$LIBOQS_ROOT/build/lib -loqs"