summaryrefslogtreecommitdiff
path: root/gnutls-helpers.c
diff options
context:
space:
mode:
authorJameson Graef Rollins <jrollins@phys.columbia.edu>2008-05-03 11:36:44 -0400
committerJameson Graef Rollins <jrollins@phys.columbia.edu>2008-05-03 11:36:44 -0400
commit7970ab05408ec48ffde9bffddb451a8e49ef6fa6 (patch)
tree7a35f9c1051aad9ef717fe5bb003523f8a56713a /gnutls-helpers.c
parent97429d91d8b9e69756efac3a28105535807221f3 (diff)
parentc83951904066fedc425b82ea4dbf6cab64db7cd6 (diff)
Merge commit 'dkg/master'
Diffstat (limited to 'gnutls-helpers.c')
-rw-r--r--gnutls-helpers.c17
1 files changed, 17 insertions, 0 deletions
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;
+}