Skip to content

Commit

Permalink
Version 0.12.0 (#47)
Browse files Browse the repository at this point in the history
Signed-off-by: Vlad Gheorghiu <[email protected]>
  • Loading branch information
vsoftco committed Jan 16, 2025
1 parent 8a109c3 commit eeb454f
Show file tree
Hide file tree
Showing 15 changed files with 356 additions and 173 deletions.
1 change: 1 addition & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
env:
BUILD_TYPE: Debug
LD_LIBRARY_PATH: /usr/local/lib
DYLD_LIBRARY_PATH: /usr/local/lib
POSIX_PKG_CONFIG_PATH: ${{github.workspace}}/.config
WIN_LIBOQS_INSTALL_PATH: C:\liboqs
WIN_PKG_CONFIG_PATH: C:\Strawberry\c\lib\pkgconfig
Expand Down
16 changes: 16 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# Version 0.12.0 - January 15, 2025

- Fixes https://github.com/open-quantum-safe/liboqs-go/issues/44. The API that
NIST has introduced in [FIPS 204](https://csrc.nist.gov/pubs/fips/204/final)
for ML-DSA includes a context string of length >= 0. Added new API for
signing with a context string
- `func (sig *Signature)
SignWithCtxStr(message []byte, context []byte) ([]byte, error)`
- `func (sig *Signature)
VerifyWithCtxStr(message []byte, signature []byte, context []byte,
publicKey []byte) (bool, error)`
- Updated examples to use `ML-KEM` and `ML-DSA` as the defaults
- Removed the `oqs.rand` package and moved the `RandomBytes` family of
functions from `oqs.rand` to the main `oqs` package to avoid warnings about
linking liboqs twice

# Version 0.10.0 - March 27, 2024

- Bumped Go version to 1.21
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019-2024 Open Quantum Safe
Copyright (c) 2019-2025 Open Quantum Safe

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,8 @@ The project contains the following files and directories:

Please note that on some platforms not all algorithms are supported:

- macOS/Darwin: The Rainbow and Classic-McEliece algorithm families as well as
HQC-256 do not work.
- Windows: The Rainbow and Classic-McEliece algorithm families do not work.
- macOS/Darwin: No known issues as of liboqs-0.12.0
- Windows: No known issues as of liboqs-0.12.0

---

Expand Down
8 changes: 4 additions & 4 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# liboqs-go version 0.10.0
# liboqs-go version 0.12.0

---

Expand All @@ -24,12 +24,12 @@ See in particular limitations on intended use.

## Release notes

This release of liboqs-go was released on March 27, 2024. Its release page on
GitHub is https://github.com/open-quantum-safe/liboqs-go/releases/tag/0.10.0.
This release of liboqs-go was released on January 15, 2025. Its release page on
GitHub is https://github.com/open-quantum-safe/liboqs-go/releases/tag/0.12.0.

---

## What's New

This is the 13th release of liboqs-go. For a list of changes see
This is the 14th release of liboqs-go. For a list of changes see
[CHANGES.md](https://github.com/open-quantum-safe/liboqs-go/blob/main/CHANGES.md).
5 changes: 3 additions & 2 deletions examples/client_server_kem/server/server_kem.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func main() {
os.Exit(1)
}
port := os.Args[1]
kemName := "Kyber512"
kemName := "ML-KEM-512"
if len(os.Args) > 2 {
kemName = os.Args[2]
}
Expand Down Expand Up @@ -116,8 +116,9 @@ func handleConnection(conn net.Conn, kemName string) {
Details().LengthCiphertext) + " bytes, but instead wrote " + fmt.Sprintf("%v", n)))
}

// First connection is #1
log.Printf("\nConnection #%d - server shared secret:\n% X ... % X\n\n",
counter.Val(), sharedSecretServer[0:8],
counter.Val()+1, sharedSecretServer[0:8],
sharedSecretServer[len(sharedSecretServer)-8:])

// Increment the connection number
Expand Down
2 changes: 1 addition & 1 deletion examples/kem/kem.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func main() {
fmt.Println("Enabled KEMs:")
fmt.Println(oqs.EnabledKEMs())

kemName := "Kyber512"
kemName := "ML-KEM-512"
client := oqs.KeyEncapsulation{}
defer client.Clean() // clean up even in case of panic

Expand Down
13 changes: 6 additions & 7 deletions examples/rand/rand.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"runtime"

"github.com/open-quantum-safe/liboqs-go/oqs"
oqsrand "github.com/open-quantum-safe/liboqs-go/oqs/rand" // RNG support
)

// CustomRNG provides a (trivial) custom random number generator; the memory is
Expand All @@ -22,20 +21,20 @@ func CustomRNG(randomArray []byte, bytesToRead int) {
func main() {
fmt.Println("liboqs version: " + oqs.LiboqsVersion())

if err := oqsrand.RandomBytesSwitchAlgorithm("system"); err != nil {
if err := oqs.RandomBytesSwitchAlgorithm("system"); err != nil {
log.Fatal(err)
}
fmt.Printf("%18s% X\n", "System (default): ", oqsrand.RandomBytes(32))
if err := oqsrand.RandomBytesCustomAlgorithm(CustomRNG); err != nil {
fmt.Printf("%18s% X\n", "System (default): ", oqs.RandomBytes(32))
if err := oqs.RandomBytesCustomAlgorithm(CustomRNG); err != nil {
log.Fatal(err)
}
fmt.Printf("%-18s% X\n", "Custom RNG: ", oqsrand.RandomBytes(32))
fmt.Printf("%-18s% X\n", "Custom RNG: ", oqs.RandomBytes(32))

// We do not yet support OpenSSL under Windows
if runtime.GOOS != "windows" {
if err := oqsrand.RandomBytesSwitchAlgorithm("OpenSSL"); err != nil {
if err := oqs.RandomBytesSwitchAlgorithm("OpenSSL"); err != nil {
log.Fatal(err)
}
fmt.Printf("%-18s% X\n", "OpenSSL: ", oqsrand.RandomBytes(32))
fmt.Printf("%-18s% X\n", "OpenSSL: ", oqs.RandomBytes(32))
}
}
7 changes: 5 additions & 2 deletions examples/sig/sig.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func main() {
fmt.Println("Enabled signatures:")
fmt.Println(oqs.EnabledSigs())

sigName := "Dilithium2"
sigName := "ML-DSA-44"
signer := oqs.Signature{}
defer signer.Clean() // clean up even in case of panic

Expand All @@ -32,7 +32,10 @@ func main() {
fmt.Printf("\nSigner public key:\n% X ... % X\n", pubKey[0:8],
pubKey[len(pubKey)-8:])

signature, _ := signer.Sign(msg)
signature, err := signer.Sign(msg)
if err != nil {
log.Fatal(err)
}
fmt.Printf("\nSignature:\n% X ... % X\n", signature[0:8],
signature[len(signature)-8:])

Expand Down
13 changes: 13 additions & 0 deletions oqs/cfuncs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package oqs

// C callbacks, DO NOT CHANGE

/*
#include <stdint.h>
#include <stddef.h>
void randAlgorithmPtr_cgo(uint8_t* random_array, size_t bytes_to_read) {
void randAlgorithmPtr(uint8_t*, size_t);
randAlgorithmPtr(random_array, bytes_to_read);
}
*/
import "C"
Loading

0 comments on commit eeb454f

Please sign in to comment.