1. 21 Aug, 2019 1 commit
    • Adrien Béraud's avatar
      tls_session: notify observer of TLS state change · 1f835edc
      Adrien Béraud authored
      When setting the state directly, state change callbacks are not called.
      
      State is now always set by the TLS handler thread, which will call state
      callbacks.
      
      Change-Id: Iffd03a2b20a3bf0527aa404914728ed1d889288b
      1f835edc
  2. 04 Aug, 2019 1 commit
  3. 08 Apr, 2019 1 commit
    • Sébastien Blin's avatar
      tls_session: close transport after cleanup · ca342f2b
      Sébastien Blin authored
      The TlsSession object works as a state machine. Currently, when
      shutdown() is called, the state is changed and the transport is
      directly closed. This mean that the cleanup launched by the state
      machine can be called after the transport is closed.
      
      Change-Id: I2565259156073862d4eee1fc47003a8022de2126
      ca342f2b
  4. 02 Apr, 2019 1 commit
    • Adrien Béraud's avatar
      sources: rename to jami · 2130f067
      Adrien Béraud authored
      * rename namespace from ring to jami
      * rename logs methods from RING_* to JAMI_*
      * rename RING_VIDEO to ENABLE_VIDEO
      
      Change-Id: Ic98498652d7059fafe58a96220d565bcdfa53658
      2130f067
  5. 02 Jan, 2019 1 commit
  6. 31 Dec, 2018 1 commit
  7. 30 Jan, 2018 1 commit
  8. 23 Jan, 2018 1 commit
  9. 10 Jan, 2018 1 commit
  10. 03 Jan, 2018 1 commit
    • Guillaume Roguez's avatar
      make TlsSession great again · bdafdfb4
      Guillaume Roguez authored
      Or at least independant of underlaying transport...
      
      To make TlsSession able to handle both TLS and DTLS
      this patch removes the ICE dependency and replace is
      by the generic network ABC class 'GenericTransport'.
      As a first step this class is declared in tls_session.h.
      Side effects of this change are:
      
      * refactoring of PMTUD procedure: 'MTU' for gnutls has the meaning
        on 'payload-for-gnutls' so this information is now drived by
        the generic transport and not hardcoded anymore.
        The minimal value of probing remains hardcoded, as is a minimum
        given by RFC's documentation and it's based on an IPv4 packet
        associated with UDP protocol.
      
      * getMtu() is now maxPayload() and represent correctly what
        the application must have.
      
      * TlsSession implements itself GenericTransport: we can chain
        GenericTransport instances to construct an overlayed transport
        protocol.
      
      * TlsSession is now considered as non thread-safe for its public API.
        Caller must bring itself this property.
        This permit to remove a redundant mutex in send() operation.
        Note: and it's the case in the only user (SipsIceTransport),
        that why the mutex is redundant in 100% of cases.
      
      Notice the benefit of this genericity refactoring let us
      write a unit-test for this TlsSession class without having
      an heavy ICE transport to mock-up.
      
      Also ICE transport gained of this by adding a new IceSocketTransport
      to replace IceSocket in a near future (need async IO in GenericSocket,
      but not required for the moment).
      
      Change-Id: I6f4591ed6c76fa9cb5519c6e9296f8fc3a6798aa
      Reviewed-by: default avatarOlivier Soldano <olivier.soldano@savoirfairelinux.com>
      bdafdfb4
  11. 21 Nov, 2017 2 commits
  12. 10 Jul, 2017 1 commit
    • Adrien Béraud's avatar
      mtu: remove MTU of 1500 bytes · 62aa7346
      Adrien Béraud authored
      Remove the highest, rare case of 1500 bytes MTU, and mitigate the case
      of fragmented packets dropped asymmetrically - IP_NOFRAG unavailable in
      PJNATH for the moment -
      while still allowing to use a lower MTU on links where the actual MTU is
      very low and no packet fragmentation is possible.
      In this case the ping packet would be dropped and the correct MTU would
      be discovered on both sides.
      
      Change-Id: I1870eb08ad8298aff134995388b4958490426351
      62aa7346
  13. 22 Jun, 2017 1 commit
    • Guillaume Roguez's avatar
      tls: prevent recursive call to flushRxQueue() · 8c9e75af
      Guillaume Roguez authored
      TlsSession::flushRxQueue() let TlsSession::handleDataPacket() to be called
      causing a recursive call to TlsSession::flushRxQueue(), finally resulting
      into application crash.
      
      Solve that by testing if we're in flush opeation and just no-op in such case.
      
      Change-Id: Ie4d52a9df495784e36e3691404f44cd8f66dbb6d
      8c9e75af
  14. 15 May, 2017 1 commit
    • Guillaume Roguez's avatar
      dtls: refactoring and fix of PMTUD/Established code · b44d24e8
      Guillaume Roguez authored
      There are various issues in the PMTUD code:
      - OOO handler wasn't applied to the first packet
        due to unseen code duplication in PMTU code.
      - first packet sequence has to be known in case of OOO on it
      - bug in losts detection.
      - decrease the lost threshold time.
      - temporary packet allocation is not efficient.
      - code duplication and functional flow not well designed.
      - comments needed
      
      This patch fixes all of that.
      
      Change-Id: I93ec71e22f6cb7a66ad9ab0f927d31044966f1e3
      Reviewed-by: default avatarAnthony Léonard <anthony.leonard@savoirfairelinux.com>
      b44d24e8
  15. 04 May, 2017 1 commit
  16. 28 Apr, 2017 1 commit
  17. 20 Mar, 2017 1 commit
    • Guillaume Roguez's avatar
      Fix DhParams copy-assignment and copy-constructor · a17755c6
      Guillaume Roguez authored
      DhParams copy-assignement was implemented as non-op operator.
      This is weird for a copy to do nothing!
      No intends are indicated to help.
      Seems only done to help MSVC compiler, but this is WRONG
      and cause a SECURITY FAILURE as the DhParam is not set
      as supposed to be.
      Consequence observed on UWP daemon: the anonymous connection
      cannot be done and the certificate is always send in cleartext.
      
      The fix consists in using the dedicated gnutls API
      to copy correctly the internal dh_params C structure.
      This is used to implement copy-assignement and copy-constructor
      methods
      Reviewed-by: Andreas Traczyk's avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
      Change-Id: I49d3a3fd2c0a2ed5fde0bd251efbad589c830c70
      a17755c6
  18. 24 Feb, 2017 1 commit
    • Guillaume Roguez's avatar
      sip: fix sip call crash · 89ba505b
      Guillaume Roguez authored
      MTU discovery was only implemented into TLS secured ICE transport,
      not in other sip transport.
      This wasn't taken in account and causes crashes when SIP call (TLS or not)
      are made.
      We fix the problem by detecting the transport type at various stage
      and calling correct API (or use default values as in the case of MTU).
      
      Change-Id: Id256a718ca8265a7295085fab8db9cf8e4c99683
      89ba505b
  19. 15 Feb, 2017 1 commit
    • Olivier SOLDANO's avatar
      Path MTU discovery implementation · 29ae5d8a
      Olivier SOLDANO authored
      This implementation uses gnutls dtls heartbeat API to test path MTU.
      heartbeat allowing messages with automated response in a datagram,
      the application is able to guess the MTU via a timeout in the heartbeat.
      (timeout on packet sent and no response, implies that the MTU is lower
      than the lost payload.)
      To minimize false positives (a response is lost for example), each attempt
      triggers one retry on the first timeout.
      This version ensures a minimal MTU of 512 bytes will be returned in
      case of any failure in the procedure.
      For retrocompatibility with non heartbeat capable clients,
      a fallback MTU is set at 1280.
      
      Change-Id: Ib9a7f63a70e8bdad239d8fc103779a0f2c387e87
      Reviewed-by: Andreas Traczyk's avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
      29ae5d8a
  20. 23 Jan, 2017 1 commit
  21. 11 Jan, 2017 1 commit
  22. 05 Jan, 2017 1 commit
  23. 23 Jun, 2016 2 commits
    • Guillaume Roguez's avatar
      security: re-enable anonymous gnutls handshake · 46285595
      Guillaume Roguez authored
      This patch imports a gnutls upstream patch to fix the DTLS packet
      re-ordering and re-enable our anonymous call feature.
      
      We bump gnutls at least on 3.4.14, even if not published yet,
      as the upstream patch will not be available since this version.
      We continue to use the 3.4.10 release to apply our local patch.
      
      We force also our contrib nettle to be build as some distributions
      do not compile this library as we need to.
      
      Change-Id: I3238993d56b41258f214cfaba7230dcd0538c5d2
      Tuleap: #788
      46285595
    • Guillaume Roguez's avatar
      security: fix crashes during DH generation · 74151247
      Guillaume Roguez authored
      When DH parameters are generated an error can occures
      and an empty (default constructed) DH params instance
      is returned.
      This causes a crashes into ring account code that not
      handles such case.
      
      This patch fixes this issue by adding operator bool()
      method to DH params and checking if not false when
      trying to save them.
      
      Note: If no DH params are generated, the empty instance
      is given up to the TlsSession object.
      Check if your cipher suite could handle empty DH params!
      
      Change-Id: I98c9c0317f4b8cb107ea0bca5f94b69321cbba76
      Tuleap: #792
      74151247
  24. 16 Jun, 2016 1 commit
    • Guillaume Roguez's avatar
      tls: remove async_send() and add send() API · 82ebcf8f
      Guillaume Roguez authored
      async_send() method was needed for SipsTransport class.
      But it's a dedicated behavior of PJSIP.
      To have a clean generic TlsSession class, this method was removed
      and a new synchronous send() method replace it.
      
      SipsTransport has been modified to implement the asynchronous
      send behavior requested by PJSIP.
      
      Change-Id: I3a68e36a33beab30cad19967d39f20598589ec30
      Tuleap: #660
      82ebcf8f
  25. 03 Jun, 2016 1 commit
    • Guillaume Roguez's avatar
      tls: revert anonymous certificate exchange · 9e053207
      Guillaume Roguez authored
      If an encrypted packet used during the encrypted
      handshake steps to initialize a secure channel with a peer
      is re-ordered due to the network, gnutls is not able to
      process the handshake correctly.
      This prevents any calls to be established
      (SIP channel goes over such connection).
      
      This patch reverts the anonymous handshake to let only
      the non-encrypted certificate exchange system.
      This is less anonymous as certificates are exchanged in
      plain-text format.
      
      The revert consisting to add an option to enable or not the
      anonymous certificate exchange. This option is set to false
      (non-enabled) by default.
      
      Now, TLS 1.3 should resolve this situation.
      So it's not a definitive patch.
      
      Change-Id: I3214efae1b69e44967a67a628cc690d8e95c9e40
      Tuleap: #572
      9e053207
  26. 10 May, 2016 1 commit
    • Guillaume Roguez's avatar
      tls: add getMaxPayload() method to TlsSession · 56ec56f7
      Guillaume Roguez authored
      This method returns the maximal number of user data bytes
      that one encrypted packet can transport.
      After this number, data are split in as many as smaller packet possible
      to not exceed this size.
      
      Change-Id: I5f88c4ac1f830ed78b2ecaca2f30257c874a2a13
      Tuleap: #660
      56ec56f7
  27. 06 May, 2016 1 commit
  28. 24 Mar, 2016 1 commit
    • Guillaume Roguez's avatar
      security: use anon+certificate authentification · 65e35da8
      Guillaume Roguez authored
      The TLS handshaking using certificate authentification leaks
      them: they are exchanged before cryptographic parameters,
      so the are in plaintext. This is an issue in TLS protocol itself.
      
      So this patch implements a new method to make a crypted channel
      first, then uses it to exchange certificates and permit trusted
      authentification based on certificates.
      
      This implementation is backware compatible.
      This is implies that old daemon can continue to work with patched one,
      but in such case certificates are leaked!
      
      Change-Id: Id5906df37b29bb938abdcdf25b875052527437e8
      Tuleap: #494
      65e35da8
  29. 23 Mar, 2016 1 commit
  30. 16 Mar, 2016 1 commit
    • Adrien Béraud's avatar
      crypto: save dh params · fbdc7b24
      Adrien Béraud authored
      Diffie-Hellman parameters can take a few seconds to compute,
      during this time a CPU core will be fully used. This leads
      to high power consumption on startup, which can be problematic
      for mobile devices.
      
      This patch introduces saving DH params to the persistent cache
      to avoid regenerating them too often.
      The file modification time is used to know the age of the
      parameters. DH params can be reused for up to 3 days.
      
      * Intoduce writeTime to know a file modification time
      * Introduce to_wstring to convert filenames to the Windows format
      * Introduce a DhParams structure to handle serialization
      
      Tuleap: #452
      Change-Id: Iaea9cf24d922fc6cfc542f8fa7b0c208ebc141d2
      fbdc7b24
  31. 15 Feb, 2016 1 commit
    • Guillaume Roguez's avatar
      security: extract TLS session from SipsIceTransport · c8f451e4
      Guillaume Roguez authored
      TLS session (class handling gnutls session client/server) has
      to be extracted from SipsIceTransport class.
      This last is PJSIP transport related, but we need TLS session
      to securise other kind of network socket.
      
      This extract has moslty re-written all previous classes
      has the global working model has change.
      
      This also introduces:
      - flood protection in server SYN cookie state
      - better FSM model in TLS session
      - network statistics recording
      - simplify SipsIceTransport design
      - ICE fixes to not block in waitForData() if ICE is stopped
      - integrate Diffie-Hellman params generation from RingAccount
      
      Change-Id: I32cf1f0c82dee548912d9efdaca5a4447ab05ec7
      Tuleap: #106
      c8f451e4