X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=gnutls-helpers.c;h=6eae29e0aa3a32352c62212587a33118d5ca973f;hb=9aa595ec4543187906cc166c1c173b863717ea96;hp=5a567e2940ef9376f35a535382f31107e0b0e640;hpb=fd25d7c2bbbf6e36ee1d2a3ebd9b804e2d64bab3;p=monkeysphere.git diff --git a/gnutls-helpers.c b/gnutls-helpers.c index 5a567e2..6eae29e 100644 --- a/gnutls-helpers.c +++ b/gnutls-helpers.c @@ -345,3 +345,20 @@ int validate_ssh_host_userid(const char* userid) { setlocale(LC_ALL, oldlocale); return 1; } + +/* http://tools.ietf.org/html/rfc4880#section-5.5.2 */ +size_t get_openpgp_mpi_size(gnutls_datum_t* d) { + return 2 + d->size; +} + +int write_openpgp_mpi_to_fd(int fd, gnutls_datum_t* d) { + uint16_t x; + + x = d->size * 8; + x = htons(x); + + write(fd, &x, sizeof(x)); + write(fd, d->data, d->size); + + return 0; +}