aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/plugins/openssl/openssl_util.h
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2013-08-15 12:29:06 +0200
committerTobias Brunner <tobias@strongswan.org>2013-09-13 15:23:49 +0200
commitb5cc7053c83285181b0ee7ea0f13bed3431d9fd0 (patch)
tree91a8fad57409cda8717012f1e8b57d0c3000e155 /src/libstrongswan/plugins/openssl/openssl_util.h
parenta3232fa802b08447d3fb9534da5342992eee5337 (diff)
downloadstrongswan-b5cc7053c83285181b0ee7ea0f13bed3431d9fd0.tar.bz2
strongswan-b5cc7053c83285181b0ee7ea0f13bed3431d9fd0.tar.xz
openssl: Add helper function to convert BIGNUMs to chunks
Diffstat (limited to 'src/libstrongswan/plugins/openssl/openssl_util.h')
-rw-r--r--src/libstrongswan/plugins/openssl/openssl_util.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libstrongswan/plugins/openssl/openssl_util.h b/src/libstrongswan/plugins/openssl/openssl_util.h
index 25c692a1a..ce2a9e109 100644
--- a/src/libstrongswan/plugins/openssl/openssl_util.h
+++ b/src/libstrongswan/plugins/openssl/openssl_util.h
@@ -66,6 +66,15 @@ bool openssl_bn_cat(int len, BIGNUM *a, BIGNUM *b, chunk_t *chunk);
*/
bool openssl_bn_split(chunk_t chunk, BIGNUM *a, BIGNUM *b);
+/**
+ * Exports the given bignum (assumed to be a positive number) to a chunk in
+ * two's complement format (i.e. a zero byte is added if the MSB is set).
+ *
+ * @param bn the BIGNUM to export
+ * @param chunk the chunk (data gets allocated)
+ * @return TRUE on success, FALSE otherwise
+ */
+bool openssl_bn2chunk(BIGNUM *bn, chunk_t *chunk);
/**
* Allocate a chunk using the i2d function of a given object