trustee

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: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TRUSTEE_KILL_SEND_PROCESS int16 = iota // kills the goroutine responsible for sending messages
	TRUSTEE_RATE_ACTIVE
	TRUSTEE_RATE_HALVED
)

Possible sending rates for the trustees.

Variables

This section is empty.

Functions

This section is empty.

Types

type NeffShuffleResult

type NeffShuffleResult struct {
	// contains filtered or unexported fields
}

NeffShuffleResult holds the result of the NeffShuffle, since it needs to be verified when we receive REL_TRU_TELL_TRANSCRIPT.

type PriFiLibTrusteeInstance

type PriFiLibTrusteeInstance struct {
	// contains filtered or unexported fields
}

PriFiLibTrusteeInstance contains the mutable state of a PriFi entity.

func NewTrustee

func NewTrustee(neverSlowDown bool, alwaysSlowDown bool, baseSleepTime int, msgSender *net.MessageSenderWrapper) *PriFiLibTrusteeInstance

NewPriFiClientWithState creates a new PriFi client entity state.

func (*PriFiLibTrusteeInstance) ReceivedMessage

func (p *PriFiLibTrusteeInstance) ReceivedMessage(msg interface{}) error

ReceivedMessage must be called when a PriFi host receives a message. It takes care to call the correct message handler function.

func (*PriFiLibTrusteeInstance) Received_ALL_ALL_PARAMETERS

func (p *PriFiLibTrusteeInstance) Received_ALL_ALL_PARAMETERS(msg net.ALL_ALL_PARAMETERS) error

Received_ALL_ALL_PARAMETERS handles ALL_ALL_PARAMETERS. It initializes the trustee with the parameters contained in the message.

func (*PriFiLibTrusteeInstance) Received_ALL_ALL_SHUTDOWN

func (p *PriFiLibTrusteeInstance) Received_ALL_ALL_SHUTDOWN(msg net.ALL_ALL_SHUTDOWN) error

Received_ALL_ALL_SHUTDOWN handles ALL_ALL_SHUTDOWN messages. When we receive this message we should clean up resources.

func (*PriFiLibTrusteeInstance) Received_REL_ALL_DISRUPTION_REVEAL

func (p *PriFiLibTrusteeInstance) Received_REL_ALL_DISRUPTION_REVEAL(msg net.REL_ALL_DISRUPTION_REVEAL) error

* Received_REL_ALL_DISRUPTION_REVEAL handles REL_ALL_DISRUPTION_REVEAL messages. * The method calls a function from the DCNet to regenerate the bits from roundID in position BitPos * The result is sent to the relay.

func (*PriFiLibTrusteeInstance) Received_REL_ALL_REVEAL_SHARED_SECRETS

func (p *PriFiLibTrusteeInstance) Received_REL_ALL_REVEAL_SHARED_SECRETS(msg net.REL_ALL_REVEAL_SHARED_SECRETS) error

* Received_REL_ALL_REVEAL_SHARED_SECRETS handles REL_ALL_REVEAL_SHARED_SECRETS messages. * The method gets the shared secret and sends it to the relay.

func (*PriFiLibTrusteeInstance) Received_REL_TRU_TELL_CLIENTS_PKS_AND_EPH_PKS_AND_BASE

func (p *PriFiLibTrusteeInstance) Received_REL_TRU_TELL_CLIENTS_PKS_AND_EPH_PKS_AND_BASE(msg net.REL_TRU_TELL_CLIENTS_PKS_AND_EPH_PKS_AND_BASE) error

Received_REL_TRU_TELL_CLIENTS_PKS_AND_EPH_PKS_AND_BASE handles REL_TRU_TELL_CLIENTS_PKS_AND_EPH_PKS_AND_BASE messages. Those are sent when the connection to a relay is established. They contain the long-term and ephemeral public keys of the clients, and a base given by the relay. In addition to deriving the secrets, the trustee uses the ephemeral keys to perform a Neff shuffle. It remembers this shuffle in order to check the correctness of the chain of shuffle afterwards.

func (*PriFiLibTrusteeInstance) Received_REL_TRU_TELL_RATE_CHANGE

func (p *PriFiLibTrusteeInstance) Received_REL_TRU_TELL_RATE_CHANGE(msg net.REL_TRU_TELL_RATE_CHANGE) error

Received_REL_TRU_TELL_RATE_CHANGE handles REL_TRU_TELL_RATE_CHANGE messages by changing the cipher sending rate. Either the trustee must stop sending because the relay is at full capacity or the trustee sends normally because the relay has emptied up enough capacity.

func (*PriFiLibTrusteeInstance) Received_REL_TRU_TELL_TRANSCRIPT

func (p *PriFiLibTrusteeInstance) Received_REL_TRU_TELL_TRANSCRIPT(msg net.REL_TRU_TELL_TRANSCRIPT) error

Received_REL_TRU_TELL_TRANSCRIPT handles REL_TRU_TELL_TRANSCRIPT messages. Those are sent when all trustees have already shuffled. They need to verify all the shuffles, and also that their own shuffle has been included in the chain of shuffles. If that's the case, this trustee signs the *last* shuffle (which will be used by the clients), and sends it back to the relay. If everything succeed, starts the goroutine for sending DC-net ciphers to the relay.

func (*PriFiLibTrusteeInstance) Send_TRU_REL_DC_CIPHER

func (p *PriFiLibTrusteeInstance) Send_TRU_REL_DC_CIPHER(rateChan chan int16)

Send_TRU_REL_DC_CIPHER sends DC-net ciphers to the relay continuously once started. One can control the rate by sending flags to "rateChan".

func (*PriFiLibTrusteeInstance) Send_TRU_REL_PK

func (p *PriFiLibTrusteeInstance) Send_TRU_REL_PK() error

Send_TRU_REL_PK tells the relay's public key to the relay (this, of course, provides no security, but this is an early version of the protocol). This is the first action of the trustee.

type TrusteeState

type TrusteeState struct {
	DCNet            *dcnet.DCNetEntity
	ClientPublicKeys []kyber.Point
	ID               int
	MessageHistory   kyber.XOF
	Name             string

	PayloadSize int

	PublicKey kyber.Point

	TrusteeID                     int
	BaseSleepTime                 int
	AlwaysSlowDown                bool //enforce the sleep in the sending function even if rate is FULL
	NeverSlowDown                 bool //ignore the sleep in the sending function if rate is STOPPED
	EquivocationProtectionEnabled bool
	// contains filtered or unexported fields
}

TrusteeState contains the mutable state of the trustee.

Jump to

Keyboard shortcuts

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