scheduler

package
v0.0.0-...-465a192 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BitMaskSlotScheduler_Client

type BitMaskSlotScheduler_Client struct {
	NClients          int
	ClientWantsToSend bool
	MySlotID          int
}

BitMaskScheduler_Client holds the info necessary for a client to compute his "contribution", or part of the bitmask

func (*BitMaskSlotScheduler_Client) Client_GetOpenScheduleContribution

func (bmc *BitMaskSlotScheduler_Client) Client_GetOpenScheduleContribution() []byte

Client_GetOpenScheduleContribution computes their contribution as a bit array

func (*BitMaskSlotScheduler_Client) Client_ReceivedScheduleRequest

func (bmc *BitMaskSlotScheduler_Client) Client_ReceivedScheduleRequest(nClients int)

Client_ReceivedScheduleRequest instantiates the fields of BitMaskScheduler_Client

func (*BitMaskSlotScheduler_Client) Client_ReserveRound

func (bmc *BitMaskSlotScheduler_Client) Client_ReserveRound(slotID int)

Client_ReserveRound indicates to reserve a slot in the next round

type BitMaskSlotScheduler_Relay

type BitMaskSlotScheduler_Relay struct {
}

BitMaskScheduler_Relay

func (*BitMaskSlotScheduler_Relay) Relay_CombineContributions

func (bmr *BitMaskSlotScheduler_Relay) Relay_CombineContributions(contributions ...[]byte) []byte

Relay_CombineContributions combines (XOR) the received contributions from each clients. In the real DC-net, this is done automatically by the DC-net

func (*BitMaskSlotScheduler_Relay) Relay_ComputeFinalSchedule

func (bmr *BitMaskSlotScheduler_Relay) Relay_ComputeFinalSchedule(allContributions []byte, maxSlots int) map[int]bool

Relay_ComputeFinalSchedule computes the map[int32]bool of open slots in the next round given the stored contributions

type NeffShuffle

type NeffShuffle struct {
	RelayView   *NeffShuffleRelay
	TrusteeView *NeffShuffleTrustee
}

*

  • Holds all the components to do a Neff Shuffle. Both the Relay and the Trustee have one instance of it, but uses only
  • their part in it.
  • The struct is aware of net/ and messages, but only to craft them. Sending the messages is the responsibility of the
  • caller

func (*NeffShuffle) ClientVerifySigAndRecognizeSlot

func (n *NeffShuffle) ClientVerifySigAndRecognizeSlot(privateKey kyber.Scalar, trusteesPublicKeys []kyber.Point, lastBase kyber.Point, shuffledPublicKeys []kyber.Point, signatures [][]byte) (int, error)

*

  • Tests that all trustees signed correctly the [lastBase, ephPubKey array].
  • Locate our slot (position in the shuffle) given the ephemeral public key and the new base

func (*NeffShuffle) Init

func (n *NeffShuffle) Init()

*

  • Instanciates both the relay and the trustee view (but you still need to call init on the correct one)

type NeffShuffleRelay

type NeffShuffleRelay struct {
	NTrustees   int
	InitialBase kyber.Point

	//this is the transcript, i.e. we keep everything
	Bases              []kyber.Point
	ShuffledPublicKeys []net.PublicKeyArray
	Proofs             []net.ByteArray
	Signatures         []net.ByteArray
	SignatureCount     int

	//this is the mutable state, i.e. it change with every shuffling from trustee
	PublicKeyBeingShuffled []kyber.Point
	LastBase               kyber.Point

	CannotAddNewKeys bool
	// contains filtered or unexported fields
}

*

  • The view of the relay for the Neff Shuffle

func (*NeffShuffleRelay) AddClient

func (r *NeffShuffleRelay) AddClient(publicKey kyber.Point) error

*

  • Adds a (ephemeral if possible) public key to the shuffle pool.

func (*NeffShuffleRelay) Init

func (r *NeffShuffleRelay) Init(nTrustees int) error

*

  • Prepares the relay-view to hold the answers from the trustees, etc

func (*NeffShuffleRelay) ReceivedShuffleFromTrustee

func (r *NeffShuffleRelay) ReceivedShuffleFromTrustee(newBase kyber.Point, newPublicKeys []kyber.Point, proof []byte) (bool, error)

*

  • Simply holds the new shares and public keys, so we can use this in the next call to SendToNextTrustee()

func (*NeffShuffleRelay) ReceivedSignatureFromTrustee

func (r *NeffShuffleRelay) ReceivedSignatureFromTrustee(trusteeID int, signature []byte) (bool, error)

*

  • Simply stores the signatures

func (*NeffShuffleRelay) SendToNextTrustee

func (r *NeffShuffleRelay) SendToNextTrustee() (interface{}, int, error)

*

  • Packs a message for the next trustee. Contains the current state of the shuffle, i.e. PublicKeyBeingShuffled + LastShareProduct

func (*NeffShuffleRelay) SendTranscript

func (r *NeffShuffleRelay) SendTranscript() (interface{}, error)

*

  • Packages the Shares, ShuffledPublicKeys and Proofs

func (*NeffShuffleRelay) VerifySigsAndSendToClients

func (r *NeffShuffleRelay) VerifySigsAndSendToClients(trusteesPublicKeys []kyber.Point) (interface{}, error)

*

  • Verify all signatures, and sends to client the last shuffle (and the signatures)

type NeffShuffleTrustee

type NeffShuffleTrustee struct {
	TrusteeID  int
	PrivateKey kyber.Scalar
	PublicKey  kyber.Point

	SecretCoeff   kyber.Scalar // c[i]
	NewBase       kyber.Point  // s[i] = G * c[1] ... c[1]
	Proof         []byte
	EphemeralKeys []kyber.Point
}

*

  • The view of one trustee for the Neff Shuffle

func (*NeffShuffleTrustee) Init

func (t *NeffShuffleTrustee) Init(trusteeID int, private kyber.Scalar, public kyber.Point) error

*

  • Creates a new trustee-view for the neff shuffle, and initiates the fields correctly

func (*NeffShuffleTrustee) ReceivedShuffleFromRelay

func (t *NeffShuffleTrustee) ReceivedShuffleFromRelay(lastBase kyber.Point, clientPublicKeys []kyber.Point, shuffleKeyPositions bool, vkey []byte) (interface{}, error)

*

  • Received s[i-1], and the public keys. Do the shuffle, store locally, and send back the new s[i], shuffle array
  • If shuffleKeyPositions is false, do not shuffle the key's position (useful for testing - 0 anonymity)

func (*NeffShuffleTrustee) ReceivedTranscriptFromRelay

func (t *NeffShuffleTrustee) ReceivedTranscriptFromRelay(bases []kyber.Point, shuffledPublicKeys [][]kyber.Point, proofs [][]byte) (interface{}, error)

*

  • We received a transcript of the whole shuffle from the relay. Check that we are included, and sign

type SlotScheduler

type SlotScheduler interface {

	//the client receives a new schedule request from the relay
	Client_ReceivedScheduleRequest()

	//the client alters the schedule being computed, and ask to transmit
	Client_ReserveRound(slotID int)

	//return the schedule to send as payload
	Client_GetOpenScheduleContribution() []byte

	//Called with each client's contribution
	Relay_CombineContributions(contributions ...[]byte) []byte

	// returns all contributions in forms of a map of open slots
	Relay_ComputeFinalSchedule() map[int]bool
}

SlotScheduler is a protocol between the relay and the clients that allows to decide which slots are gonna be "open" (fixed-length byte array) or "closed" (inexistant, no message at all)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL