]> git.ipfire.org Git - people/ms/strongswan.git/commitdiff
diffie-hellman: Introduce an optional setter for the private value
authorMartin Willi <martin@revosec.ch>
Thu, 9 Apr 2015 08:02:24 +0000 (10:02 +0200)
committerMartin Willi <martin@revosec.ch>
Wed, 15 Apr 2015 12:37:38 +0000 (14:37 +0200)
This allows us to work with deterministic values for testing purposes.

src/libstrongswan/crypto/diffie_hellman.h

index 4704cd0da5093ca3da510663a10ba233a2ba6b1b..abebd66ad7d7281d251a2e36612139190d2710e1 100644 (file)
@@ -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.
         *