Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mostly misc cleanups, wireguard dissecting and network packet testing #16

Merged
merged 67 commits into from
Mar 10, 2024

Commits on Feb 24, 2024

  1. Configuration menu
    Copy the full SHA
    cce12ac View commit details
    Browse the repository at this point in the history

Commits on Feb 25, 2024

  1. Use Network representation for port numbers

    Always store port numbers in n2n_sock_t, since they are basically opaque
    strings - the only time this needs to change is for presentation to a
    human.
    
    This should fix some observed errors with the data contained within
    network packets.
    hamishcoleman committed Feb 25, 2024
    Configuration menu
    Copy the full SHA
    e938e78 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e82a1e4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3e188b8 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    622fae8 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    ff440ac View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    406f90f View commit details
    Browse the repository at this point in the history
  7. Fix incorrect decoder

    hamishcoleman committed Feb 25, 2024
    Configuration menu
    Copy the full SHA
    64bc790 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    9983083 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    359ab0f View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    9ce4c6c View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    3386cb8 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    41d418b View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    1edb03b View commit details
    Browse the repository at this point in the history
  14. Address lint concerns

    hamishcoleman committed Feb 25, 2024
    Configuration menu
    Copy the full SHA
    ccc661c View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    e0f506c View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    d3d9270 View commit details
    Browse the repository at this point in the history
  17. Revert "Update test data to match new sock encoding"

    This reverts commit e0f506c.
    hamishcoleman committed Feb 25, 2024
    Configuration menu
    Copy the full SHA
    0c45984 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    029a4ea View commit details
    Browse the repository at this point in the history
  19. Revert "Use Network representation for port numbers"

    This reverts commit e938e78.
    
    It appears that this breaks federation with n2n supernode.  More
    investigation required.
    hamishcoleman committed Feb 25, 2024
    Configuration menu
    Copy the full SHA
    a4f4eae View commit details
    Browse the repository at this point in the history

Commits on Feb 26, 2024

  1. Configuration menu
    Copy the full SHA
    cb1e2e1 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d6bca21 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d29e3ac View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    2dee74d View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    2e40291 View commit details
    Browse the repository at this point in the history
  6. Dont use encode functions when not needed

    The wire encode_* functions are intended to build the packets that will
    be sent on the wire.  These uses of encode_mac() were for structures
    that would then be passed to another encode_* function, thus they are
    not building wire structs.
    
    Additionally, the encode_mac() degenerates into a string copy, so just
    do that.
    hamishcoleman committed Feb 26, 2024
    Configuration menu
    Copy the full SHA
    4101d9b View commit details
    Browse the repository at this point in the history
  7. No need to encode unstructured data

    Since these 64bit writes are entirely unstructured random data, they
    have no difference between their in memory or on the wire encoding.
    
    They are also not used in the decode step, so are just acting as a
    nonce.
    
    Removing their use allows cleaner separation of the wire protocol
    definitions.
    hamishcoleman committed Feb 26, 2024
    Configuration menu
    Copy the full SHA
    cd615d5 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    a99390f View commit details
    Browse the repository at this point in the history
  9. Ensure the transform tests using stable nonces

    Add a function to the random number generator to reseed with a fixed and
    known seed - this allows us to run any tests that consume random numbers
    with a known and expected result.
    
    Specifically, the transform functions use a prefix of randomness that is
    basically serving as a nonce.
    
    This was previously stable because we didnt seed the random number
    generator, but adding any new transform functions in the middle would
    have perturbed the following results - so we use the stable default
    before each transform.
    
    This came to light as the result of changing to use native host ordering
    for the random nonce bytes - which disturbed the encrypted output.
    hamishcoleman committed Feb 26, 2024
    Configuration menu
    Copy the full SHA
    70a011d View commit details
    Browse the repository at this point in the history
  10. Revert "Do check the build deps before trying to build"

    This reverts commit d6bca21.
    
    The github ubuntu builder doesnt have the right packages installed -
    even though there is a `mk-build-deps -i` command run before the `make
    dpkg` - this is probably because it is cross-compiling and only the
    native packages are installed.
    
    ```
    env -u CFLAGS dpkg-buildpackage -rfakeroot -us -uc --host-type i686-linux-gnu
    dpkg-buildpackage: info: source package n3n
    dpkg-buildpackage: info: source version 3.1.1-815-g70a011d-1
    dpkg-buildpackage: info: source distribution UNRELEASED
    dpkg-buildpackage: info: source changed by  <builder@example.com>
     dpkg-source --before-build .
    dpkg-buildpackage: info: host architecture i386
    dpkg-checkbuilddeps: error: Unmet build dependencies: libcap-dev libzstd-dev python3 uncrustify
    dpkg-buildpackage: warning: build dependencies/conflicts unsatisfied; aborting
    dpkg-buildpackage: warning: (Use -d flag to override.)
    ```
    hamishcoleman committed Feb 26, 2024
    Configuration menu
    Copy the full SHA
    51e0ba8 View commit details
    Browse the repository at this point in the history

