From 3941545fb90e9a53bdf077ddbb90157ce8747642 Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Thu, 9 Apr 2015 10:02:24 +0200 Subject: [PATCH] diffie-hellman: Introduce an optional setter for the private value This allows us to work with deterministic values for testing purposes. --- src/libstrongswan/crypto/diffie_hellman.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/libstrongswan/crypto/diffie_hellman.h b/src/libstrongswan/crypto/diffie_hellman.h index 4704cd0da..abebd66ad 100644 --- a/src/libstrongswan/crypto/diffie_hellman.h +++ b/src/libstrongswan/crypto/diffie_hellman.h @@ -116,6 +116,18 @@ struct diffie_hellman_t { bool (*get_my_public_value) (diffie_hellman_t *this, chunk_t *value) __attribute__((warn_unused_result)); + /** + * Set an explicit own private value to use. + * + * Calling this method is usually not required, as the DH backend generates + * an appropriate private value itself. It is optional to implement, and + * used mostly for testing purposes. + * + * @param value private value to set + */ + bool (*set_private_value)(diffie_hellman_t *this, chunk_t value) + __attribute__((warn_unused_result)); + /** * Get the DH group used. *