This is incredible: +"Due to a byte/bit confusion, the DH secret was too short. This file was +completely reworked and will be commited in a future version."
I quickly looked over it and think that your approach (which also has been discussed in detail on irc) looks good, please push. Andreas