Commits on Feb 27, 2024

  1. Configuration menu
    Copy the full SHA
    eee0f92 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5a114bd View commit details
    Browse the repository at this point in the history
  3. Add another packet test

    hamishcoleman committed Feb 27, 2024
    Configuration menu
    Copy the full SHA
    63e8113 View commit details
    Browse the repository at this point in the history

Commits on Feb 28, 2024

  1. Configuration menu
    Copy the full SHA
    ca310fd View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7ab01ad View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    66a5a64 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    54748ec View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    491fc19 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    ad8f9be View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    6842829 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    6ef1333 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    ac10aca View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    3977e33 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    d8393c2 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    4ce132f View commit details
    Browse the repository at this point in the history

Commits on Feb 29, 2024

  1. Configuration menu
    Copy the full SHA
    b61c213 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e845a2f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2ce3a32 View commit details
    Browse the repository at this point in the history

Commits on Mar 6, 2024

  1. Configuration menu
    Copy the full SHA
    531aff3 View commit details
    Browse the repository at this point in the history
  2. Remove unused include

    hamishcoleman committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    1e95cf8 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    81c9885 View commit details
    Browse the repository at this point in the history

Commits on Mar 7, 2024

  1. Configuration menu
    Copy the full SHA
    3f376a3 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    921ae47 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a5e0657 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    225bb0e View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    e1699f6 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    521de7f View commit details
    Browse the repository at this point in the history

Commits on Mar 9, 2024

  1. Configuration menu
    Copy the full SHA
    da7f635 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    72bdde6 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4081718 View commit details
    Browse the repository at this point in the history
  4. Avoid showing known warning compiling speck

    The speck code has been generating warnings at compile time for as long
    as I can remember.  Whilst it may be a valid warning, it does not appear
    to have random uninitialised data in the Y[2] as the unit tests are
    producing stable results.
    
    Ideally, this warning would be fixed.  The simple fix of initialising
    the variable could slow down the encryption routine.  So - before trying
    that - there should be an automated encryption performance test added.
    
    There is also a plan to make more accessible optimised versions of the
    crypto routines, which would require refactoring this code, so it may
    unearth more warnings or shift the message in a way that helps to
    diagnose things.
    
    For the moment, take the simple path of ignoring that warning for this
    one file.
    
    ```
    In file included from /usr/lib/gcc/x86_64-linux-gnu/12/include/xmmintrin.h:1316,
                     from /usr/lib/gcc/x86_64-linux-gnu/12/include/immintrin.h:31,
                     from /home/hamish/r/n3n/include/speck.h:75,
                     from src/speck.c:25:
    In function ‘_mm_unpackhi_epi64’,
        inlined from ‘speck_encrypt_xor.isra’ at src/speck.c:587:9:
    /usr/lib/gcc/x86_64-linux-gnu/12/include/emmintrin.h:1024:19: warning: ‘Y[2]’ may be used uninitialized [-Wmaybe-uninitialized]
     1024 |   return (__m128i)__builtin_ia32_punpckhqdq128 ((__v2di)__A, (__v2di)__B);
          |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/speck.c: In function ‘speck_encrypt_xor.isra’:
    src/speck.c:540:16: note: ‘Y[2]’ was declared here
      540 |     u128 X[4], Y[4], Z[4];                                 \
          |                ^
    src/speck.c:587:9: note: in expansion of macro ‘Encrypt_Dispatcher’
      587 |         Encrypt_Dispatcher(128);
          |         ^~~~~~~~~~~~~~~~~~
    ```
    hamishcoleman committed Mar 9, 2024
    Configuration menu
    Copy the full SHA
    8cc64b3 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    65a4aad View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    5b72e55 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    9676c68 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    80e974a View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    26d6e99 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    4a0e593 View commit details
    Browse the repository at this point in the history