aboutsummaryrefslogtreecommitdiff
path: root/docker/bckp/sodium.go
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2020-06-02 12:26:41 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2020-06-02 12:26:41 +0200
commitd13352910d3c352d07d7e482bc87227ce88bdb22 (patch)
tree0c7c07a1f9e8a03f54dd58c1ebf8c05693234757 /docker/bckp/sodium.go
parenta2e1f61cf8b70f0e63fc6f8eddbbcf0477263f8f (diff)
downloadinfrastructure-d13352910d3c352d07d7e482bc87227ce88bdb22.tar.gz
infrastructure-d13352910d3c352d07d7e482bc87227ce88bdb22.zip
Add upgrade documentation
Diffstat (limited to 'docker/bckp/sodium.go')
-rw-r--r--docker/bckp/sodium.go35
1 files changed, 0 insertions, 35 deletions
diff --git a/docker/bckp/sodium.go b/docker/bckp/sodium.go
deleted file mode 100644
index a4f25b4..0000000
--- a/docker/bckp/sodium.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package main
-
-/*
-#cgo CFLAGS: -g -Wall
-#cgo LDFLAGS: -lsodium
-#include <sodium.h>
-*/
-import "C"
-import "log"
-
-const block_size int = 16 * 1024 // 16 KiB
-
-func main() {
- log.Println("Test cgo")
- ret := C.sodium_init()
- if ret < 0 {
- log.Panic("Failed to init sodium.")
- }
- //unsigned char array as requested
- var key [C.crypto_secretstream_xchacha20poly1305_KEYBYTES]C.uchar
- C.crypto_secretstream_xchacha20poly1305_keygen(&key[0])
-
- var state C.crypto_secretstream_xchacha20poly1305_state
- var header [C.crypto_secretstream_xchacha20poly1305_HEADERBYTES]C.uchar
-
- C.crypto_secretstream_xchacha20poly1305_init_push(&state, &header[0], &key[0])
- log.Print("key", key)
- log.Print("header", header)
-
- var plain [block_size]C.uchar
- var c1 [block_size + C.crypto_secretstream_xchacha20poly1305_ABYTES]C.uchar
-
- C.crypto_secretstream_xchacha20poly1305_push(&state, &c1[0], nil, &plain[0], C.ulonglong(len(plain)), nil, 0, 0)
- log.Print("c1", c1)
-}