summaryrefslogtreecommitdiff
path: root/src/libstrongswan/plugins/openssl/openssl_sha1_prf.c
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2013-04-30 17:51:33 +0200
committerYves-Alexis Perez <corsac@debian.org>2013-04-30 17:51:33 +0200
commitc83921a2b566aa9d55d8ccc7258f04fca6292ee6 (patch)
tree44039788fc816c84d5788df847d1555413ebe55a /src/libstrongswan/plugins/openssl/openssl_sha1_prf.c
parent10e5fb2b9b2f27c83b3e5a1d048b158d5cf42a43 (diff)
downloadvyos-strongswan-c83921a2b566aa9d55d8ccc7258f04fca6292ee6.tar.gz
vyos-strongswan-c83921a2b566aa9d55d8ccc7258f04fca6292ee6.zip
Imported Upstream version 5.0.4
Diffstat (limited to 'src/libstrongswan/plugins/openssl/openssl_sha1_prf.c')
-rw-r--r--src/libstrongswan/plugins/openssl/openssl_sha1_prf.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libstrongswan/plugins/openssl/openssl_sha1_prf.c b/src/libstrongswan/plugins/openssl/openssl_sha1_prf.c
index 8c00e6a57..446c93e2b 100644
--- a/src/libstrongswan/plugins/openssl/openssl_sha1_prf.c
+++ b/src/libstrongswan/plugins/openssl/openssl_sha1_prf.c
@@ -42,7 +42,14 @@ struct private_openssl_sha1_prf_t {
METHOD(prf_t, get_bytes, bool,
private_openssl_sha1_prf_t *this, chunk_t seed, u_int8_t *bytes)
{
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+ if (!SHA1_Update(&this->ctx, seed.ptr, seed.len))
+ {
+ return FALSE;
+ }
+#else /* OPENSSL_VERSION_NUMBER < 1.0 */
SHA1_Update(&this->ctx, seed.ptr, seed.len);
+#endif
if (bytes)
{
@@ -84,7 +91,14 @@ METHOD(prf_t, get_key_size, size_t,
METHOD(prf_t, set_key, bool,
private_openssl_sha1_prf_t *this, chunk_t key)
{
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+ if (!SHA1_Init(&this->ctx))
+ {
+ return FALSE;
+ }
+#else /* OPENSSL_VERSION_NUMBER < 1.0 */
SHA1_Init(&this->ctx);
+#endif
if (key.len % 4)
{