newhope: github.com/katzenpost/newhope Index | Files

package newhope

import "github.com/katzenpost/newhope"

Package newhope implements a key exchange based on the Ring Learning with Errors Problem. It is a mechanical port of the Public Domain implementation by Erdem Alkim, Léo Ducas, Thomas Pöppelmann, and Peter Schwabe.

For more information see: https://cryptojedi.org/papers/newhope-20161119.pdf https://cryptojedi.org/papers/newhopesimple-20161217.pdf

Index

Package Files

batcher.go error_correction.go newhope.go newhope_simple.go ntt.go params.go poly.go poly_simple.go precomp.go reduce.go

Constants

const (
    // SharedSecretSize is the length of a Shared Secret in bytes.
    SharedSecretSize = 32

    // UpstreamVersion is the version of the upstream package this
    // implementation is compatible with.
    UpstreamVersion = "20160815"

    // RecBytes is the length of the reconciliation data in bytes.
    RecBytes = 256

    // SendASize is the length of Alice's public key in bytes.
    SendASize = PolyBytes + SeedBytes

    // SendBSize is the length of Bob's public key in bytes.
    SendBSize = PolyBytes + RecBytes
)
const (
    // HighBytes is the length of the encoded secret in bytes.
    HighBytes = 384

    // SendASimpleSize is the length of Alice's NewHope-Simple public key in
    // bytes.
    SendASimpleSize = PolyBytes + SeedBytes

    // SendBSimpleSize is the length of Bob's NewHope-Simple public key in
    // bytes.
    SendBSimpleSize = PolyBytes + HighBytes
)
const (
    // PolyBytes is the length of an encoded polynomial in bytes.
    PolyBytes = 1792
)
const (

    // SeedBytes is the size of the seed in bytes.
    SeedBytes = 32
)

Variables

var TorSampling = false

TorSampling enables the constant time generation of the `a` parameter, where every successful `a` generation will take the same amount of time. Most users will probably not want to enable this as it does come with a performance penalty. Alice and Bob *MUST* agree on the sampling method, or the key exchange will fail.

func GenerateKeyPairAlice Uses

func GenerateKeyPairAlice(rand io.Reader) (*PrivateKeyAlice, *PublicKeyAlice, error)

GenerateKeyPairAlice returns a private/public key pair. The private key is generated using the given reader, which must return random data. The receiver side of the key exchange (aka "Bob") MUST use KeyExchangeBob() instead of this routine.

func GenerateKeyPairSimpleAlice Uses

func GenerateKeyPairSimpleAlice(rand io.Reader) (*PrivateKeySimpleAlice, *PublicKeySimpleAlice, error)

GenerateKeyPairSimpleAlice returns a NewHope-Simple private/public key pair. The private key is generated using the given reader, which must return random data. The receiver side of the key exchange (aka "Bob") MUST use KeyExchangeSimpleBob() instead of this routine.

func KeyExchangeAlice Uses

func KeyExchangeAlice(bobPk *PublicKeyBob, aliceSk *PrivateKeyAlice) ([]byte, error)

KeyExchangeAlice is the Initiaitor side of the NewHope key exchange. The provided private key is obliterated prior to returning.

func KeyExchangeSimpleAlice Uses

func KeyExchangeSimpleAlice(bobPk *PublicKeySimpleBob, aliceSk *PrivateKeySimpleAlice) ([]byte, error)

KeyExchangeSimpleAlice is the Initiaitor side of the NewHope-Simple key exchange. The provided private key is obliterated prior to returning.

type PrivateKeyAlice Uses

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

PrivateKeyAlice is Alice's NewHope private key.

func (*PrivateKeyAlice) Reset Uses

func (k *PrivateKeyAlice) Reset()

Reset clears all sensitive information such that it no longer appears in memory.

type PrivateKeySimpleAlice Uses

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

PrivateKeySimpleAlice is Alice's NewHope-Simple private key.

func (*PrivateKeySimpleAlice) Reset Uses

func (k *PrivateKeySimpleAlice) Reset()

Reset clears all sensitive information such that it no longer appears in memory.

type PublicKeyAlice Uses

type PublicKeyAlice struct {
    Send [SendASize]byte
}

PublicKeyAlice is Alice's NewHope public key.

type PublicKeyBob Uses

type PublicKeyBob struct {
    Send [SendBSize]byte
}

PublicKeyBob is Bob's NewHope public key.

func KeyExchangeBob Uses

func KeyExchangeBob(rand io.Reader, alicePk *PublicKeyAlice) (*PublicKeyBob, []byte, error)

KeyExchangeBob is the Responder side of the NewHope key exchange. The shared secret and "public key" (key + reconciliation data) are generated using the given reader, which must return random data.

type PublicKeySimpleAlice Uses

type PublicKeySimpleAlice struct {
    Send [SendASimpleSize]byte
}

PublicKeySimpleAlice is Alice's NewHope-Simple public key.

type PublicKeySimpleBob Uses

type PublicKeySimpleBob struct {
    Send [SendBSimpleSize]byte
}

PublicKeySimpleBob is Bob's NewHope-Simple public key.

func KeyExchangeSimpleBob Uses

func KeyExchangeSimpleBob(rand io.Reader, alicePk *PublicKeySimpleAlice) (*PublicKeySimpleBob, []byte, error)

KeyExchangeSimpleBob is the Responder side of the NewHope-Simple key exchange. The shared secret and "public key" are generated using the given reader, which must return random data.

Package newhope imports 4 packages (graph) and is imported by 1 packages. Updated 2019-09-17. Refresh now. Tools for package owners.