diff options
author | Justus Winter <justus@g10code.com> | 2016-03-29 13:06:59 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2016-05-02 11:55:38 +0200 |
commit | 735e34f93270262752a86573e81d2f1f915d25df (patch) | |
tree | cc3ea13f03b9c0e447cf007ca71e0811eba56489 /include/libssh | |
parent | fea9e3050c99209a05a340e61e617be46547141f (diff) | |
download | libssh-735e34f93270262752a86573e81d2f1f915d25df.tar.gz libssh-735e34f93270262752a86573e81d2f1f915d25df.tar.xz libssh-735e34f93270262752a86573e81d2f1f915d25df.zip |
libgcrypt: Add helper to extract MPIs into ssh_strings
* include/libssh/libgcrypt.h (ssh_sexp_extract_mpi): New prototype.
* src/libgcrypt.c (ssh_sexp_extract_mpi): New function.
Signed-off-by: Justus Winter <justus@g10code.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'include/libssh')
-rw-r--r-- | include/libssh/libgcrypt.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/libssh/libgcrypt.h b/include/libssh/libgcrypt.h index 7b97c7f8..7556acae 100644 --- a/include/libssh/libgcrypt.h +++ b/include/libssh/libgcrypt.h @@ -71,6 +71,16 @@ char *ssh_gcry_bn2dec(bignum bn); #define bignum_bn2bin(num,datalen,data) gcry_mpi_print(GCRYMPI_FMT_USG,data,datalen,NULL,num) #define bignum_cmp(num1,num2) gcry_mpi_cmp(num1,num2) +/* Helper functions for data conversions. */ + +/* Extract an MPI from the given s-expression SEXP named NAME which is + encoded using INFORMAT and store it in a newly allocated ssh_string + encoded using OUTFORMAT. */ +ssh_string ssh_sexp_extract_mpi(const gcry_sexp_t sexp, + const char *name, + enum gcry_mpi_format informat, + enum gcry_mpi_format outformat); + #endif /* HAVE_LIBGCRYPT */ struct ssh_cipher_struct *ssh_get_ciphertab(void); |