diff --git a/host/Crypto/Makefile b/host/Crypto/Makefile index 843a2df9..d635777e 100644 --- a/host/Crypto/Makefile +++ b/host/Crypto/Makefile @@ -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 \ diff --git a/host/Crypto/noise/test-vector.cpp b/host/Crypto/noise/test-vector.cpp index ee49ff26..920dd4b3 100644 --- a/host/Crypto/noise/test-vector.cpp +++ b/host/Crypto/noise/test-vector.cpp @@ -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; } diff --git a/libraries/NoiseProtocol/src/NoiseDHState.cpp b/libraries/NoiseProtocol/src/NoiseDHState.cpp index a2466a25..7f43cd8f 100644 --- a/libraries/NoiseProtocol/src/NoiseDHState.cpp +++ b/libraries/NoiseProtocol/src/NoiseDHState.cpp @@ -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. diff --git a/libraries/NoiseProtocol/src/NoiseDHState.h b/libraries/NoiseProtocol/src/NoiseDHState.h index f139b4a5..e31feafe 100644 --- a/libraries/NoiseProtocol/src/NoiseDHState.h +++ b/libraries/NoiseProtocol/src/NoiseDHState.h @@ -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: diff --git a/libraries/NoiseProtocol/src/NoiseDHState_Curve25519.cpp b/libraries/NoiseProtocol/src/NoiseDHState_Curve25519.cpp index 65b4e44d..2f57a887 100644 --- a/libraries/NoiseProtocol/src/NoiseDHState_Curve25519.cpp +++ b/libraries/NoiseProtocol/src/NoiseDHState_Curve25519.cpp @@ -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(); diff --git a/libraries/NoiseProtocol/src/NoiseDHState_Curve25519.h b/libraries/NoiseProtocol/src/NoiseDHState_Curve25519.h index be0f0895..f8921cea 100644 --- a/libraries/NoiseProtocol/src/NoiseDHState_Curve25519.h +++ b/libraries/NoiseProtocol/src/NoiseDHState_Curve25519.h @@ -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: diff --git a/libraries/NoiseProtocol/src/NoiseHandshakeState.cpp b/libraries/NoiseProtocol/src/NoiseHandshakeState.cpp index 4daad8d5..e0c05ec2 100644 --- a/libraries/NoiseProtocol/src/NoiseHandshakeState.cpp +++ b/libraries/NoiseProtocol/src/NoiseHandshakeState.cpp @@ -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. diff --git a/libraries/NoiseProtocol/src/NoiseHandshakeState.h b/libraries/NoiseProtocol/src/NoiseHandshakeState.h index a6bd809c..86af8b18 100644 --- a/libraries/NoiseProtocol/src/NoiseHandshakeState.h +++ b/libraries/NoiseProtocol/src/NoiseHandshakeState.h @@ -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; } diff --git a/libraries/NoiseProtocol/src/NoiseProtocol.h b/libraries/NoiseProtocol/src/NoiseProtocol.h index 7d3fd794..8edb78d2 100644 --- a/libraries/NoiseProtocol/src/NoiseProtocol.h +++ b/libraries/NoiseProtocol/src/NoiseProtocol.h @@ -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 diff --git a/libraries/NoiseProtocol/src/NoiseProtocolDescriptor.cpp b/libraries/NoiseProtocol/src/NoiseProtocolDescriptor.cpp index 83bf5b55..377270aa 100644 --- a/libraries/NoiseProtocol/src/NoiseProtocolDescriptor.cpp +++ b/libraries/NoiseProtocol/src/NoiseProtocolDescriptor.cpp @@ -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; -} diff --git a/libraries/NoiseProtocol/src/NoiseProtocolDescriptor.h b/libraries/NoiseProtocol/src/NoiseProtocolDescriptor.h index 32788fb7..257b68f5 100644 --- a/libraries/NoiseProtocol/src/NoiseProtocolDescriptor.h +++ b/libraries/NoiseProtocol/src/NoiseProtocolDescriptor.h @@ -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) {} diff --git a/libraries/NoiseProtocol/src/Noise_IK.cpp b/libraries/NoiseProtocol/src/Noise_IK.cpp index b400e149..107e25da 100644 --- a/libraries/NoiseProtocol/src/Noise_IK.cpp +++ b/libraries/NoiseProtocol/src/Noise_IK.cpp @@ -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 diff --git a/libraries/NoiseProtocol/src/Noise_Pipes_25519_AESGCM_SHA256.cpp b/libraries/NoiseProtocol/src/Noise_Pipes_25519_AESGCM_SHA256.cpp deleted file mode 100644 index b4041344..00000000 --- a/libraries/NoiseProtocol/src/Noise_Pipes_25519_AESGCM_SHA256.cpp +++ /dev/null @@ -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 - * \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; -} diff --git a/libraries/NoiseProtocol/src/Noise_Pipes_25519_AESGCM_SHA256.h b/libraries/NoiseProtocol/src/Noise_Pipes_25519_AESGCM_SHA256.h deleted file mode 100644 index 1be38abd..00000000 --- a/libraries/NoiseProtocol/src/Noise_Pipes_25519_AESGCM_SHA256.h +++ /dev/null @@ -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 diff --git a/libraries/NoiseProtocol/src/Noise_Pipes_25519_ChaChaPoly_BLAKE2s.cpp b/libraries/NoiseProtocol/src/Noise_Pipes_25519_ChaChaPoly_BLAKE2s.cpp deleted file mode 100644 index 88aea122..00000000 --- a/libraries/NoiseProtocol/src/Noise_Pipes_25519_ChaChaPoly_BLAKE2s.cpp +++ /dev/null @@ -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 - * \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; -} diff --git a/libraries/NoiseProtocol/src/Noise_Pipes_25519_ChaChaPoly_BLAKE2s.h b/libraries/NoiseProtocol/src/Noise_Pipes_25519_ChaChaPoly_BLAKE2s.h deleted file mode 100644 index 5c0d8bef..00000000 --- a/libraries/NoiseProtocol/src/Noise_Pipes_25519_ChaChaPoly_BLAKE2s.h +++ /dev/null @@ -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 diff --git a/libraries/NoiseProtocol/src/Noise_Pipes_25519_ChaChaPoly_SHA256.cpp b/libraries/NoiseProtocol/src/Noise_Pipes_25519_ChaChaPoly_SHA256.cpp deleted file mode 100644 index 5a795acd..00000000 --- a/libraries/NoiseProtocol/src/Noise_Pipes_25519_ChaChaPoly_SHA256.cpp +++ /dev/null @@ -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 - * \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; -} diff --git a/libraries/NoiseProtocol/src/Noise_Pipes_25519_ChaChaPoly_SHA256.h b/libraries/NoiseProtocol/src/Noise_Pipes_25519_ChaChaPoly_SHA256.h deleted file mode 100644 index 69b62e1c..00000000 --- a/libraries/NoiseProtocol/src/Noise_Pipes_25519_ChaChaPoly_SHA256.h +++ /dev/null @@ -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 diff --git a/libraries/NoiseProtocol/src/Noise_XXfallback.cpp b/libraries/NoiseProtocol/src/Noise_XXfallback.cpp deleted file mode 100644 index c383c922..00000000 --- a/libraries/NoiseProtocol/src/Noise_XXfallback.cpp +++ /dev/null @@ -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 - * \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; - } -} diff --git a/libraries/NoiseProtocol/src/Noise_XXfallback.h b/libraries/NoiseProtocol/src/Noise_XXfallback.h deleted file mode 100644 index 9174a2d6..00000000 --- a/libraries/NoiseProtocol/src/Noise_XXfallback.h +++ /dev/null @@ -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 diff --git a/libraries/NoiseProtocol/src/Noise_XXfallback_25519_AESGCM_SHA256.cpp b/libraries/NoiseProtocol/src/Noise_XXfallback_25519_AESGCM_SHA256.cpp deleted file mode 100644 index 9e2ec779..00000000 --- a/libraries/NoiseProtocol/src/Noise_XXfallback_25519_AESGCM_SHA256.cpp +++ /dev/null @@ -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 - * \brief "XXfallback" Noise handshake, using Curve25519, AES256, GCM, and SHA256. - */ - -/** - * \class Noise_XXfallback_25519_AESGCM_SHA256 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(); -} diff --git a/libraries/NoiseProtocol/src/Noise_XXfallback_25519_AESGCM_SHA256.h b/libraries/NoiseProtocol/src/Noise_XXfallback_25519_AESGCM_SHA256.h deleted file mode 100644 index 01c58338..00000000 --- a/libraries/NoiseProtocol/src/Noise_XXfallback_25519_AESGCM_SHA256.h +++ /dev/null @@ -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 diff --git a/libraries/NoiseProtocol/src/Noise_XXfallback_25519_ChaChaPoly_BLAKE2s.cpp b/libraries/NoiseProtocol/src/Noise_XXfallback_25519_ChaChaPoly_BLAKE2s.cpp deleted file mode 100644 index 4569d638..00000000 --- a/libraries/NoiseProtocol/src/Noise_XXfallback_25519_ChaChaPoly_BLAKE2s.cpp +++ /dev/null @@ -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 - * \brief "XXfallback" Noise handshake, using Curve25519, ChaChaPoly, and BLAKE2s. - */ - -/** - * \class Noise_XXfallback_25519_ChaChaPoly_BLAKE2s 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(); -} diff --git a/libraries/NoiseProtocol/src/Noise_XXfallback_25519_ChaChaPoly_BLAKE2s.h b/libraries/NoiseProtocol/src/Noise_XXfallback_25519_ChaChaPoly_BLAKE2s.h deleted file mode 100644 index dec64eb1..00000000 --- a/libraries/NoiseProtocol/src/Noise_XXfallback_25519_ChaChaPoly_BLAKE2s.h +++ /dev/null @@ -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 diff --git a/libraries/NoiseProtocol/src/Noise_XXfallback_25519_ChaChaPoly_SHA256.cpp b/libraries/NoiseProtocol/src/Noise_XXfallback_25519_ChaChaPoly_SHA256.cpp deleted file mode 100644 index df959a91..00000000 --- a/libraries/NoiseProtocol/src/Noise_XXfallback_25519_ChaChaPoly_SHA256.cpp +++ /dev/null @@ -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 - * \brief "XXfallback" Noise handshake, using Curve25519, ChaChaPoly, and SHA256. - */ - -/** - * \class Noise_XXfallback_25519_ChaChaPoly_SHA256 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(); -} diff --git a/libraries/NoiseProtocol/src/Noise_XXfallback_25519_ChaChaPoly_SHA256.h b/libraries/NoiseProtocol/src/Noise_XXfallback_25519_ChaChaPoly_SHA256.h deleted file mode 100644 index 3d942bbf..00000000 --- a/libraries/NoiseProtocol/src/Noise_XXfallback_25519_ChaChaPoly_SHA256.h +++ /dev/null @@ -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