mirror of
https://github.com/taigrr/arduinolibs
synced 2025-01-18 04:33:12 -08:00
Remove XXfallback and Noise Pipes
Fallback protocols are not needed for NoiseTinyLink, so simplify.
This commit is contained in:
parent
8fd4a994dc
commit
e04733b8a5
@ -97,9 +97,6 @@ SOURCES += \
|
||||
Noise_NNpsk0_25519_ChaChaPoly_BLAKE2s.cpp \
|
||||
Noise_NNpsk0_25519_ChaChaPoly_SHA256.cpp \
|
||||
Noise_NNpsk0.cpp \
|
||||
Noise_Pipes_25519_AESGCM_SHA256.cpp \
|
||||
Noise_Pipes_25519_ChaChaPoly_BLAKE2s.cpp \
|
||||
Noise_Pipes_25519_ChaChaPoly_SHA256.cpp \
|
||||
NoiseProtocolDescriptor.cpp \
|
||||
NoiseSymmetricState_AESGCM_SHA256.cpp \
|
||||
NoiseSymmetricState_ChaChaPoly_BLAKE2s.cpp \
|
||||
@ -108,11 +105,7 @@ SOURCES += \
|
||||
Noise_XX_25519_AESGCM_SHA256.cpp \
|
||||
Noise_XX_25519_ChaChaPoly_BLAKE2s.cpp \
|
||||
Noise_XX_25519_ChaChaPoly_SHA256.cpp \
|
||||
Noise_XX.cpp \
|
||||
Noise_XXfallback_25519_AESGCM_SHA256.cpp \
|
||||
Noise_XXfallback_25519_ChaChaPoly_BLAKE2s.cpp \
|
||||
Noise_XXfallback_25519_ChaChaPoly_SHA256.cpp \
|
||||
Noise_XXfallback.cpp
|
||||
Noise_XX.cpp
|
||||
|
||||
SKETCHES = \
|
||||
TestAcorn/TestAcorn.ino \
|
||||
|
@ -215,13 +215,6 @@ static NoiseHandshakeState *create_handshake(const char *protocol)
|
||||
if (!strcmp(protocol, "Noise_XX_25519_ChaChaPoly_SHA256"))
|
||||
return new NoiseHandshakeState_XX_25519_ChaChaPoly_SHA256();
|
||||
|
||||
if (!strcmp(protocol, "Noise_XXfallback_25519_AESGCM_SHA256"))
|
||||
return new NoiseHandshakeState_XXfallback_25519_AESGCM_SHA256();
|
||||
if (!strcmp(protocol, "Noise_XXfallback_25519_ChaChaPoly_BLAKE2s"))
|
||||
return new NoiseHandshakeState_XXfallback_25519_ChaChaPoly_BLAKE2s();
|
||||
if (!strcmp(protocol, "Noise_XXfallback_25519_ChaChaPoly_SHA256"))
|
||||
return new NoiseHandshakeState_XXfallback_25519_ChaChaPoly_SHA256();
|
||||
|
||||
fail(protocol);
|
||||
return 0;
|
||||
}
|
||||
|
@ -208,23 +208,6 @@ NoiseDHState::~NoiseDHState()
|
||||
* \sa es(), se(), ss()
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn bool NoiseDHState::fallback(Noise::Party, const NoiseDHState *from)
|
||||
* \brief Copies parameters from another DH object to perform a fallback.
|
||||
*
|
||||
* \param party The party to the new fallback handshake, Noise::Initiator
|
||||
* or Noise::Responder.
|
||||
* \param from DH object for the previous failed handshake.
|
||||
*
|
||||
* \return Returns false if there are insufficient parameters in \a from
|
||||
* to perform a fallback or the DH algorithms do not match. Returns true
|
||||
* if fallback is possible.
|
||||
*
|
||||
* This function copies the initiator's ephemeral keys and the local
|
||||
* static key pair from a failed handshake into this DH object to
|
||||
* initialize the new handshake.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn void NoiseDHState::clear()
|
||||
* \brief Clears all sensitive data from this object.
|
||||
|
@ -55,8 +55,6 @@ public:
|
||||
virtual void se(uint8_t *sharedKey) = 0;
|
||||
virtual void ss(uint8_t *sharedKey) = 0;
|
||||
|
||||
virtual bool fallback(Noise::Party party, const NoiseDHState *from) = 0;
|
||||
|
||||
virtual void clear() = 0;
|
||||
|
||||
protected:
|
||||
|
@ -261,28 +261,6 @@ void NoiseDHState_Curve25519_EphemOnly::ss(uint8_t *sharedKey)
|
||||
memset(sharedKey, 0, 32);
|
||||
}
|
||||
|
||||
bool NoiseDHState_Curve25519_EphemOnly::fallback
|
||||
(Noise::Party party, const NoiseDHState *from)
|
||||
{
|
||||
// Copy the initiator's ephemeral key into this object.
|
||||
st.flags &= ~(HAVE_25519_LOCAL_EPHEM_PUBLIC |
|
||||
HAVE_25519_LOCAL_EPHEM_PRIVATE |
|
||||
HAVE_25519_REMOTE_EPHEM_PUBLIC);
|
||||
if (party == Noise::Initiator) {
|
||||
if (from->getParameter(Noise::LocalEphem25519PrivateKey, st.le, 32) != 32)
|
||||
return false;
|
||||
if (from->getParameter(Noise::LocalEphem25519PublicKey, st.lf, 32) != 32)
|
||||
return false;
|
||||
st.flags |= HAVE_25519_LOCAL_EPHEM_PUBLIC |
|
||||
HAVE_25519_LOCAL_EPHEM_PRIVATE;
|
||||
} else {
|
||||
if (from->getParameter(Noise::RemoteEphem25519PublicKey, st.re, 32) != 32)
|
||||
return false;
|
||||
st.flags |= HAVE_25519_REMOTE_EPHEM_PUBLIC;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void NoiseDHState_Curve25519_EphemOnly::clear()
|
||||
{
|
||||
clean(st);
|
||||
@ -481,27 +459,6 @@ void NoiseDHState_Curve25519::ss(uint8_t *sharedKey)
|
||||
Curve25519::eval(sharedKey, st2.ls, st2.rs);
|
||||
}
|
||||
|
||||
bool NoiseDHState_Curve25519::fallback
|
||||
(Noise::Party party, const NoiseDHState *from)
|
||||
{
|
||||
// Copy the initiator's ephemeral key into this object.
|
||||
if (!NoiseDHState_Curve25519_EphemOnly::fallback(party, from))
|
||||
return false;
|
||||
|
||||
// Copy the local static Curve25519 key into this object.
|
||||
// Don't do this if we already have a local static key because
|
||||
// we may be changing to a new key for the fallback handshake.
|
||||
if (!(st.flags & HAVE_25519_LOCAL_STATIC_PRIVATE)) {
|
||||
if (from->getParameter(Noise::LocalStatic25519PrivateKey, st2.ls, 32) != 32)
|
||||
return false;
|
||||
if (from->getParameter(Noise::LocalStatic25519PublicKey, st2.lp, 32) != 32)
|
||||
return false;
|
||||
st.flags |= HAVE_25519_LOCAL_STATIC_PUBLIC |
|
||||
HAVE_25519_LOCAL_STATIC_PRIVATE;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void NoiseDHState_Curve25519::clear()
|
||||
{
|
||||
NoiseDHState_Curve25519_EphemOnly::clear();
|
||||
|
@ -50,8 +50,6 @@ public:
|
||||
void se(uint8_t *sharedKey);
|
||||
void ss(uint8_t *sharedKey);
|
||||
|
||||
bool fallback(Noise::Party party, const NoiseDHState *from);
|
||||
|
||||
void clear();
|
||||
|
||||
private:
|
||||
@ -83,8 +81,6 @@ public:
|
||||
void se(uint8_t *sharedKey);
|
||||
void ss(uint8_t *sharedKey);
|
||||
|
||||
bool fallback(Noise::Party party, const NoiseDHState *from);
|
||||
|
||||
void clear();
|
||||
|
||||
private:
|
||||
|
@ -98,37 +98,6 @@ void NoiseHandshakeState::start
|
||||
symmetricState()->mixHash(prologue, prologueLen);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Starts a fallback handshake for the local party.
|
||||
*
|
||||
* \param fallbackFrom The previous failed handshake from which certain
|
||||
* parameters are copied to start the new handshake.
|
||||
* \param party Noise::Initiator or Noise::Responder.
|
||||
* to identity the local party.
|
||||
* \param prologue Points to the prologue string, or NULL if no prologue.
|
||||
* \param prologueLen Length of the prologue string, or 0 if no prologue.
|
||||
*
|
||||
* \return Returns true if the handshake started, false if there are
|
||||
* insufficient parameters in \a fallbackFrom to start the new handshake,
|
||||
* or false if the handshake coes not implement a fallback protocol.
|
||||
*
|
||||
* This function should be followed by calls to write() and read() to
|
||||
* process the packets in the handshake. Once the handshake has completed,
|
||||
* the application should call split() to obtain the cipher objects to use
|
||||
* to encrypt and decrypt transport messages.
|
||||
*
|
||||
* \note The application must call this function instead of start() for
|
||||
* fallback handshakes. Calling start() directly from the application
|
||||
* will not start the handshake correctly.
|
||||
*/
|
||||
bool NoiseHandshakeState::startFallback
|
||||
(const NoiseHandshakeState *fallbackFrom, Noise::Party party,
|
||||
const void *prologue, size_t prologueLen)
|
||||
{
|
||||
// Default implementation does not support fallback.
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* \fn Noise::Party NoiseHandshakeState::party() const
|
||||
* \brief Gets the identity of this party to the handshake.
|
||||
|
@ -35,9 +35,6 @@ public:
|
||||
|
||||
virtual void start
|
||||
(Noise::Party party, const void *prologue = 0, size_t prologueLen = 0);
|
||||
virtual bool startFallback
|
||||
(const NoiseHandshakeState *fallbackFrom, Noise::Party party,
|
||||
const void *prologue = 0, size_t prologueLen = 0);
|
||||
|
||||
Noise::Party party() const { return pty; }
|
||||
Noise::HandshakeState state() const { return st; }
|
||||
|
@ -33,16 +33,8 @@
|
||||
#include "Noise_NNpsk0_25519_ChaChaPoly_BLAKE2s.h"
|
||||
#include "Noise_NNpsk0_25519_ChaChaPoly_SHA256.h"
|
||||
|
||||
#include "Noise_Pipes_25519_AESGCM_SHA256.h"
|
||||
#include "Noise_Pipes_25519_ChaChaPoly_BLAKE2s.h"
|
||||
#include "Noise_Pipes_25519_ChaChaPoly_SHA256.h"
|
||||
|
||||
#include "Noise_XX_25519_AESGCM_SHA256.h"
|
||||
#include "Noise_XX_25519_ChaChaPoly_BLAKE2s.h"
|
||||
#include "Noise_XX_25519_ChaChaPoly_SHA256.h"
|
||||
|
||||
#include "Noise_XXfallback_25519_AESGCM_SHA256.h"
|
||||
#include "Noise_XXfallback_25519_ChaChaPoly_BLAKE2s.h"
|
||||
#include "Noise_XXfallback_25519_ChaChaPoly_SHA256.h"
|
||||
|
||||
#endif
|
||||
|
@ -75,39 +75,3 @@ NoiseProtocolDescriptor::~NoiseProtocolDescriptor()
|
||||
*
|
||||
* \return A new handshake object for the protocol.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Returns the descriptor for the abbreviated protocol, if any.
|
||||
*
|
||||
* \return Returns a pointer to the abbreviated protocol descriptor, or NULL
|
||||
* if this protocol does not have an abbreviated version.
|
||||
*
|
||||
* This function and fallbackDescriptor() to intended to help implement
|
||||
* fallback-using protocols like Noise Pipes. In the case of Noise Pipes,
|
||||
* the full protocol would be XX, the abbreviated protocol would be IK,
|
||||
* and the fallback protocol would XXfallback.
|
||||
*
|
||||
* The abbreviated protocol should be selected if a remote static public
|
||||
* key is available when the handshake starts. Otherwise the full protocol
|
||||
* should be used to discover the remote static public key dynamically.
|
||||
*
|
||||
* \sa fallbackDescriptor()
|
||||
*/
|
||||
const NoiseProtocolDescriptor *NoiseProtocolDescriptor::abbreviatedDescriptor() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Returns the descriptor for the fallback protocol, if any.
|
||||
*
|
||||
* \return Returns a pointer to the fallback protocol descriptor, or NULL
|
||||
* if it is not possible to fall back from the abbreviated protocol to
|
||||
* another protocol. The default implementation returns NULL.
|
||||
*
|
||||
* \sa abbreviatedDescriptor()
|
||||
*/
|
||||
const NoiseProtocolDescriptor *NoiseProtocolDescriptor::fallbackDescriptor() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ public:
|
||||
|
||||
virtual NoiseHandshakeState *createHandshake() const = 0;
|
||||
|
||||
virtual const NoiseProtocolDescriptor *abbreviatedDescriptor() const;
|
||||
virtual const NoiseProtocolDescriptor *fallbackDescriptor() const;
|
||||
|
||||
protected:
|
||||
explicit NoiseProtocolDescriptor(const char *name, const char *alias = 0)
|
||||
: protoName(name), protoAlias(alias) {}
|
||||
|
@ -29,9 +29,11 @@
|
||||
* The "IK" pattern provides mutual authentication of the two communicating
|
||||
* parties, with the identifying key for the initiating party sent during
|
||||
* the handshake. The identifying key for the responding party is assumed
|
||||
* to already be known to the initiator. If the responding party's key
|
||||
* changes, then the application will need to transition to "XXfallback"
|
||||
* to discover the new key.
|
||||
* to already be known to the initiator before the handshake starts.
|
||||
*
|
||||
* If the responding party's key changes, then the initiator will need to
|
||||
* retry with another protocol like "XX" to discover the new key. At present,
|
||||
* we do not support "XXfallback" / Noise Pipes.
|
||||
*
|
||||
* This class provides the core "IK" functionality. Subclasses provide
|
||||
* implementations of "IK" that use specific algorithms, such as
|
||||
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Southern Storm Software, Pty Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "Noise_Pipes_25519_AESGCM_SHA256.h"
|
||||
|
||||
/**
|
||||
* \class Noise_Pipes_25519_AESGCM_SHA256 Noise_Pipes_25519_AESGCM_SHA256.h <Noise_Pipes_25519_AESGCM_SHA256.h>
|
||||
* \brief Noise Pipes descriptor, using Curve25519, AES256, GCM, and SHA256.
|
||||
*
|
||||
* Noise Pipes combines the effect of XX, IK, and XXfallback to produce a
|
||||
* protocol that requires only two handshake messages if the responder's
|
||||
* static public key is known, or three handshake messages if the key
|
||||
* is unknown or incorrect.
|
||||
*/
|
||||
|
||||
Noise_Pipes_25519_AESGCM_SHA256::Noise_Pipes_25519_AESGCM_SHA256()
|
||||
{
|
||||
}
|
||||
|
||||
Noise_Pipes_25519_AESGCM_SHA256::~Noise_Pipes_25519_AESGCM_SHA256()
|
||||
{
|
||||
}
|
||||
|
||||
const NoiseProtocolDescriptor *Noise_Pipes_25519_AESGCM_SHA256::abbreviatedDescriptor() const
|
||||
{
|
||||
return &ik;
|
||||
}
|
||||
|
||||
const NoiseProtocolDescriptor *Noise_Pipes_25519_AESGCM_SHA256::fallbackDescriptor() const
|
||||
{
|
||||
return &fallback;
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Southern Storm Software, Pty Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef NOISE_PIPES_25519_AESGCM_SHA256_h
|
||||
#define NOISE_PIPES_25519_AESGCM_SHA256_h
|
||||
|
||||
#include "Noise_XX_25519_AESGCM_SHA256.h"
|
||||
#include "Noise_IK_25519_AESGCM_SHA256.h"
|
||||
#include "Noise_XXfallback_25519_AESGCM_SHA256.h"
|
||||
|
||||
class Noise_Pipes_25519_AESGCM_SHA256 :
|
||||
public Noise_XX_25519_AESGCM_SHA256
|
||||
{
|
||||
public:
|
||||
Noise_Pipes_25519_AESGCM_SHA256();
|
||||
virtual ~Noise_Pipes_25519_AESGCM_SHA256();
|
||||
|
||||
const NoiseProtocolDescriptor *abbreviatedDescriptor() const;
|
||||
const NoiseProtocolDescriptor *fallbackDescriptor() const;
|
||||
|
||||
private:
|
||||
Noise_IK_25519_AESGCM_SHA256 ik;
|
||||
Noise_XXfallback_25519_AESGCM_SHA256 fallback;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Southern Storm Software, Pty Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "Noise_Pipes_25519_ChaChaPoly_BLAKE2s.h"
|
||||
|
||||
/**
|
||||
* \class Noise_Pipes_25519_ChaChaPoly_BLAKE2s Noise_Pipes_25519_ChaChaPoly_BLAKE2s.h <Noise_Pipes_25519_ChaChaPoly_BLAKE2s.h>
|
||||
* \brief Noise Pipes descriptor, using Curve25519, ChaChaPoly, and BLAKE2s.
|
||||
*
|
||||
* Noise Pipes combines the effect of XX, IK, and XXfallback to produce a
|
||||
* protocol that requires only two handshake messages if the responder's
|
||||
* static public key is known, or three handshake messages if the key
|
||||
* is unknown or incorrect.
|
||||
*/
|
||||
|
||||
Noise_Pipes_25519_ChaChaPoly_BLAKE2s::Noise_Pipes_25519_ChaChaPoly_BLAKE2s()
|
||||
{
|
||||
}
|
||||
|
||||
Noise_Pipes_25519_ChaChaPoly_BLAKE2s::~Noise_Pipes_25519_ChaChaPoly_BLAKE2s()
|
||||
{
|
||||
}
|
||||
|
||||
const NoiseProtocolDescriptor *Noise_Pipes_25519_ChaChaPoly_BLAKE2s::abbreviatedDescriptor() const
|
||||
{
|
||||
return &ik;
|
||||
}
|
||||
|
||||
const NoiseProtocolDescriptor *Noise_Pipes_25519_ChaChaPoly_BLAKE2s::fallbackDescriptor() const
|
||||
{
|
||||
return &fallback;
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Southern Storm Software, Pty Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef NOISE_PIPES_25519_CHACHAPOLY_BLAKE2S_h
|
||||
#define NOISE_PIPES_25519_CHACHAPOLY_BLAKE2S_h
|
||||
|
||||
#include "Noise_XX_25519_ChaChaPoly_BLAKE2s.h"
|
||||
#include "Noise_IK_25519_ChaChaPoly_BLAKE2s.h"
|
||||
#include "Noise_XXfallback_25519_ChaChaPoly_BLAKE2s.h"
|
||||
|
||||
class Noise_Pipes_25519_ChaChaPoly_BLAKE2s :
|
||||
public Noise_XX_25519_ChaChaPoly_BLAKE2s
|
||||
{
|
||||
public:
|
||||
Noise_Pipes_25519_ChaChaPoly_BLAKE2s();
|
||||
virtual ~Noise_Pipes_25519_ChaChaPoly_BLAKE2s();
|
||||
|
||||
const NoiseProtocolDescriptor *abbreviatedDescriptor() const;
|
||||
const NoiseProtocolDescriptor *fallbackDescriptor() const;
|
||||
|
||||
private:
|
||||
Noise_IK_25519_ChaChaPoly_BLAKE2s ik;
|
||||
Noise_XXfallback_25519_ChaChaPoly_BLAKE2s fallback;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Southern Storm Software, Pty Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "Noise_Pipes_25519_ChaChaPoly_SHA256.h"
|
||||
|
||||
/**
|
||||
* \class Noise_Pipes_25519_ChaChaPoly_SHA256 Noise_Pipes_25519_ChaChaPoly_SHA256.h <Noise_Pipes_25519_ChaChaPoly_SHA256.h>
|
||||
* \brief Noise Pipes descriptor, using Curve25519, ChaChaPoly, and SHA256.
|
||||
*
|
||||
* Noise Pipes combines the effect of XX, IK, and XXfallback to produce a
|
||||
* protocol that requires only two handshake messages if the responder's
|
||||
* static public key is known, or three handshake messages if the key
|
||||
* is unknown or incorrect.
|
||||
*/
|
||||
|
||||
Noise_Pipes_25519_ChaChaPoly_SHA256::Noise_Pipes_25519_ChaChaPoly_SHA256()
|
||||
{
|
||||
}
|
||||
|
||||
Noise_Pipes_25519_ChaChaPoly_SHA256::~Noise_Pipes_25519_ChaChaPoly_SHA256()
|
||||
{
|
||||
}
|
||||
|
||||
const NoiseProtocolDescriptor *Noise_Pipes_25519_ChaChaPoly_SHA256::abbreviatedDescriptor() const
|
||||
{
|
||||
return &ik;
|
||||
}
|
||||
|
||||
const NoiseProtocolDescriptor *Noise_Pipes_25519_ChaChaPoly_SHA256::fallbackDescriptor() const
|
||||
{
|
||||
return &fallback;
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Southern Storm Software, Pty Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef NOISE_PIPES_25519_CHACHAPOLY_SHA256_h
|
||||
#define NOISE_PIPES_25519_CHACHAPOLY_SHA256_h
|
||||
|
||||
#include "Noise_XX_25519_ChaChaPoly_SHA256.h"
|
||||
#include "Noise_IK_25519_ChaChaPoly_SHA256.h"
|
||||
#include "Noise_XXfallback_25519_ChaChaPoly_SHA256.h"
|
||||
|
||||
class Noise_Pipes_25519_ChaChaPoly_SHA256 :
|
||||
public Noise_XX_25519_ChaChaPoly_SHA256
|
||||
{
|
||||
public:
|
||||
Noise_Pipes_25519_ChaChaPoly_SHA256();
|
||||
virtual ~Noise_Pipes_25519_ChaChaPoly_SHA256();
|
||||
|
||||
const NoiseProtocolDescriptor *abbreviatedDescriptor() const;
|
||||
const NoiseProtocolDescriptor *fallbackDescriptor() const;
|
||||
|
||||
private:
|
||||
Noise_IK_25519_ChaChaPoly_SHA256 ik;
|
||||
Noise_XXfallback_25519_ChaChaPoly_SHA256 fallback;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,116 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Southern Storm Software, Pty Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "Noise_XXfallback.h"
|
||||
|
||||
/**
|
||||
* \class NoiseHandshakeState_XXfallback Noise_XXfallback.h <Noise_XXfallback.h>
|
||||
* \brief Handshake implementation of the Noise "XXfallback" pattern.
|
||||
*
|
||||
* The "XXfallback" pattern provides mutual authentication of the two
|
||||
* communicating parties after a previous "IK" handshake has failed.
|
||||
* The application should use startFallback() instead of start() to
|
||||
* start the new handshake.
|
||||
*
|
||||
* This class provides the core "XXfallback" functionality. Subclasses provide
|
||||
* implementations of "XXfallback" that use specific algorithms, such as
|
||||
* Noise_XXfallback_25519_ChaChaPoly_BLAKE2s.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn NoiseHandshakeState_XXfallback::NoiseHandshakeState_XXfallback()
|
||||
* \brief Constructs a new Noise handshake that uses the XXfallback pattern.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Destroys this Noise handshake.
|
||||
*/
|
||||
NoiseHandshakeState_XXfallback::~NoiseHandshakeState_XXfallback()
|
||||
{
|
||||
}
|
||||
|
||||
bool NoiseHandshakeState_XXfallback::startFallback
|
||||
(const NoiseHandshakeState *fallbackFrom, Noise::Party party,
|
||||
const void *prologue, size_t prologueLen)
|
||||
{
|
||||
// Cannot fallback if no previous handshake, or fall back from ourselves.
|
||||
if (!fallbackFrom || fallbackFrom == this) {
|
||||
setState(Noise::Failed);
|
||||
return false;
|
||||
}
|
||||
NoiseDHState *thisDH = dhState();
|
||||
|
||||
// Copy keys from the previous handshake into this one.
|
||||
const NoiseDHState *otherDH = otherDHState(fallbackFrom);
|
||||
if (!thisDH || !otherDH || !thisDH->fallback(party, otherDH)) {
|
||||
setState(Noise::Failed);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Start the new handshake.
|
||||
start(party, prologue, prologueLen);
|
||||
|
||||
// The responder writes first in a XXfallback handshake.
|
||||
setState(party == Noise::Initiator ? Noise::Read : Noise::Write);
|
||||
return true;
|
||||
}
|
||||
|
||||
void NoiseHandshakeState_XXfallback::removeKeys()
|
||||
{
|
||||
// Remove the remote static public key only. We need to keep the
|
||||
// ephemeral keys to perform the fallback correctly.
|
||||
removeParameter(Noise::RemoteStaticPublicKey);
|
||||
}
|
||||
|
||||
void NoiseHandshakeState_XXfallback::writeTokens
|
||||
(NoiseHandshakeState::Packet &packet, uint8_t msgnum)
|
||||
{
|
||||
if (msgnum == 0) {
|
||||
premessage(packet, Noise::LocalEphemPublicKey,
|
||||
Noise::RemoteEphemPublicKey);
|
||||
write_e(packet);
|
||||
write_ee(packet);
|
||||
write_s(packet);
|
||||
write_es(packet);
|
||||
} else if (msgnum == 1) {
|
||||
write_s(packet);
|
||||
write_se(packet);
|
||||
packet.done = true;
|
||||
}
|
||||
}
|
||||
|
||||
void NoiseHandshakeState_XXfallback::readTokens
|
||||
(NoiseHandshakeState::Packet &packet, uint8_t msgnum)
|
||||
{
|
||||
if (msgnum == 0) {
|
||||
premessage(packet, Noise::LocalEphemPublicKey,
|
||||
Noise::RemoteEphemPublicKey);
|
||||
read_e(packet);
|
||||
read_ee(packet);
|
||||
read_s(packet);
|
||||
read_es(packet);
|
||||
} else if (msgnum == 1) {
|
||||
read_s(packet);
|
||||
read_se(packet);
|
||||
packet.done = true;
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Southern Storm Software, Pty Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef NOISE_XX_FALLBACK_h
|
||||
#define NOISE_XX_FALLBACK_h
|
||||
|
||||
#include "NoiseHandshakeState.h"
|
||||
|
||||
class NoiseHandshakeState_XXfallback : public NoiseHandshakeState
|
||||
{
|
||||
public:
|
||||
virtual ~NoiseHandshakeState_XXfallback();
|
||||
|
||||
bool startFallback
|
||||
(const NoiseHandshakeState *fallbackFrom, Noise::Party party,
|
||||
const void *prologue, size_t prologueLen);
|
||||
|
||||
protected:
|
||||
NoiseHandshakeState_XXfallback() {}
|
||||
|
||||
void removeKeys();
|
||||
void writeTokens(NoiseHandshakeState::Packet &packet, uint8_t msgnum);
|
||||
void readTokens(NoiseHandshakeState::Packet &packet, uint8_t msgnum);
|
||||
};
|
||||
|
||||
#endif
|
@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Southern Storm Software, Pty Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "Noise_XXfallback_25519_AESGCM_SHA256.h"
|
||||
|
||||
/**
|
||||
* \class NoiseHandshakeState_XXfallback_25519_AESGCM_SHA256 Noise_XXfallback_25519_AESGCM_SHA256.h <Noise_XXfallback_25519_AESGCM_SHA256.h>
|
||||
* \brief "XXfallback" Noise handshake, using Curve25519, AES256, GCM, and SHA256.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \class Noise_XXfallback_25519_AESGCM_SHA256 Noise_XXfallback_25519_AESGCM_SHA256.h <Noise_XXfallback_25519_AESGCM_SHA256.h>
|
||||
* \brief "XXfallback" Noise descriptor, using Curve25519, AES256, GCM, and SHA256.
|
||||
*/
|
||||
|
||||
static char const Noise_XXfallback_25519_AESGCM_SHA256_Name[] =
|
||||
"Noise_XXfallback_25519_AESGCM_SHA256";
|
||||
|
||||
NoiseHandshakeState_XXfallback_25519_AESGCM_SHA256::NoiseHandshakeState_XXfallback_25519_AESGCM_SHA256()
|
||||
{
|
||||
setSymmetricState(&sym);
|
||||
setDHState(&dh);
|
||||
setProtocolName(Noise_XXfallback_25519_AESGCM_SHA256_Name);
|
||||
}
|
||||
|
||||
NoiseHandshakeState_XXfallback_25519_AESGCM_SHA256::~NoiseHandshakeState_XXfallback_25519_AESGCM_SHA256()
|
||||
{
|
||||
}
|
||||
|
||||
Noise_XXfallback_25519_AESGCM_SHA256::Noise_XXfallback_25519_AESGCM_SHA256()
|
||||
: NoiseProtocolDescriptor(Noise_XXfallback_25519_AESGCM_SHA256_Name)
|
||||
{
|
||||
}
|
||||
|
||||
Noise_XXfallback_25519_AESGCM_SHA256::~Noise_XXfallback_25519_AESGCM_SHA256()
|
||||
{
|
||||
}
|
||||
|
||||
NoiseHandshakeState *Noise_XXfallback_25519_AESGCM_SHA256::createHandshake() const
|
||||
{
|
||||
return new NoiseHandshakeState_XXfallback_25519_AESGCM_SHA256();
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Southern Storm Software, Pty Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef NOISE_XX_FALLBACK_25519_AESGCM_SHA256_h
|
||||
#define NOISE_XX_FALLBACK_25519_AESGCM_SHA256_h
|
||||
|
||||
#include "Noise_XXfallback.h"
|
||||
#include "NoiseProtocolDescriptor.h"
|
||||
#include "NoiseSymmetricState_AESGCM_SHA256.h"
|
||||
#include "NoiseDHState_Curve25519.h"
|
||||
|
||||
class NoiseHandshakeState_XXfallback_25519_AESGCM_SHA256 : public NoiseHandshakeState_XXfallback
|
||||
{
|
||||
public:
|
||||
NoiseHandshakeState_XXfallback_25519_AESGCM_SHA256();
|
||||
virtual ~NoiseHandshakeState_XXfallback_25519_AESGCM_SHA256();
|
||||
|
||||
private:
|
||||
NoiseSymmetricState_AESGCM_SHA256 sym;
|
||||
NoiseDHState_Curve25519 dh;
|
||||
};
|
||||
|
||||
class Noise_XXfallback_25519_AESGCM_SHA256 : public NoiseProtocolDescriptor
|
||||
{
|
||||
public:
|
||||
Noise_XXfallback_25519_AESGCM_SHA256();
|
||||
virtual ~Noise_XXfallback_25519_AESGCM_SHA256();
|
||||
|
||||
NoiseHandshakeState *createHandshake() const;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Southern Storm Software, Pty Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "Noise_XXfallback_25519_ChaChaPoly_BLAKE2s.h"
|
||||
|
||||
/**
|
||||
* \class NoiseHandshakeState_XXfallback_25519_ChaChaPoly_BLAKE2s Noise_XXfallback_25519_ChaChaPoly_BLAKE2s.h <Noise_XXfallback_25519_ChaChaPoly_BLAKE2s.h>
|
||||
* \brief "XXfallback" Noise handshake, using Curve25519, ChaChaPoly, and BLAKE2s.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \class Noise_XXfallback_25519_ChaChaPoly_BLAKE2s Noise_XXfallback_25519_ChaChaPoly_BLAKE2s.h <Noise_XXfallback_25519_ChaChaPoly_BLAKE2s.h>
|
||||
* \brief "XXfallback" Noise descriptor, using Curve25519, ChaChaPoly, and BLAKE2s.
|
||||
*/
|
||||
|
||||
static char const Noise_XXfallback_25519_ChaChaPoly_BLAKE2s_Name[] =
|
||||
"Noise_XXfallback_25519_ChaChaPoly_BLAKE2s";
|
||||
|
||||
NoiseHandshakeState_XXfallback_25519_ChaChaPoly_BLAKE2s::NoiseHandshakeState_XXfallback_25519_ChaChaPoly_BLAKE2s()
|
||||
{
|
||||
setSymmetricState(&sym);
|
||||
setDHState(&dh);
|
||||
setProtocolName(Noise_XXfallback_25519_ChaChaPoly_BLAKE2s_Name);
|
||||
}
|
||||
|
||||
NoiseHandshakeState_XXfallback_25519_ChaChaPoly_BLAKE2s::~NoiseHandshakeState_XXfallback_25519_ChaChaPoly_BLAKE2s()
|
||||
{
|
||||
}
|
||||
|
||||
Noise_XXfallback_25519_ChaChaPoly_BLAKE2s::Noise_XXfallback_25519_ChaChaPoly_BLAKE2s()
|
||||
: NoiseProtocolDescriptor(Noise_XXfallback_25519_ChaChaPoly_BLAKE2s_Name)
|
||||
{
|
||||
}
|
||||
|
||||
Noise_XXfallback_25519_ChaChaPoly_BLAKE2s::~Noise_XXfallback_25519_ChaChaPoly_BLAKE2s()
|
||||
{
|
||||
}
|
||||
|
||||
NoiseHandshakeState *Noise_XXfallback_25519_ChaChaPoly_BLAKE2s::createHandshake() const
|
||||
{
|
||||
return new NoiseHandshakeState_XXfallback_25519_ChaChaPoly_BLAKE2s();
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Southern Storm Software, Pty Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef NOISE_XX_FALLBACK_25519_CHACHAPOLY_BLAKE2S_h
|
||||
#define NOISE_XX_FALLBACK_25519_CHACHAPOLY_BLAKE2S_h
|
||||
|
||||
#include "Noise_XXfallback.h"
|
||||
#include "NoiseProtocolDescriptor.h"
|
||||
#include "NoiseSymmetricState_ChaChaPoly_BLAKE2s.h"
|
||||
#include "NoiseDHState_Curve25519.h"
|
||||
|
||||
class NoiseHandshakeState_XXfallback_25519_ChaChaPoly_BLAKE2s
|
||||
: public NoiseHandshakeState_XXfallback
|
||||
{
|
||||
public:
|
||||
NoiseHandshakeState_XXfallback_25519_ChaChaPoly_BLAKE2s();
|
||||
virtual ~NoiseHandshakeState_XXfallback_25519_ChaChaPoly_BLAKE2s();
|
||||
|
||||
private:
|
||||
NoiseSymmetricState_ChaChaPoly_BLAKE2s sym;
|
||||
NoiseDHState_Curve25519 dh;
|
||||
};
|
||||
|
||||
class Noise_XXfallback_25519_ChaChaPoly_BLAKE2s : public NoiseProtocolDescriptor
|
||||
{
|
||||
public:
|
||||
Noise_XXfallback_25519_ChaChaPoly_BLAKE2s();
|
||||
virtual ~Noise_XXfallback_25519_ChaChaPoly_BLAKE2s();
|
||||
|
||||
NoiseHandshakeState *createHandshake() const;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Southern Storm Software, Pty Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "Noise_XXfallback_25519_ChaChaPoly_SHA256.h"
|
||||
|
||||
/**
|
||||
* \class NoiseHandshakeState_XXfallback_25519_ChaChaPoly_SHA256 Noise_XXfallback_25519_ChaChaPoly_SHA256.h <Noise_XXfallback_25519_ChaChaPoly_SHA256.h>
|
||||
* \brief "XXfallback" Noise handshake, using Curve25519, ChaChaPoly, and SHA256.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \class Noise_XXfallback_25519_ChaChaPoly_SHA256 Noise_XXfallback_25519_ChaChaPoly_SHA256.h <Noise_XXfallback_25519_ChaChaPoly_SHA256.h>
|
||||
* \brief "XXfallback" Noise descriptor, using Curve25519, ChaChaPoly, and SHA256.
|
||||
*/
|
||||
|
||||
static char const Noise_XXfallback_25519_ChaChaPoly_SHA256_Name[] =
|
||||
"Noise_XXfallback_25519_ChaChaPoly_SHA256";
|
||||
|
||||
NoiseHandshakeState_XXfallback_25519_ChaChaPoly_SHA256::NoiseHandshakeState_XXfallback_25519_ChaChaPoly_SHA256()
|
||||
{
|
||||
setSymmetricState(&sym);
|
||||
setDHState(&dh);
|
||||
setProtocolName(Noise_XXfallback_25519_ChaChaPoly_SHA256_Name);
|
||||
}
|
||||
|
||||
NoiseHandshakeState_XXfallback_25519_ChaChaPoly_SHA256::~NoiseHandshakeState_XXfallback_25519_ChaChaPoly_SHA256()
|
||||
{
|
||||
}
|
||||
|
||||
Noise_XXfallback_25519_ChaChaPoly_SHA256::Noise_XXfallback_25519_ChaChaPoly_SHA256()
|
||||
: NoiseProtocolDescriptor(Noise_XXfallback_25519_ChaChaPoly_SHA256_Name)
|
||||
{
|
||||
}
|
||||
|
||||
Noise_XXfallback_25519_ChaChaPoly_SHA256::~Noise_XXfallback_25519_ChaChaPoly_SHA256()
|
||||
{
|
||||
}
|
||||
|
||||
NoiseHandshakeState *Noise_XXfallback_25519_ChaChaPoly_SHA256::createHandshake() const
|
||||
{
|
||||
return new NoiseHandshakeState_XXfallback_25519_ChaChaPoly_SHA256();
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Southern Storm Software, Pty Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef NOISE_XX_FALLBACK_25519_CHACHAPOLY_SHA256_h
|
||||
#define NOISE_XX_FALLBACK_25519_CHACHAPOLY_SHA256_h
|
||||
|
||||
#include "Noise_XXfallback.h"
|
||||
#include "NoiseProtocolDescriptor.h"
|
||||
#include "NoiseSymmetricState_ChaChaPoly_SHA256.h"
|
||||
#include "NoiseDHState_Curve25519.h"
|
||||
|
||||
class NoiseHandshakeState_XXfallback_25519_ChaChaPoly_SHA256
|
||||
: public NoiseHandshakeState_XXfallback
|
||||
{
|
||||
public:
|
||||
NoiseHandshakeState_XXfallback_25519_ChaChaPoly_SHA256();
|
||||
virtual ~NoiseHandshakeState_XXfallback_25519_ChaChaPoly_SHA256();
|
||||
|
||||
private:
|
||||
NoiseSymmetricState_ChaChaPoly_SHA256 sym;
|
||||
NoiseDHState_Curve25519 dh;
|
||||
};
|
||||
|
||||
class Noise_XXfallback_25519_ChaChaPoly_SHA256 : public NoiseProtocolDescriptor
|
||||
{
|
||||
public:
|
||||
Noise_XXfallback_25519_ChaChaPoly_SHA256();
|
||||
virtual ~Noise_XXfallback_25519_ChaChaPoly_SHA256();
|
||||
|
||||
NoiseHandshakeState *createHandshake() const;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user