X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=gnutls-helpers.h;h=9ea22a3491c90e8266fcd5a9b4c3c7c3f9a9732d;hb=9c7796a6c4f3964c9255b3741fe92ed4ddd9a41d;hp=1bf7a1d77cda6056ab5c1371fc26627ecb7d2d51;hpb=106d82cc8db97956d373f09e44dcdee661918c90;p=monkeysphere.git diff --git a/gnutls-helpers.h b/gnutls-helpers.h index 1bf7a1d..9ea22a3 100644 --- a/gnutls-helpers.h +++ b/gnutls-helpers.h @@ -4,6 +4,7 @@ #include +#include #include #include #include @@ -31,6 +32,18 @@ void init_datum(gnutls_datum_t* d); void copy_datum(gnutls_datum_t* dest, const gnutls_datum_t* src); int compare_data(const gnutls_datum_t* a, const gnutls_datum_t* b); void free_datum(gnutls_datum_t* d); +int write_datum_fd(int fd, const gnutls_datum_t* d); +int write_datum_fd_with_length(int fd, const gnutls_datum_t* d); +int write_data_fd_with_length(int fd, const gnutls_datum_t** d, unsigned int num); + +/* set up a datum from a null-terminated string */ +int datum_from_string(gnutls_datum_t* d, const char* str); + +/* keyid manipulations: */ +typedef unsigned char printable_keyid[16]; + +void init_keyid(gnutls_openpgp_keyid_t keyid); +void make_keyid_printable(printable_keyid out, gnutls_openpgp_keyid_t keyid); /* functions to get data into datum objects: */ @@ -41,6 +54,19 @@ int set_datum_string(gnutls_datum_t* d, const char* s); datum */ int set_datum_fd(gnutls_datum_t* d, int fd); -/* read the file indicated (by na1me) in the fname parameter. store +/* read the file indicated (by name) in the fname parameter. store its entire contents in a single datum. */ int set_datum_file(gnutls_datum_t* d, const char* fname); + +/* set up file descriptor pipe for writing (child process pid gets + stored in pid, fd is returned)*/ +int create_writing_pipe(pid_t* pid, const char* path, char* const argv[]); + +/* return 0 if userid matches the monkeysphere spec for ssh host user IDs */ +int validate_ssh_host_userid(const char* userid); + +/* how many bytes will it take to write out this datum in OpenPGP MPI form? */ +size_t get_openpgp_mpi_size(gnutls_datum_t* d); + +/* write the MPI stored in gnutls_datum_t to file descriptor fd: */ +int write_openpgp_mpi_to_fd(int fd, gnutls_datum_t* d);