Page 1 of 1

SSH example fails

Posted: Mon Nov 25, 2013 1:03 pm
by RFneff
Greetings.
I'm new to NetBurner, new to SSH, and somewhat new to networking (but not new to embedded software). I figured I'd try something safe, the example for the SSH minimal server (we bought the SSL/SSH package). I have a Nano carrier with the Coldfire 54415 board mounted in it. I've run a couple other examples successfully, but this one fails as soon as I try to make the SSH connection, apparently when I open a connection on port 22 (haven't tried to send a password or anything yet). I'm using TeraTerm for the serial and SSH connections, compiling on Windows 7. My understanding is that the examples in the SSH and SSL section are for the nano board, and should run as compiled, right? I'm guessing the problem is happening inside of SshAccept (the timeout at the top of the following output is okay).

Here's the serial output (minus my company's IP address):

Code: Select all

Waiting for connection on port 22...
SshAccept() timeout: TCP Timeout


Waiting for connection on port 22...
SSH (1) Negotiating connection from --.--.10.58
SSH (1) Client version: SSH-2.0-TTSSH/2.66 Win32
SSH (1) Generating session key, may take a while.
-------------------Trap information-----------------------------
Exception Frame/A7 =80008C3C
Trap Vector        =Format Error (14)
Format             =04
Status register SR =2708
Fault Status       =00
Faulted PC         =00000000

-------------------Register information-------------------------
A0=082E3BF2 A1=4940A3CD A2=07175B36 A3=BFF6E754
A4=0746DF1E A5=AA8FA530 A6=0877D55D A7=80008C3C
D0=094C66A9 D1=2455885F D2=08EAE32A D3=4C2F328F
D4=090719FB D5=1ADE4F07 D6=0868E8F4 D7=AF767F8E
SR=2708 PC=00000000
-------------------RTOS information-----------------------------
SR indicates trap from within ISR or CRITICAL RTOS section
The OSTCBCur current task control block = 80000678
This looks like a valid TCB
The current running task is: TCPD#28
-------------------Task information-----------------------------
Task    | State    |Wait| Call Stack
Idle#3F|Ready     |    |40009B64,40009B3C,0
Main#32|Semaphore |0000|4000A1DE,4001865C,400063F6,4000655E,4000C04A,
TCPD#28|Running   |    |00000000,0
IP#27|Fifo      |0006|4000AF44,4000E010,40009B3C,0
Enet#26|Fifo      |0025|4000AF44,40030624,40009B3C,0
User,#31|Semaphore |0006|4000A1DE,4001CA2E,4001CAFA,40004942,40009B3C,
User,#38|Ready     |    |400336B0,4002095A,4001FFA4,40022474,4001F8E4,40024FFE,

-------------------End of Trap Diagnostics----------------------ÿWaiting 2sec to start 'A' to abort
Configured IP = --.--.10.192
Configured Mask = 255.255.255.0
MAC Address= 00:03:f4:06:4e:96
Static IP address:  --.--.10.192
Starting SSH Server Task, Listening for SSH connection on port 22

Waiting for connection on port 22...
Type an ascii string followed by a <CR> to send
When I try to debug it, it doesn't return from SshNegotiateSession(), and on the serial port I get this (there is several seconds pause while its generating the session key, but then it starts spewing endlessly):

Code: Select all


Waiting for connection on port 22...
Type an ascii string followed by a <CR> to send
Waiting 2sec to start 'A' to abort
Configured IP = --.--.10.192
Configured Mask = 255.255.255.0
MAC Address= 00:03:f4:06:4e:96
Static IP address:  --.--.10.192
Starting SSH Server Task, Listening for SSH connection on port 22

Waiting for connection on port 22...
Type an ascii string followed by a <CR> to send
SSH (1) Negotiating connection from --.--.10.58
SSH (1) Client version: SSH-2.0-TTSSH/2.66 Win32
SSH (1) Generating session key, may take a while..SSH (X) Error fail_assert, 156, failed assertion (buffer.c:443): `mp != NULL'
SSH (X) Error fail_assert, 156, failed assertion (rsa.c:188): `key != NULL'
SSH (X) Error fail_assert, 156, failed assertion (buffer.c:443): `mp != NULL'
SSH (X) Error fail_assert, 156, failed assertion (buffer.c:443): `mp != NULL'
SSH (X) Error fail_assert, 156, failed assertion (rsa.c:291): `key != NULL'
SSH (X) Error fail_assert, 156, failed assertion (rsa.c:421): `key != NULL'
SSH (X) Error __buf_new, 121, buf->size too big
SSH (X) Error buf_incrlen, 263, bad buf_incrlen
SSH (X) Error buf_incrlen, 263, bad buf_incrlen
SSH (X) Error buf_incrlen, 263, bad buf_incrlen
SSH (X) Error buf_incrlen, 263, bad buf_incrlen
SSH (X) Error buf_incrlen, 263, bad buf_incrlen
SSH (X) Error buf_incrlen, 263, bad buf_incrlen
SSH (X) Error buf_incrlen, 263, bad buf_incrlen
SSH (X) Error buf_incrlen, 263, bad buf_incrlen
SSH (X) Error buf_incrlen, 263, bad buf_incrlen
SSH (X) Error buf_incrlen, 263, bad buf_incrlen
SSH (X) Error buf_incrlen, 263, bad buf_incrlen
SSH (X) Error buf_incrlen, 263, bad buf_incrlen
SSH (X) Error buf_incrlen, 263, bad buf_incrlen
Thanks for any help!

Re: SSH example fails

Posted: Mon Nov 25, 2013 2:44 pm
by rnixon
Sounds like you did not enable SSH and SSL in \nburn\include\prefef.h. These are large s/w pieces, and you don't want them in your app unless your using them, that's why they are not always built in. I read this in the security docs somewhere, but don't have a page number for you. Its also always a good idea to include your s/w tools version just in case.

Re: SSH example fails

Posted: Tue Nov 26, 2013 8:06 am
by RFneff
rnixon wrote:Sounds like you did not enable SSH and SSL in \nburn\include\prefef.h. These are large s/w pieces, and you don't want them in your app unless your using them, that's why they are not always built in. I read this in the security docs somewhere, but don't have a page number for you. Its also always a good idea to include your s/w tools version just in case.
Oh yes, it does tell me that in sections 4.1 and again in 5.3 of the NetBurnerSecurityLibraries.pdf (I'm not aware of any other Netburner doc on SSL/SSH). But it also says it won't compile otherwise, however this example did compile, and run to an extent. Digging deeper this is probably due to a change in release 2.4, rc 3. I'm apparently using 2.6.3

It would be nice if the examples (or where the session key is created, better yet, both) would have something like this:

Code: Select all

#ifndef NB_SSH_SUPPORTED
#error Uncomment NB_SSH_SUPPORTED in \nburn\include\predef.h and recompile system libraries
#endif
Or include this instruction in the comments at the top of the file. To be safe I uncommented both SSL and SSH.


So anyway, it does work now, thank you. At least, the program doesn't fail. Now I need to find out where the password and usernames are set up, so I can properly log in. But the session key is now computed without error.