aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/plugins/openssl/openssl_util.c
diff options
context:
space:
mode:
authorAndreas Steffen <andreas@strongswan.org>2009-07-06 08:47:18 +0200
committerAndreas Steffen <andreas@strongswan.org>2009-07-06 08:47:18 +0200
commit21863d63617371e7bc5da8033eea99158471e93a (patch)
tree19338ec293c6561509c3b9fc9fa01065f07959b5 /src/libstrongswan/plugins/openssl/openssl_util.c
parent887ed734d0d17079ff5772dc3c5f505f75764c1b (diff)
downloadstrongswan-21863d63617371e7bc5da8033eea99158471e93a.tar.bz2
strongswan-21863d63617371e7bc5da8033eea99158471e93a.tar.xz
ecp_x_coordinate only option allows ECP interoperability with MS Windows
Diffstat (limited to 'src/libstrongswan/plugins/openssl/openssl_util.c')
-rw-r--r--src/libstrongswan/plugins/openssl/openssl_util.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/libstrongswan/plugins/openssl/openssl_util.c b/src/libstrongswan/plugins/openssl/openssl_util.c
index bb0c296e1..c8c453f64 100644
--- a/src/libstrongswan/plugins/openssl/openssl_util.c
+++ b/src/libstrongswan/plugins/openssl/openssl_util.c
@@ -71,21 +71,26 @@ bool openssl_bn_cat(int len, BIGNUM *a, BIGNUM *b, chunk_t *chunk)
{
int offset;
- chunk->len = len * 2;
+ chunk->len = len + (b ? len : 0);
chunk->ptr = malloc(chunk->len);
memset(chunk->ptr, 0, chunk->len);
+ /* convert a */
offset = len - BN_num_bytes(a);
if (!BN_bn2bin(a, chunk->ptr + offset))
{
goto error;
}
- offset = len - BN_num_bytes(b);
- if (!BN_bn2bin(b, chunk->ptr + len + offset))
+ /* optionally convert and concatenate b */
+ if (b)
{
- goto error;
- }
+ offset = len - BN_num_bytes(b);
+ if (!BN_bn2bin(b, chunk->ptr + len + offset))
+ {
+ goto error;
+ }
+ }
return TRUE;
error: