Clean up ssh_keyalg APIs and implementations.
Quite a few of the function pointers in the ssh_keyalg vtable now take ptrlen arguments in place of separate pointer and length pairs. Meanwhile, the various key types' implementations of those functions now work by initialising a BinarySource with the input ptrlen and using the new decode functions to walk along it. One exception is the openssh_createkey method which reads a private key in the wire format used by OpenSSH's SSH-2 agent protocol, which has to consume a prefix of a larger data stream, and tell the caller how much of that data was the private key. That function now takes an actual BinarySource, and passes that directly to the decode functions, so that on return the caller finds that the BinarySource's read pointer has been advanced exactly past the private key. This let me throw away _several_ reimplementations of mpint-reading functions, one in each of sshrsa, sshdss.c and sshecc.c. Worse still, they didn't all have exactly the SSH-2 semantics, because the thing in sshrsa.c whose name suggested it was an mpint-reading function actually tolerated the wrong number of leading zero bytes, which it had to be able to do to cope with the "ssh-rsa" signature format which contains a thing that isn't quite an SSH-2 mpint. Now that deviation is clearly commented!
Showing
- cmdgen.c 2 additions, 3 deletionscmdgen.c
- import.c 10 additions, 8 deletionsimport.c
- pageant.c 1 addition, 8 deletionspageant.c
- ssh.c 7 additions, 11 deletionsssh.c
- ssh.h 5 additions, 11 deletionsssh.h
- sshdss.c 48 additions, 123 deletionssshdss.c
- sshecc.c 61 additions, 122 deletionssshecc.c
- sshpubk.c 4 additions, 3 deletionssshpubk.c
- sshrsa.c 51 additions, 86 deletionssshrsa.c
Loading
Please register or sign in to comment