bZRTP
bZRTP is an opensource implementation of ZRTP keys exchange protocol
|
Functions | |
static int | bzrtp_turnIntoResponder (bzrtpContext_t *zrtpContext, bzrtpChannelContext_t *zrtpChannelContext, bzrtpPacket_t *zrtpPacket, bzrtpCommitMessage_t *commitMessage) |
Turn the current Channel into responder role This happens when receiving a commit message when in state state_discovery_waitingForHelloAck or state_keyAgreement_sendingCommit if commit contention gives us the responder role. State will be changed to state_confirmation_responderSendingConfirm1 or state_confirmation_responderSendingDHPart1 depending on DHM or non-DHM operation mode. | |
static int | bzrtp_responseToHelloMessage (bzrtpContext_t *zrtpContext, bzrtpChannelContext_t *zrtpChannelContext, bzrtpPacket_t *zrtpPacket) |
When a Hello message arrive from peer for the first time, we shall parse it to check if it match our configuration and act on the context This message may arrives when in state state_discovery_init or state_discovery_waitingForHello. | |
static int | bzrtp_computeS0DHMMode (bzrtpContext_t *zrtpContext, bzrtpChannelContext_t *zrtpChannelContext) |
After the DHPart1 or DHPart2 arrives from peer, validity check and shared secret computation call this function to compute s0, KDF Context, ZRTPSess,. | |
static int | bzrtp_computeS0MultiStreamMode (bzrtpContext_t *zrtpContext, bzrtpChannelContext_t *zrtpChannelContext) |
In multistream mode, when we must send a confirm1 or receive a confirm1 for the first time, call the function to compute s0, KDF context and derive mac and srtp keys. | |
static int | bzrtp_deriveKeysFromS0 (bzrtpContext_t *zrtpContext, bzrtpChannelContext_t *zrtpChannelContext) |
static int | bzrtp_deriveSrtpKeysFromS0 (bzrtpContext_t *zrtpContext, bzrtpChannelContext_t *zrtpChannelContext) |
This function is called after confirm1 is received by initiator or confirm2 by responder Keys computed are: srtp self and peer keys and salt, SAS(if mode is not multistream). The whole bzrtpSrtpSecrets_t structure is ready after this call. | |
static int | bzrtp_sendPacket (const bzrtpContext_t *zrtpContext, bzrtpChannelContext_t *zrtpChannelContext, bzrtpPacket_t *zrtpPacket) |
Send the given packet, if the packets holds fragments, send them all Insert the packet sequence number and compute the CRC before sending. | |
int | state_discovery_init (bzrtpEvent_t event) |
This is the initial state On first call, we will create the Hello message and start sending it until we receive an helloACK or a hello message from peer. | |
int | state_discovery_waitingForHello (bzrtpEvent_t event) |
Arrives in this state coming from init upon reception on Hello ACK, we are now waiting for the Hello packet from peer. | |
int | state_discovery_waitingForHelloAck (bzrtpEvent_t event) |
We are now waiting for the HelloACK packet from peer or a Commit packet. | |
int | state_keyAgreement_sendingCommit (bzrtpEvent_t event) |
For any kind of key agreement (DHM, Mult, PreShared), we keep sending commit. | |
int | state_keyAgreement_responderSendingDHPart1 (bzrtpEvent_t event) |
For DHM mode only, responder send DHPart1 packet. | |
int | state_keyAgreement_initiatorSendingDHPart2 (bzrtpEvent_t event) |
For DHM mode only, initiator send DHPart2 packet. | |
int | state_confirmation_responderSendingConfirm1 (bzrtpEvent_t event) |
Responder send the confirm1 message. | |
int | state_confirmation_initiatorSendingConfirm2 (bzrtpEvent_t event) |
Initiator send the confirm2 message. | |
int | state_secure (bzrtpEvent_t event) |
We are in secure state. | |
int | state_sending_GoClear (bzrtpEvent_t event) |
GoClear initiator send a GoClear message. | |
int | state_clear (bzrtpEvent_t event) |
We are in clear state. | |
static int | bzrtp_deriveKeysFromS0 (BCTBX_UNUSED(bzrtpContext_t *zrtpContext), bzrtpChannelContext_t *zrtpChannelContext) |
This function is called after s0 (and ZRTPSess when non in Multistream mode) have been computed to derive the other keys Keys computed are: mackeyi, mackeyr, zrtpkeyi and zrtpkeyr, srtpkeys and salt. | |
int | bzrtp_updateCachedSecrets (bzrtpContext_t *zrtpContext, bzrtpChannelContext_t *zrtpChannelContext) |
Compute the new rs1 and update the cached secrets according to rfc section 4.6.1. | |
|
static |
After the DHPart1 or DHPart2 arrives from peer, validity check and shared secret computation call this function to compute s0, KDF Context, ZRTPSess,.
param[in] zrtpContext The context we are operation on(where to find the DHM context with the shared secret ready) param[in] zrtpChannelContext The channel context we are operation on
return 0 on success, error code otherwise
|
static |
In multistream mode, when we must send a confirm1 or receive a confirm1 for the first time, call the function to compute s0, KDF context and derive mac and srtp keys.
param[in] zrtpContext The context we are operation on(where to find the ZRTPSess) param[in] zrtpChannelContext The channel context we are operation on
return 0 on success, error code otherwise
|
static |
This function is called after s0 (and ZRTPSess when non in Multistream mode) have been computed to derive the other keys Keys computed are: mackeyi, mackeyr, zrtpkeyi and zrtpkeyr, srtpkeys and salt.
param[in] zrtpContext The context we are operation on(contains ZRTPSess) param[in,out] zrtpChannelContext The channel context we are operation on(contains s0 and will get the computed keys)
return 0 on success, error code otherwise
|
static |
|
static |
This function is called after confirm1 is received by initiator or confirm2 by responder Keys computed are: srtp self and peer keys and salt, SAS(if mode is not multistream). The whole bzrtpSrtpSecrets_t structure is ready after this call.
param[in] zrtpContext The context we are operation on param[in,out] zrtpChannelContext The channel context we are operation on(contains s0 and will get the computed keys)
return 0 on success, error code otherwise
|
static |
When a Hello message arrive from peer for the first time, we shall parse it to check if it match our configuration and act on the context This message may arrives when in state state_discovery_init or state_discovery_waitingForHello.
[in] | zrtpContext | The current zrtp Context |
[in,out] | zrtpChannelContext | The channel we are operating |
[in] | zrtpPacket | The zrtpPacket received, it contains the hello message |
|
static |
Send the given packet, if the packets holds fragments, send them all Insert the packet sequence number and compute the CRC before sending.
[in] | zrtpContext | zrtp context to get the sendData callback |
[in] | zrtpChannelContext | the channel context to get the sendData user callback, and update sequenceNumber |
[in] | zrtpPacket | the packet to be send, it must be ready for sending (bzrtp_packetBuild called). If the packet holds fragments packets, they will be sent. |
|
static |
Turn the current Channel into responder role This happens when receiving a commit message when in state state_discovery_waitingForHelloAck or state_keyAgreement_sendingCommit if commit contention gives us the responder role. State will be changed to state_confirmation_responderSendingConfirm1 or state_confirmation_responderSendingDHPart1 depending on DHM or non-DHM operation mode.
[in] | zrtpContext | The current zrtp Context |
[in,out] | zrtpChannelContext | The channel we are operating |
[in] | zrtpPacket | The zrtpPacket receives, it contains the commit message |
[in] | commitMessage | A direct pointer to the commitMessage structure contained in the zrtp packet |
int bzrtp_updateCachedSecrets | ( | bzrtpContext_t * | zrtpContext, |
bzrtpChannelContext_t * | zrtpChannelContext | ||
) |
Compute the new rs1 and update the cached secrets according to rfc section 4.6.1.
param[in] zrtpContext The context we are operation on param[in/out] zrtpChannelContext The channel context we are operation on(contains s0)
return 0 on success, error code otherwise
int state_clear | ( | bzrtpEvent_t | event | ) |
We are in clear state.
Arrives from:
state_secure on GoClear reception
int state_confirmation_initiatorSendingConfirm2 | ( | bzrtpEvent_t | event | ) |
Initiator send the confirm2 message.
Arrives from:
int state_confirmation_responderSendingConfirm1 | ( | bzrtpEvent_t | event | ) |
Responder send the confirm1 message.
Arrives from:
int state_discovery_init | ( | bzrtpEvent_t | event | ) |
This is the initial state On first call, we will create the Hello message and start sending it until we receive an helloACK or a hello message from peer.
Arrives from :
int state_discovery_waitingForHello | ( | bzrtpEvent_t | event | ) |
Arrives in this state coming from init upon reception on Hello ACK, we are now waiting for the Hello packet from peer.
Arrives from :
int state_discovery_waitingForHelloAck | ( | bzrtpEvent_t | event | ) |
We are now waiting for the HelloACK packet from peer or a Commit packet.
Arrives from :
int state_keyAgreement_initiatorSendingDHPart2 | ( | bzrtpEvent_t | event | ) |
For DHM mode only, initiator send DHPart2 packet.
Arrives from:
int state_keyAgreement_responderSendingDHPart1 | ( | bzrtpEvent_t | event | ) |
For DHM mode only, responder send DHPart1 packet.
Arrives from:
int state_keyAgreement_sendingCommit | ( | bzrtpEvent_t | event | ) |
For any kind of key agreement (DHM, Mult, PreShared), we keep sending commit.
Arrives from :
int state_secure | ( | bzrtpEvent_t | event | ) |
We are in secure state.
Arrives from:
ClearACK on GoClear reception (+ destroy all key materials)
int state_sending_GoClear | ( | bzrtpEvent_t | event | ) |
GoClear initiator send a GoClear message.
Arrives from: