(A_SURRENDER_CTX *)NULL_PTR

 

 

B_KeyAgreeInit

 

 

B_KeyAgreeInit

 

 

 

 

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 */

);

 

 

 

 

 

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

, 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

Value

Description

0

Operation was successful.

non-zero

see Appendix A, ”Crypto-C Error Types”

 

 

C h a p t e r 4 D e t a i l s o f C r y p t o - C F u n c t i o n s

325

Page 335
Image 335
RSA Security 5 manual BKeyAgreeInit