aboutsummaryrefslogtreecommitdiff
path: root/internal/stupidgcm/locking.go
blob: 29f833235fc17cbf838e1622dc344ad6f4f0d48b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//go:build !without_openssl && cgo
// +build !without_openssl,cgo

package stupidgcm

// In general, OpenSSL is only threadsafe if you provide a locking function
// through CRYPTO_set_locking_callback. However, the GCM operations that
// stupidgcm uses never call that function. Additionally, the manual locking
// has been removed completely in openssl 1.1.0.

/*
#include <openssl/crypto.h>
#include <stdio.h>

static void dummy_callback(int mode, int n, const char *file, int line) {
	printf("stupidgcm: thread locking is not implemented and should not be "
		"needed. Please upgrade openssl.\n");
	// panic
	__builtin_trap();
}
static void set_dummy_callback() {
	CRYPTO_set_locking_callback(dummy_callback);
}
*/
import "C"

func init() {
	C.set_dummy_callback()
}