Chapter 4 Details of Crypto-C Functions 325
B_KeyAgreeInit
B_KeyAgreeInit
Description
B_KeyAgreeInit initializes
algorithmObject
for performing key agreement using the
algorithm specified by a previous call to B_SetAlgorithmInfo. The chooser for
selecting the algorithm method is
algorithmChooser
. The key object for supplying the
key information is
keyObject
; it should be (B_KEY_OBJ)NULL_PTR for key agreement
algorithms that do not need an input key. The surrender context for processing and
canceling during lengthy operations is
surrenderContext
; if its value is
(A_SURRENDER_CTX *)NULL_PTR, Crypto-C does not use it.
This routine can be used for Diffie-Hellman key agreement. First B_KeyAgreeInit is
called to setup the algorithm, then each party calls B_KeyAgreePhase1 to generate the
value that is then sent to the other party. Each party then passes the received value to
B_KeyAgreePhase2, which computes the agreed-upon key. If several key agreements
are done using the same algorithm, there is no need to call B_KeyAgreeInit again.
Return value
int B_KeyAgreeInit (
B_ALGORITHM_OBJ algorithmObject, /* algorithm object */
B_KEY_OBJ keyObject, /* key object */
B_ALGORITHM_CHOOSER algorithmChooser, /* algorithm chooser */
A_SURRENDER_CTX *surrenderContext /* surrender context */
);
Value Description
0 Operation was successful.
non-zero see Appendix A, ”Crypto-C Error Types”