Chapter 4 Details of Crypto-C Functions 327
B_KeyAgreePhase2
B_KeyAgreePhase2
Description
B_KeyAgreePhase2 performs a round of key agreement as specified by
algorithmObject
, receiving
inputLen
bytes from
input,
which is the other party’s
intermediate value. B_KeyAgreePhase2 writes the output to
output,
which is a buffer
supplied by the caller of at least
maxOutputLen
bytes, and sets
outputLen
to the number
of bytes written to
output
. If
input
is the other party’s final intermediate value,
output
is the agreed-upon key; otherwise,
output
is a new intermediate value to send to the
other party. 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.
B_KeyAgreePhase2 may be called one or more times to process intermediate values,
depending on how many other parties are involved in the key agreement. For an
algorithm like Diffie-Hellman, B_KeyAgreePhase2 is called once.
Return value
int B_KeyAgreePhase2 (
B_ALGORITHM_OBJ algorithmObject, /* algorithm object */
unsigned char *output, /* output data buffer */
unsigned int *outputLen, /* length of output data */
unsigned int maxOutputLen, /* size of output data buffer */
unsigned char *input, /* input data */
unsigned int inputLen, /* length of input data */
A_SURRENDER_CTX *surrenderContext /* surrender context */
);
Value Description
0 Operation was successful.
non-zero see Appendix A, ”Crypto-C Error Types”