Skip to content

Commit

Permalink
dh/DeriveSharedSecret: lock OS thread (spacemonkeygo#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
huwcbjones authored Jul 9, 2024
1 parent 3f180a4 commit 07cafbe
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dh.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@

package openssl

import "runtime"

// DeriveSharedSecret derives a shared secret using a private key and a peer's
// public key.
// The specific algorithm that is used depends on the types of the
// keys, but it is most commonly a variant of Diffie-Hellman.
func DeriveSharedSecret(private PrivateKey, public PublicKey) ([]byte, error) {
runtime.LockOSThread()
defer runtime.UnlockOSThread()
// Create context for the shared secret derivation
ctx, err := NewPKeyDeriveContextFromKey(private)
if err != nil {
Expand Down

0 comments on commit 07cafbe

Please sign in to comment.