splone / splonebox-core

splonebox - open source network assessment tool with focus on modularity
http://splonebox.io
GNU Affero General Public License v3.0
24 stars 7 forks source link

Crypto stack implementation #29

Closed stze closed 8 years ago

stze commented 8 years ago

This PR introduces a crypto stack implementation based on tweetnacl library.

mkind commented 8 years ago

Before merging, the nonce should be adjusted.

stze commented 8 years ago

If there is no more reason to not merge this into master, please merge. Waiting for the client and synchronzing seems irrelevant or the wrong approach to me, because every developer is able to switch between branches.

bontric commented 8 years ago

I'm unable to connect two clients at the same time to the core properly. The crypto tunnel message of the second client is considered invalid. I get "sb: establishing crypto tunnel failed" on the server side. I tested a few combinations and it seems like the first attempt to connect is always successful and every attempt afterwards is never successful

The error occurs in crypto.c:133

/* check if box can be opened (authentication) */
if (crypto_box_open_afternm(allzeroboxed, allzeroboxed, 96, nonce, 
    clientshortserverlong))
  goto fail;  

The error can be reproduced using this script (modify & clone to test with two connecting plugins):

Script

from splonecli import Plugin, RemoteFunction

@RemoteFunction
def foo():
    pass

plug = Plugin(
    "<api_key>",
    "foo",
    "bar",
    "some",
    "thing",
    debug=True)

plug.connect("127.0.0.1", 6666)
plug.register()
plug.listen()
stze commented 8 years ago

I've fixed the problem. There was one memzerotoo much :wink: