| ZRtp.h | | ZRtp.h | |
| /* | | /* | |
|
| Copyright (C) 2006 Werner Dittmann | | Copyright (C) 2006-2007 Werner Dittmann | |
| | | | |
|
| This program is free software; you can redistribute it and/or modify | | This program is free software: you can redistribute it and/or modify | |
| it under the terms of the GNU General Public License as published by | | it under the terms of the GNU General Public License as published by | |
|
| the Free Software Foundation; either version 2, or (at your option) | | the Free Software Foundation, either version 3 of the License, or | |
| any later version. | | (at your option) any later version. | |
| | | | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| GNU General Public License for more details. | | GNU General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU General Public License | | You should have received a copy of the GNU General Public License | |
|
| along with this program; if not, write to the Free Software | | along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| Foundation, Inc., 59 Temple Place, Boston, MA 02111. | | | |
| */ | | */ | |
| | | | |
| #ifndef _ZRTP_H_ | | #ifndef _ZRTP_H_ | |
| #define _ZRTP_H_ | | #define _ZRTP_H_ | |
| | | | |
| #include <cstdlib> | | #include <cstdlib> | |
| | | | |
| #include <libzrtpcpp/ZrtpPacketHello.h> | | #include <libzrtpcpp/ZrtpPacketHello.h> | |
| #include <libzrtpcpp/ZrtpPacketHelloAck.h> | | #include <libzrtpcpp/ZrtpPacketHelloAck.h> | |
| #include <libzrtpcpp/ZrtpPacketCommit.h> | | #include <libzrtpcpp/ZrtpPacketCommit.h> | |
| #include <libzrtpcpp/ZrtpPacketDHPart.h> | | #include <libzrtpcpp/ZrtpPacketDHPart.h> | |
| #include <libzrtpcpp/ZrtpPacketConfirm.h> | | #include <libzrtpcpp/ZrtpPacketConfirm.h> | |
| #include <libzrtpcpp/ZrtpPacketConf2Ack.h> | | #include <libzrtpcpp/ZrtpPacketConf2Ack.h> | |
| #include <libzrtpcpp/ZrtpPacketGoClear.h> | | #include <libzrtpcpp/ZrtpPacketGoClear.h> | |
| #include <libzrtpcpp/ZrtpPacketClearAck.h> | | #include <libzrtpcpp/ZrtpPacketClearAck.h> | |
|
| | | #include <libzrtpcpp/ZrtpPacketError.h> | |
| | | #include <libzrtpcpp/ZrtpPacketErrorAck.h> | |
| #include <libzrtpcpp/ZrtpCallback.h> | | #include <libzrtpcpp/ZrtpCallback.h> | |
| #include <libzrtpcpp/ZIDRecord.h> | | #include <libzrtpcpp/ZIDRecord.h> | |
| | | | |
| #ifndef SHA256_DIGEST_LENGTH | | #ifndef SHA256_DIGEST_LENGTH | |
| #define SHA256_DIGEST_LENGTH 32 | | #define SHA256_DIGEST_LENGTH 32 | |
| #endif | | #endif | |
| | | | |
|
| | | // The ZRTP error codes accroding the specification chapter 6.9 | |
| | | enum zrtpErrorCodes { | |
| | | MalformedPacket = 0x10, | |
| | | CriticalSWError = 0x20, | |
| | | UnsuppZRTPVersion = 0x30, | |
| | | HelloCompMismatch = 0x40, | |
| | | UnsuppHashType = 0x51, | |
| | | UnsuppCiphertype = 0x52, | |
| | | UnsuppPKExchange = 0x53, | |
| | | UnsuppSRTPAuthTag = 0x54, | |
| | | UnsuppSASScheme = 0x55, | |
| | | DHErrorWrongPV = 0x61, | |
| | | DHErrorWrongHVI = 0x62, | |
| | | ConfirmHMACWrong = 0x70, | |
| | | NonceReused = 0x80, | |
| | | EqualZIDHello = 0x90 | |
| | | }; | |
| | | | |
| class ZrtpStateClass; | | class ZrtpStateClass; | |
| class ZrtpDH; | | class ZrtpDH; | |
| | | | |
| /** | | /** | |
| * The main ZRTP class. | | * The main ZRTP class. | |
| * | | * | |
| * This contains the whole ZRTP implementation. It handles the ZRTP | | * This contains the whole ZRTP implementation. It handles the ZRTP | |
| * HMAC, DH, and other data management. The user of this class needs | | * HMAC, DH, and other data management. The user of this class needs | |
| * to know only a few methods and needs to provide only a few external | | * to know only a few methods and needs to provide only a few external | |
| * functions to connect to a Timer mechanism and to send data via RTP | | * functions to connect to a Timer mechanism and to send data via RTP | |
| | | | |
| skipping to change at line 111 | | skipping to change at line 130 | |
| * packet. If this check fails the method returns 0 (false) in | | * packet. If this check fails the method returns 0 (false) in | |
| * case this is not a ZRTP packet. We return a 1 if we processed | | * case this is not a ZRTP packet. We return a 1 if we processed | |
| * the ZRTP extension header and the caller may process RTP data | | * the ZRTP extension header and the caller may process RTP data | |
| * after the extension header as usual. The method return -1 the | | * after the extension header as usual. The method return -1 the | |
| * call shall dismiss the packet and shall not forward it to | | * call shall dismiss the packet and shall not forward it to | |
| * further RTP processing. | | * further RTP processing. | |
| * | | * | |
| * @param extHeader | | * @param extHeader | |
| * A pointer to the first byte of the extension header. Refer to | | * A pointer to the first byte of the extension header. Refer to | |
| * RFC3550. | | * RFC3550. | |
|
| * @param content | | | |
| * Pointer to the content of the received packet. Required for | | | |
| * Confirm handling. | | | |
| * @return | | * @return | |
| * Code indicating further packet handling, see description above
. | | * Code indicating further packet handling, see description above
. | |
| */ | | */ | |
|
| int32_t processExtensionHeader(uint8_t *extHeader, uint8_t* content)
; | | int32_t processZrtpMessage(uint8_t *extHeader); | |
| | | | |
| /** | | /** | |
| * Process a timeout event. | | * Process a timeout event. | |
| * | | * | |
| * We got a timeout from the timeout provider. Forward it to the | | * We got a timeout from the timeout provider. Forward it to the | |
| * protocol state engine. | | * protocol state engine. | |
| * | | * | |
| */ | | */ | |
| int32_t processTimeout(); | | int32_t processTimeout(); | |
| | | | |
| | | | |
| skipping to change at line 216 | | skipping to change at line 232 | |
| * remembers this together with the retained secrets data. | | * remembers this together with the retained secrets data. | |
| */ | | */ | |
| void SASVerified(); | | void SASVerified(); | |
| | | | |
| /** | | /** | |
| * Reset the SAS verfied flag for the current active user's retained
secrets. | | * Reset the SAS verfied flag for the current active user's retained
secrets. | |
| * | | * | |
| */ | | */ | |
| void resetSASVerified(); | | void resetSASVerified(); | |
| | | | |
|
| int Zfone; | | | |
| | | | |
| private: | | private: | |
| friend class ZrtpStateClass; | | friend class ZrtpStateClass; | |
| | | | |
| /** | | /** | |
| * The state engine takes care of protocol processing. | | * The state engine takes care of protocol processing. | |
| */ | | */ | |
| ZrtpStateClass* stateEngine; | | ZrtpStateClass* stateEngine; | |
| | | | |
| /** | | /** | |
| * This is my ZID that I send to the peer. | | * This is my ZID that I send to the peer. | |
| | | | |
| skipping to change at line 255 | | skipping to change at line 269 | |
| ZrtpDH* dhContext; | | ZrtpDH* dhContext; | |
| | | | |
| /** | | /** | |
| * The computed DH shared secret | | * The computed DH shared secret | |
| */ | | */ | |
| uint8_t* DHss; | | uint8_t* DHss; | |
| | | | |
| /** | | /** | |
| * My computed public key | | * My computed public key | |
| */ | | */ | |
|
| uint8_t* pubKeyBytes; | | uint8_t pubKeyBytes[1024]; | |
| /** | | /** | |
| * Length off public key | | * Length off public key | |
| */ | | */ | |
| int32_t pubKeyLen; | | int32_t pubKeyLen; | |
| /** | | /** | |
| * My Role in the game | | * My Role in the game | |
| */ | | */ | |
| Role myRole; | | Role myRole; | |
| | | | |
| /** | | /** | |
|
| * The SAS value | | * The human readable SAS value | |
| */ | | */ | |
| std::string SAS; | | std::string SAS; | |
| | | | |
| /** | | /** | |
|
| | | * The SAS value for signaling and alike | |
| | | */ | |
| | | uint8_t sasValue[8]; | |
| | | /** | |
| * The variables for the retained shared secrets | | * The variables for the retained shared secrets | |
| */ | | */ | |
| uint8_t rs1IDr[SHA256_DIGEST_LENGTH]; | | uint8_t rs1IDr[SHA256_DIGEST_LENGTH]; | |
| uint8_t rs2IDr[SHA256_DIGEST_LENGTH]; | | uint8_t rs2IDr[SHA256_DIGEST_LENGTH]; | |
| uint8_t sigsIDr[SHA256_DIGEST_LENGTH]; | | uint8_t sigsIDr[SHA256_DIGEST_LENGTH]; | |
| uint8_t srtpsIDr[SHA256_DIGEST_LENGTH]; | | uint8_t srtpsIDr[SHA256_DIGEST_LENGTH]; | |
| uint8_t otherSecretIDr[SHA256_DIGEST_LENGTH]; | | uint8_t otherSecretIDr[SHA256_DIGEST_LENGTH]; | |
| | | | |
| uint8_t rs1IDi[SHA256_DIGEST_LENGTH]; | | uint8_t rs1IDi[SHA256_DIGEST_LENGTH]; | |
| uint8_t rs2IDi[SHA256_DIGEST_LENGTH]; | | uint8_t rs2IDi[SHA256_DIGEST_LENGTH]; | |
| | | | |
| skipping to change at line 294 | | skipping to change at line 312 | |
| /** | | /** | |
| * My hvi | | * My hvi | |
| */ | | */ | |
| uint8_t hvi[SHA256_DIGEST_LENGTH]; | | uint8_t hvi[SHA256_DIGEST_LENGTH]; | |
| | | | |
| /** | | /** | |
| * The peer's hvi | | * The peer's hvi | |
| */ | | */ | |
| uint8_t peerHvi[SHA256_DIGEST_LENGTH]; | | uint8_t peerHvi[SHA256_DIGEST_LENGTH]; | |
| | | | |
|
| | | void* msgShaContext; | |
| /** | | /** | |
| * Commited Hash, Cipher, and public key algorithms | | * Commited Hash, Cipher, and public key algorithms | |
| */ | | */ | |
| SupportedHashes hash; | | SupportedHashes hash; | |
| SupportedSymCiphers cipher; | | SupportedSymCiphers cipher; | |
| SupportedPubKeys pubKey; | | SupportedPubKeys pubKey; | |
| /** | | /** | |
| * The selected SAS type. | | * The selected SAS type. | |
| */ | | */ | |
| SupportedSASTypes sasType; | | SupportedSASTypes sasType; | |
| | | | |
| /** | | /** | |
| * The selected SAS type. | | * The selected SAS type. | |
| */ | | */ | |
| SupportedAuthLengths authLength; | | SupportedAuthLengths authLength; | |
| /** | | /** | |
|
| | | * The SHA256 hash over selected messages | |
| | | */ | |
| | | uint8_t messageHash[SHA256_DIGEST_LENGTH]; | |
| | | /** | |
| * The s0 | | * The s0 | |
| */ | | */ | |
| uint8_t s0[SHA256_DIGEST_LENGTH]; | | uint8_t s0[SHA256_DIGEST_LENGTH]; | |
| | | | |
| /** | | /** | |
| * The new Retained Secret | | * The new Retained Secret | |
| */ | | */ | |
| uint8_t newRs1[RS_LENGTH]; | | uint8_t newRs1[RS_LENGTH]; | |
| | | | |
| /** | | /** | |
|
| * The HMAC key | | * The GoClear HMAC keys and confirm HMAC key | |
| */ | | */ | |
|
| uint8_t hmacSrtp[SHA256_DIGEST_LENGTH]; | | uint8_t hmacKeyI[SHA256_DIGEST_LENGTH]; | |
| | | uint8_t hmacKeyR[SHA256_DIGEST_LENGTH]; | |
| | | | |
| /** | | /** | |
| * The Initiator's srtp key and salt | | * The Initiator's srtp key and salt | |
| */ | | */ | |
| uint8_t srtpKeyI[SHA256_DIGEST_LENGTH]; | | uint8_t srtpKeyI[SHA256_DIGEST_LENGTH]; | |
| uint8_t srtpSaltI[SHA256_DIGEST_LENGTH]; | | uint8_t srtpSaltI[SHA256_DIGEST_LENGTH]; | |
| | | | |
| /** | | /** | |
| * The Responder's srtp key and salt | | * The Responder's srtp key and salt | |
| */ | | */ | |
| uint8_t srtpKeyR[SHA256_DIGEST_LENGTH]; | | uint8_t srtpKeyR[SHA256_DIGEST_LENGTH]; | |
| uint8_t srtpSaltR[SHA256_DIGEST_LENGTH]; | | uint8_t srtpSaltR[SHA256_DIGEST_LENGTH]; | |
| | | | |
| /** | | /** | |
|
| * Pre-initialized packets to start off the whole game. | | * The keys used to encrypt/decrypt the confirm message | |
| | | */ | |
| | | uint8_t zrtpKeyI[SHA256_DIGEST_LENGTH]; | |
| | | uint8_t zrtpKeyR[SHA256_DIGEST_LENGTH]; | |
| | | | |
| | | /** | |
| | | * Pre-initialized packets. | |
| */ | | */ | |
|
| ZrtpPacketHello* zrtpHello; | | ZrtpPacketHello zrtpHello; | |
| ZrtpPacketHelloAck* zrtpHelloAck; | | ZrtpPacketHelloAck zrtpHelloAck; | |
| ZrtpPacketConf2Ack* zrtpConf2Ack; | | ZrtpPacketConf2Ack zrtpConf2Ack; | |
| | | ZrtpPacketClearAck zrtpClearAck; | |
| | | ZrtpPacketGoClear zrtpGoClear; | |
| | | ZrtpPacketError zrtpError; | |
| | | ZrtpPacketErrorAck zrtpErrorAck; | |
| | | | |
| /** | | /** | |
|
| | | * Holds a pre-computed DHPart2 packet. Required to compute HVI | |
| | | */ | |
| | | ZrtpPacketDHPart* zpDH2; | |
| | | | |
| | | /** | |
| | | * Random IV data to encrypt the confirm data, 128 bit for AES | |
| | | */ | |
| | | uint8_t randomIV[16]; | |
| | | /** | |
| * Find the best Hash algorithm that was offered in Hello. | | * Find the best Hash algorithm that was offered in Hello. | |
| * | | * | |
| * Find the best, that is the strongest, Hash algorithm that our peer | | * Find the best, that is the strongest, Hash algorithm that our peer | |
| * offers in its Hello packet. | | * offers in its Hello packet. | |
| * | | * | |
| * @param hello | | * @param hello | |
| * The Hello packet. | | * The Hello packet. | |
| * @return | | * @return | |
| * The Enum that identifies the best offered Hash algortihm. Return | | * The Enum that identifies the best offered Hash algortihm. Return | |
| * <code>NumSupportedHashes</code> to signal that no matching Hash a
lgorithm | | * <code>NumSupportedHashes</code> to signal that no matching Hash a
lgorithm | |
| | | | |
| skipping to change at line 421 | | skipping to change at line 464 | |
| * @return | | * @return | |
| * The Enum that identifies the best offered authentication length.
Return | | * The Enum that identifies the best offered authentication length.
Return | |
| * <code>NumSupportedAuthLenghts</code> to signal that no matching l
ength | | * <code>NumSupportedAuthLenghts</code> to signal that no matching l
ength | |
| * was found at all. | | * was found at all. | |
| */ | | */ | |
| SupportedAuthLengths findBestAuthLen(ZrtpPacketHello *hello); | | SupportedAuthLengths findBestAuthLen(ZrtpPacketHello *hello); | |
| | | | |
| /** | | /** | |
| * Compute my hvi value according to ZRTP specification. | | * Compute my hvi value according to ZRTP specification. | |
| */ | | */ | |
|
| void computeHvi(uint8_t *pv, uint32_t pvLength, ZrtpPacketHello *hello)
; | | void computeHvi(ZrtpPacketDHPart* dh, ZrtpPacketHello *hello); | |
| | | | |
| void computeSharedSecretSet(ZIDRecord& zidRec); | | void computeSharedSecretSet(ZIDRecord& zidRec); | |
| | | | |
| void computeSRTPKeys(); | | void computeSRTPKeys(); | |
| | | | |
| void generateS0Initiator(ZrtpPacketDHPart *dhPart, ZIDRecord& zidRec); | | void generateS0Initiator(ZrtpPacketDHPart *dhPart, ZIDRecord& zidRec); | |
| | | | |
| void generateS0Responder(ZrtpPacketDHPart *dhPart, ZIDRecord& zidRec); | | void generateS0Responder(ZrtpPacketDHPart *dhPart, ZIDRecord& zidRec); | |
| | | | |
| /* | | /* | |
| | | | |
| skipping to change at line 447 | | skipping to change at line 490 | |
| * Send a ZRTP packet. | | * Send a ZRTP packet. | |
| * | | * | |
| * The state engines calls this method to send a packet via the RTP | | * The state engines calls this method to send a packet via the RTP | |
| * stack. | | * stack. | |
| * | | * | |
| * @param packet | | * @param packet | |
| * Points to the ZRTP packet. | | * Points to the ZRTP packet. | |
| * @return | | * @return | |
| * zero if sending failed, one if packet was send | | * zero if sending failed, one if packet was send | |
| */ | | */ | |
|
| int32_t sendPacketRTP(ZrtpPacketBase *packet); | | int32_t sendPacketZRTP(ZrtpPacketBase *packet); | |
| | | | |
| /** | | /** | |
| * Send a ZRTP packet using SRTP. | | * Send a ZRTP packet using SRTP. | |
| * | | * | |
| * The state engines calls this method to send a packet via the SRTP | | * The state engines calls this method to send a packet via the SRTP | |
| * stack. | | * stack. | |
| * | | * | |
| * @param packet | | * @param packet | |
| * Points to the ZRTP packet. | | * Points to the ZRTP packet. | |
| * @return | | * @return | |
| * zero if sending failed, one if packet was send | | * zero if sending failed, one if packet was send | |
|
| */ | | * | |
| int32_t sendPacketSRTP(ZrtpPacketBase *packet); | | int32_t sendPacketSRTP(ZrtpPacketBase *packet); | |
|
| | | */ | |
| /** | | /** | |
| * Activate a Timer using the host callback. | | * Activate a Timer using the host callback. | |
| * | | * | |
| * @param tm | | * @param tm | |
| * The time in milliseconds. | | * The time in milliseconds. | |
| * @return | | * @return | |
| * zero if activation failed, one if timer was activated | | * zero if activation failed, one if timer was activated | |
| */ | | */ | |
| int32_t activateTimer(int32_t tm) {return (callback->activateTimer(tm))
; } | | int32_t activateTimer(int32_t tm) {return (callback->activateTimer(tm))
; } | |
| | | | |
| | | | |
| skipping to change at line 489 | | skipping to change at line 532 | |
| | | | |
| /** | | /** | |
| * Prepare a Hello packet. | | * Prepare a Hello packet. | |
| * | | * | |
| * Just take the preinitialized Hello packet and return it. No | | * Just take the preinitialized Hello packet and return it. No | |
| * further processing required. | | * further processing required. | |
| * | | * | |
| * @return | | * @return | |
| * A pointer to the initialized Hello packet. | | * A pointer to the initialized Hello packet. | |
| */ | | */ | |
|
| ZrtpPacketHello *prepareHello() {return zrtpHello; } | | ZrtpPacketHello *prepareHello() {return &zrtpHello; } | |
| | | | |
| /** | | /** | |
| * Prepare a HelloAck packet. | | * Prepare a HelloAck packet. | |
| * | | * | |
| * Just take the preinitialized HelloAck packet and return it. No | | * Just take the preinitialized HelloAck packet and return it. No | |
| * further processing required. | | * further processing required. | |
| * | | * | |
| * @return | | * @return | |
| * A pointer to the initialized HelloAck packet. | | * A pointer to the initialized HelloAck packet. | |
| */ | | */ | |
|
| ZrtpPacketHelloAck *prepareHelloAck(ZrtpPacketHello *hello) { | | ZrtpPacketHelloAck *prepareHelloAck() { | |
| uint8_t* cid = hello->getClientId(); | | return &zrtpHelloAck; | |
| if (*cid == 'Z') { | | | |
| Zfone = 1; | | | |
| } | | | |
| return zrtpHelloAck; | | | |
| } | | } | |
| | | | |
| /** | | /** | |
| * Prepare a Commit packet. | | * Prepare a Commit packet. | |
| * | | * | |
| * We have received a Hello packet from our peer. Check the offers | | * We have received a Hello packet from our peer. Check the offers | |
| * it makes to us and select the most appropriate. Using the | | * it makes to us and select the most appropriate. Using the | |
| * selected values prepare a Commit packet and return it to protocol | | * selected values prepare a Commit packet and return it to protocol | |
| * state engine. | | * state engine. | |
| * | | * | |
| * @param hello | | * @param hello | |
| * Points to the received Hello packet | | * Points to the received Hello packet | |
| * @return | | * @return | |
| * A pointer to the prepared Commit packet | | * A pointer to the prepared Commit packet | |
| */ | | */ | |
|
| ZrtpPacketCommit *prepareCommit(ZrtpPacketHello *hello); | | ZrtpPacketCommit *prepareCommit(ZrtpPacketHello *hello, uint32_t* errMs
g); | |
| | | | |
| /** | | /** | |
| * Prepare the DHPart1 packet. | | * Prepare the DHPart1 packet. | |
| * | | * | |
| * This method prepares a DHPart1 packet. The input to the method is al
ways | | * This method prepares a DHPart1 packet. The input to the method is al
ways | |
| * a Commit packet received from the peer. Also we a in the role of the | | * a Commit packet received from the peer. Also we a in the role of the | |
| * Responder. | | * Responder. | |
| * | | * | |
| * When we receive a Commit packet we get the selected ciphers, hashes,
etc | | * When we receive a Commit packet we get the selected ciphers, hashes,
etc | |
| * and cross-check if this is ok. Then we need to initialize a set of D
H | | * and cross-check if this is ok. Then we need to initialize a set of D
H | |
| * keys according to the selected cipher. Using this data we prepare ou
r DHPart1 | | * keys according to the selected cipher. Using this data we prepare ou
r DHPart1 | |
| * packet. | | * packet. | |
| */ | | */ | |
|
| ZrtpPacketDHPart *prepareDHPart1(ZrtpPacketCommit *commit); | | ZrtpPacketDHPart *prepareDHPart1(ZrtpPacketCommit *commit, uint32_t* er
rMsg); | |
| | | | |
| /** | | /** | |
| * Prepare the DHPart2 packet. | | * Prepare the DHPart2 packet. | |
| * | | * | |
| * This method prepares a DHPart2 packet. The input to the method is al
ways | | * This method prepares a DHPart2 packet. The input to the method is al
ways | |
| * a DHPart1 packet received from the peer. Our peer sends the DH1Part
as | | * a DHPart1 packet received from the peer. Our peer sends the DH1Part
as | |
| * response to our Commit packet. Thus we are in the role of the | | * response to our Commit packet. Thus we are in the role of the | |
| * Initiator. | | * Initiator. | |
| * | | * | |
| */ | | */ | |
|
| ZrtpPacketDHPart *prepareDHPart2(ZrtpPacketDHPart *dhPart1); | | ZrtpPacketDHPart *prepareDHPart2(ZrtpPacketDHPart* dhPart1, uint32_t* e
rrMsg); | |
| | | | |
| /** | | /** | |
| * Prepare the Confirm1 packet. | | * Prepare the Confirm1 packet. | |
| * | | * | |
| * This method prepare the Confirm1 packet. The input to this method is
the | | * This method prepare the Confirm1 packet. The input to this method is
the | |
| * DHPart2 packect received from our peer. The peer sends the DHPart2 p
acket | | * DHPart2 packect received from our peer. The peer sends the DHPart2 p
acket | |
| * as response of our DHPart1. Here we are in the role of the Responder | | * as response of our DHPart1. Here we are in the role of the Responder | |
| * | | * | |
| */ | | */ | |
|
| ZrtpPacketConfirm *prepareConfirm1(ZrtpPacketDHPart *dhPart2); | | ZrtpPacketConfirm *prepareConfirm1(ZrtpPacketDHPart* dhPart2, uint32_t*
errMsg); | |
| | | | |
| /** | | /** | |
| * Prepare the Confirm2 packet. | | * Prepare the Confirm2 packet. | |
| * | | * | |
| * This method prepare the Confirm2 packet. The input to this method is
the | | * This method prepare the Confirm2 packet. The input to this method is
the | |
| * Confirm1 packet received from our peer. The peer sends the Confirm1
packet | | * Confirm1 packet received from our peer. The peer sends the Confirm1
packet | |
| * as response of our DHPart2. Here we are in the role of the Initiator | | * as response of our DHPart2. Here we are in the role of the Initiator | |
| */ | | */ | |
|
| ZrtpPacketConfirm* prepareConfirm2(ZrtpPacketConfirm *confirm1); | | ZrtpPacketConfirm* prepareConfirm2(ZrtpPacketConfirm* confirm1, uint32_
t* errMsg); | |
| | | | |
| /** | | /** | |
| * Prepare the Conf2Ack packet. | | * Prepare the Conf2Ack packet. | |
| * | | * | |
| * This method prepare the Conf2Ack packet. The input to this method is
the | | * This method prepare the Conf2Ack packet. The input to this method is
the | |
| * Confirm2 packet received from our peer. The peer sends the Confirm2
packet | | * Confirm2 packet received from our peer. The peer sends the Confirm2
packet | |
| * as response of our Confirm1. Here we are in the role of the Initiato
r | | * as response of our Confirm1. Here we are in the role of the Initiato
r | |
| */ | | */ | |
|
| ZrtpPacketConf2Ack* prepareConf2Ack(ZrtpPacketConfirm *confirm2); | | ZrtpPacketConf2Ack* prepareConf2Ack(ZrtpPacketConfirm* confirm2, uint32 | |
| | | _t* errMsg); | |
| | | | |
| | | /** | |
| | | * Prepare the ErrorAck packet. | |
| | | * | |
| | | * This method prepares the ErrorAck packet. The input to this method i | |
| | | s the | |
| | | * Error packet received from the peer. | |
| | | */ | |
| | | ZrtpPacketErrorAck* prepareErrorAck(ZrtpPacketError* epkt); | |
| | | | |
| | | /** | |
| | | * Prepare the Error packet. | |
| | | * | |
| | | * This method prepares the Error packet. The input to this method is t | |
| | | he | |
| | | * error code to be included into the message. | |
| | | */ | |
| | | ZrtpPacketError* prepareError(uint32_t errMsg); | |
| | | | |
| /** | | /** | |
| * Prepare a ClearAck packet. | | * Prepare a ClearAck packet. | |
| * | | * | |
| * This method checks if the GoClear message is valid. If yes then swit
ch | | * This method checks if the GoClear message is valid. If yes then swit
ch | |
| * off SRTP processing, stop sending of RTP packets (pause transmit) an
d | | * off SRTP processing, stop sending of RTP packets (pause transmit) an
d | |
| * inform the user about the fact. Only if user confirms the GoClear me
ssage | | * inform the user about the fact. Only if user confirms the GoClear me
ssage | |
| * normal RTP processing is resumed. | | * normal RTP processing is resumed. | |
| * | | * | |
| * @return | | * @return | |
| * NULL if GoClear could not be authenticated, a ClearAck packet | | * NULL if GoClear could not be authenticated, a ClearAck packet | |
| * otherwise. | | * otherwise. | |
| */ | | */ | |
| ZrtpPacketClearAck* prepareClearAck(ZrtpPacketGoClear* gpkt); | | ZrtpPacketClearAck* prepareClearAck(ZrtpPacketGoClear* gpkt); | |
| | | | |
| /** | | /** | |
|
| | | * Prepare a GoClearAck packet w/o HMAC | |
| | | * | |
| | | * Prepare a GoCLear packet without a HMAC but with a short error messa | |
| | | ge. | |
| | | * This type of GoClear is used if something went wrong during the ZRTP | |
| | | * negotiation phase. | |
| | | * | |
| | | * @return | |
| | | * A goClear packet without HMAC | |
| | | */ | |
| | | ZrtpPacketGoClear* prepareGoClear(uint32_t errMsg = 0); | |
| | | | |
| | | /** | |
| * Compare the hvi values. | | * Compare the hvi values. | |
| * | | * | |
| * Compares the hvi hashes of both commit packets, the one we just | | * Compares the hvi hashes of both commit packets, the one we just | |
| * received and the one we sent in response of peer's hello. The | | * received and the one we sent in response of peer's hello. The | |
| * outcome of the compare determines which peer is Initiator or | | * outcome of the compare determines which peer is Initiator or | |
| * Responder. If the hvi of the commit we sent is smaller then we are | | * Responder. If the hvi of the commit we sent is smaller then we are | |
| * Responder, otherwise we are Inititiator. | | * Responder, otherwise we are Inititiator. | |
| * | | * | |
| * @param commit | | * @param commit | |
| * Pointer to the peer's commit packet we just received. | | * Pointer to the peer's commit packet we just received. | |
| | | | |
| skipping to change at line 660 | | skipping to change at line 727 | |
| } | | } | |
| | | | |
| /** | | /** | |
| * Signal SRTP secrets are ready. | | * Signal SRTP secrets are ready. | |
| * | | * | |
| * This method calls a callback method to inform the host that the SRTP | | * This method calls a callback method to inform the host that the SRTP | |
| * secrets are ready. | | * secrets are ready. | |
| * | | * | |
| * @param part | | * @param part | |
| * Defines for which part (sender or receiver) to switch on security | | * Defines for which part (sender or receiver) to switch on security | |
|
| | | * @return | |
| | | * Returns false if something went wrong during initialization of SR | |
| | | TP | |
| | | * context. Propagate error back to state engine. | |
| */ | | */ | |
|
| void srtpSecretsReady(EnableSecurity part); | | bool srtpSecretsReady(EnableSecurity part); | |
| | | | |
| /** | | /** | |
| * Switch off SRTP secrets. | | * Switch off SRTP secrets. | |
| * | | * | |
| * This method calls a callback method to inform the host that the SRTP | | * This method calls a callback method to inform the host that the SRTP | |
| * secrets shall be cleared. | | * secrets shall be cleared. | |
| * | | * | |
| * @param part | | * @param part | |
| * Defines for which part (sender or receiver) to clear | | * Defines for which part (sender or receiver) to clear | |
| */ | | */ | |
| | | | |
End of changes. 34 change blocks. |
| 38 lines changed or deleted | | 113 lines changed or added | |
|
| ZrtpCallback.h | | ZrtpCallback.h | |
| /* | | /* | |
|
| Copyright (C) 2006 Werner Dittmann | | Copyright (C) 2006-2007 Werner Dittmann | |
| | | | |
|
| This program is free software; you can redistribute it and/or modify | | This program is free software: you can redistribute it and/or modify | |
| it under the terms of the GNU General Public License as published by | | it under the terms of the GNU General Public License as published by | |
|
| the Free Software Foundation; either version 2, or (at your option) | | the Free Software Foundation, either version 3 of the License, or | |
| any later version. | | (at your option) any later version. | |
| | | | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| GNU General Public License for more details. | | GNU General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU General Public License | | You should have received a copy of the GNU General Public License | |
|
| along with this program; if not, write to the Free Software | | along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| Foundation, Inc., 59 Temple Place, Boston, MA 02111. | | | |
| */ | | */ | |
| | | | |
| #ifndef _ZRTPCALLBACK_H_ | | #ifndef _ZRTPCALLBACK_H_ | |
| #define _ZRTPCALLBACK_H_ | | #define _ZRTPCALLBACK_H_ | |
| | | | |
| #include <string> | | #include <string> | |
| #include <libzrtpcpp/ZrtpPacketBase.h> | | #include <libzrtpcpp/ZrtpPacketBase.h> | |
| | | | |
| /** | | /** | |
| * This class defines the callback functions required by ZRTP. | | * This class defines the callback functions required by ZRTP. | |
| | | | |
| skipping to change at line 140 | | skipping to change at line 139 | |
| * ZRTP call this method if it needs to send data via RTP. The | | * ZRTP call this method if it needs to send data via RTP. The | |
| * data must not be encrypted before transfer. | | * data must not be encrypted before transfer. | |
| * | | * | |
| * @param data | | * @param data | |
| * Points to ZRTP packet to send as RTP extension header. | | * Points to ZRTP packet to send as RTP extension header. | |
| * @param length | | * @param length | |
| * The length in bytes of the data | | * The length in bytes of the data | |
| * @return | | * @return | |
| * zero if sending failed, one if packet was send | | * zero if sending failed, one if packet was send | |
| */ | | */ | |
|
| virtual int32_t sendDataRTP(const uint8_t* data, int32_t length) =0; | | virtual int32_t sendDataZRTP(const uint8_t* data, int32_t length) =0; | |
| | | | |
| /** | | | |
| * Send a ZRTP packet via SRTP. | | | |
| * | | | |
| * ZRTP call this method if it needs to send data via SRTP. The | | | |
| * data must be encrypted before transfer. | | | |
| * | | | |
| * @param dataHeader | | | |
| * Points to ZRTP packet to send as RTP extension header | | | |
| * @param lengthHeader | | | |
| * The length in bytes of the header data | | | |
| * @param dataContent | | | |
| * Points to the data to send as SRTP packet content. | | | |
| * @param lengthConten | | | |
| * The length in bytes of the content data | | | |
| * @return | | | |
| * zero if sending failed, one if packet was send | | | |
| */ | | | |
| virtual int32_t sendDataSRTP(const uint8_t* dataHeader, int32_t lengthH | | | |
| eader, | | | |
| char* dataContent, int32_t lengthContent) = | | | |
| 0; | | | |
| | | | |
| /** | | /** | |
| * Activate timer. | | * Activate timer. | |
| * | | * | |
| * @param time | | * @param time | |
| * The time in ms for the timer | | * The time in ms for the timer | |
| * @return | | * @return | |
| * zero if activation failed, one if timer was activated | | * zero if activation failed, one if timer was activated | |
| */ | | */ | |
| virtual int32_t activateTimer(int32_t time) =0; | | virtual int32_t activateTimer(int32_t time) =0; | |
| | | | |
| skipping to change at line 217 | | skipping to change at line 196 | |
| * | | * | |
| * The SRTP secrets themselfs are ontained in the ZRtp object and | | * The SRTP secrets themselfs are ontained in the ZRtp object and | |
| * are valid as long as the ZRtp object is active. TheZRtp's | | * are valid as long as the ZRtp object is active. TheZRtp's | |
| * destructor clears the secrets. | | * destructor clears the secrets. | |
| * | | * | |
| * @param secrets | | * @param secrets | |
| * A pointer to a SrtpSecret_t structure that contains all necessar
y | | * A pointer to a SrtpSecret_t structure that contains all necessar
y | |
| * data. | | * data. | |
| * @param part | | * @param part | |
| * Defines for which part (sender or receiver) to switch on security | | * Defines for which part (sender or receiver) to switch on security | |
|
| | | * @return | |
| | | * Returns false if something went wrong during initialization of SR | |
| | | TP | |
| | | * context, for example memory shortage. | |
| */ | | */ | |
|
| virtual void srtpSecretsReady(SrtpSecret_t* secrets, EnableSecurity par
t) =0; | | virtual bool srtpSecretsReady(SrtpSecret_t* secrets, EnableSecurity par
t) =0; | |
| | | | |
| /** | | /** | |
| * This method shall clear the SRTP Context and switch off GUI inidicat
ors. | | * This method shall clear the SRTP Context and switch off GUI inidicat
ors. | |
| * | | * | |
| * @param part | | * @param part | |
| * Defines for which part (sender or receiver) to switch on security | | * Defines for which part (sender or receiver) to switch on security | |
| */ | | */ | |
| virtual void srtpSecretsOff(EnableSecurity part) =0; | | virtual void srtpSecretsOff(EnableSecurity part) =0; | |
| | | | |
| /** | | /** | |
| | | | |
End of changes. 7 change blocks. |
| 30 lines changed or deleted | | 11 lines changed or added | |
|
| ZrtpPacketCommit.h | | ZrtpPacketCommit.h | |
| /* | | /* | |
|
| Copyright (C) 2006 Werner Dittmann | | Copyright (C) 2006-2007 Werner Dittmann | |
| | | | |
|
| This program is free software; you can redistribute it and/or modify | | This program is free software: you can redistribute it and/or modify | |
| it under the terms of the GNU General Public License as published by | | it under the terms of the GNU General Public License as published by | |
|
| the Free Software Foundation; either version 2, or (at your option) | | the Free Software Foundation, either version 3 of the License, or | |
| any later version. | | (at your option) any later version. | |
| | | | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| GNU General Public License for more details. | | GNU General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU General Public License | | You should have received a copy of the GNU General Public License | |
|
| along with this program; if not, write to the Free Software | | along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| Foundation, Inc., 59 Temple Place, Boston, MA 02111. | | | |
| */ | | */ | |
| | | | |
| /* | | /* | |
| * Authors: Werner Dittmann <Werner.Dittmann@t-online.de> | | * Authors: Werner Dittmann <Werner.Dittmann@t-online.de> | |
| */ | | */ | |
| #ifndef _ZRTPPACKETCOMMIT_H_ | | #ifndef _ZRTPPACKETCOMMIT_H_ | |
| #define _ZRTPPACKETCOMMIT_H_ | | #define _ZRTPPACKETCOMMIT_H_ | |
| | | | |
| #include <libzrtpcpp/ZrtpPacketBase.h> | | #include <libzrtpcpp/ZrtpPacketBase.h> | |
| | | | |
| | | | |
| skipping to change at line 56 | | skipping to change at line 55 | |
| virtual ~ZrtpPacketCommit(); | | virtual ~ZrtpPacketCommit(); | |
| | | | |
| uint8_t* getHashType() { return commitHeader->hash; }; | | uint8_t* getHashType() { return commitHeader->hash; }; | |
| uint8_t* getCipherType() { return commitHeader->cipher; }; | | uint8_t* getCipherType() { return commitHeader->cipher; }; | |
| uint8_t* getAuthLen() { return commitHeader->authlengths; }; | | uint8_t* getAuthLen() { return commitHeader->authlengths; }; | |
| uint8_t* getPubKeysType() { return commitHeader->pubkey; }; | | uint8_t* getPubKeysType() { return commitHeader->pubkey; }; | |
| uint8_t* getSasType() { return commitHeader->sas; }; | | uint8_t* getSasType() { return commitHeader->sas; }; | |
| uint8_t* getZid() { return commitHeader->zid; }; | | uint8_t* getZid() { return commitHeader->zid; }; | |
| uint8_t* getHvi() { return commitHeader->hvi; }; | | uint8_t* getHvi() { return commitHeader->hvi; }; | |
| | | | |
|
| void setHashType(uint8_t* text) { memcpy(commitHeader->hash, text, 8 | | void setHashType(uint8_t* text) { memcpy(commitHeader->hash, text, Z | |
| ); }; | | RTP_WORD_SIZE); }; | |
| void setCipherType(uint8_t* text) { memcpy(commitHeader->cipher, text, | | void setCipherType(uint8_t* text) { memcpy(commitHeader->cipher, text, | |
| 8); }; | | ZRTP_WORD_SIZE); }; | |
| void setAuthLen(uint8_t* text) { memcpy(commitHeader->authlengths, | | void setAuthLen(uint8_t* text) { memcpy(commitHeader->authlengths, | |
| text, 8); }; | | text, ZRTP_WORD_SIZE); }; | |
| void setPubKeyType(uint8_t* text) { memcpy(commitHeader->pubkey, text, | | void setPubKeyType(uint8_t* text) { memcpy(commitHeader->pubkey, text, | |
| 8); }; | | ZRTP_WORD_SIZE); }; | |
| void setSasType(uint8_t* text) { memcpy(commitHeader->sas, text, 8) | | void setSasType(uint8_t* text) { memcpy(commitHeader->sas, text, ZR | |
| ; }; | | TP_WORD_SIZE); }; | |
| void setZid(uint8_t* text) { memcpy(commitHeader->zid, text, 12 | | void setZid(uint8_t* text) { memcpy(commitHeader->zid, text, si | |
| ); }; | | zeof(commitHeader->zid)); }; | |
| void setHvi(uint8_t* text) { memcpy(commitHeader->hvi, text, 32 | | void setHvi(uint8_t* text) { memcpy(commitHeader->hvi, text, si | |
| ); }; | | zeof(commitHeader->hvi)); }; | |
| | | | |
| private: | | private: | |
|
| | | CommitPacket_t data; | |
| }; | | }; | |
| | | | |
| #endif // ZRTPPACKETCOMMIT | | #endif // ZRTPPACKETCOMMIT | |
| | | | |
End of changes. 6 change blocks. |
| 20 lines changed or deleted | | 21 lines changed or added | |
|
| ZrtpPacketConfirm.h | | ZrtpPacketConfirm.h | |
| /* | | /* | |
|
| Copyright (C) 2006 Werner Dittmann | | Copyright (C) 2006-2007 Werner Dittmann | |
| | | | |
|
| This program is free software; you can redistribute it and/or modify | | This program is free software: you can redistribute it and/or modify | |
| it under the terms of the GNU General Public License as published by | | it under the terms of the GNU General Public License as published by | |
|
| the Free Software Foundation; either version 2, or (at your option) | | the Free Software Foundation, either version 3 of the License, or | |
| any later version. | | (at your option) any later version. | |
| | | | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| GNU General Public License for more details. | | GNU General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU General Public License | | You should have received a copy of the GNU General Public License | |
|
| along with this program; if not, write to the Free Software | | along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| Foundation, Inc., 59 Temple Place, Boston, MA 02111. | | | |
| */ | | */ | |
| | | | |
| #ifndef _ZRTPPACKETCONFIRM_H_ | | #ifndef _ZRTPPACKETCONFIRM_H_ | |
| #define _ZRTPPACKETCONFIRM_H_ | | #define _ZRTPPACKETCONFIRM_H_ | |
| | | | |
| #include <libzrtpcpp/ZrtpPacketBase.h> | | #include <libzrtpcpp/ZrtpPacketBase.h> | |
| | | | |
| /** | | /** | |
| * Implement the Confirm packet. | | * Implement the Confirm packet. | |
| * | | * | |
| | | | |
| skipping to change at line 38 | | skipping to change at line 37 | |
| * to confirm the switch to SRTP (encrypted) mode. The contents of | | * to confirm the switch to SRTP (encrypted) mode. The contents of | |
| * the Confirm message are encrypted, thus the implementation can | | * the Confirm message are encrypted, thus the implementation can | |
| * check if SRTP work correctly. | | * check if SRTP work correctly. | |
| * | | * | |
| * @author Werner Dittmann <Werner.Dittmann@t-online.de> | | * @author Werner Dittmann <Werner.Dittmann@t-online.de> | |
| */ | | */ | |
| | | | |
| class ZrtpPacketConfirm : public ZrtpPacketBase { | | class ZrtpPacketConfirm : public ZrtpPacketBase { | |
| | | | |
| private: | | private: | |
|
| Confirm_t* confirmHeader; | | Confirm_t* confirmHeader; | |
| public: | | | |
| ZrtpPacketConfirm(); /* Creates a Confirm packet with def | | public: | |
| ault data */ | | ZrtpPacketConfirm(uint8_t sl); /* Creates a Confirm packet | |
| ZrtpPacketConfirm(uint8_t* data, uint8_t* content); /* Creates a | | with default data */ | |
| Confirm packet from received data */ | | ZrtpPacketConfirm(uint8_t* d); /* Creates a Confirm packet | |
| virtual ~ZrtpPacketConfirm(); | | from received data */ | |
| | | virtual ~ZrtpPacketConfirm(); | |
| const uint8_t* getPlainText() { return confirmHeader->plaintext; }; | | | |
| uint8_t getSASFlag() { return confirmHeader->flag; } | | const bool isSASFlag() { return confirmHeader->flags & 0 | |
| const uint8_t* getHmac() { return confirmHeader->hmac; }; | | x4; } | |
| const uint32_t getExpTime() { return confirmHeader->expTime; }; | | const uint8_t* getFiller() { return confirmHeader->filler; } | |
| | | ; | |
| void setPlainText(uint8_t* text) { memcpy(confirmHeader->plaintext, te | | const uint8_t* getIv() { return confirmHeader->iv; }; | |
| xt, 15); }; | | const uint8_t* getHmac() { return confirmHeader->hmac; }; | |
| void setSASFlag(uint8_t flg) { confirmHeader->flag = flg; }; | | const uint32_t getExpTime() { return ntohl(confirmHeader->exp | |
| void setHmac(uint8_t* text) { memcpy(confirmHeader->hmac, text, 3 | | Time); }; | |
| 2); }; | | | |
| void setExpTime(uint32_t t) { confirmHeader->expTime = t; }; | | void setSASFlag() { confirmHeader->flags |= 0x4; }; | |
| | | void setHmac(uint8_t* text) { memcpy(confirmHeader->hmac, text, si | |
| | | zeof(confirmHeader->hmac)); }; | |
| | | void setIv(uint8_t* text) { memcpy(confirmHeader->iv, text, size | |
| | | of(confirmHeader->iv)); }; | |
| | | void setExpTime(uint32_t t) { confirmHeader->expTime = htonl(t); } | |
| | | ; | |
| | | | |
| | | private: | |
| | | // Confirm packet is of variable length. It maximum size is 268 words: | |
| | | // - 11 words fixed size | |
| | | // - up to 257 words variable part, depending if signature is present | |
| | | ant its length | |
| | | // leads to a maximum of 4*268=1072 bytes. | |
| | | uint8_t data[1280]; // large enough to hold a full blown Confirm | |
| | | packet | |
| | | | |
| }; | | }; | |
| | | | |
| #endif // ZRTPPACKETCONFIRM | | #endif // ZRTPPACKETCONFIRM | |
| | | | |
End of changes. 5 change blocks. |
| 25 lines changed or deleted | | 39 lines changed or added | |
|
| ZrtpPacketDHPart.h | | ZrtpPacketDHPart.h | |
| /* | | /* | |
|
| Copyright (C) 2006 Werner Dittmann | | Copyright (C) 2006-2007 Werner Dittmann | |
| | | | |
|
| This program is free software; you can redistribute it and/or modify | | This program is free software: you can redistribute it and/or modify | |
| it under the terms of the GNU General Public License as published by | | it under the terms of the GNU General Public License as published by | |
|
| the Free Software Foundation; either version 2, or (at your option) | | the Free Software Foundation, either version 3 of the License, or | |
| any later version. | | (at your option) any later version. | |
| | | | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| GNU General Public License for more details. | | GNU General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU General Public License | | You should have received a copy of the GNU General Public License | |
|
| along with this program; if not, write to the Free Software | | along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| Foundation, Inc., 59 Temple Place, Boston, MA 02111. | | | |
| */ | | */ | |
| | | | |
| #ifndef _ZRTPPACKETDHPART_H_ | | #ifndef _ZRTPPACKETDHPART_H_ | |
| #define _ZRTPPACKETDHPART_H_ | | #define _ZRTPPACKETDHPART_H_ | |
| | | | |
| #include <libzrtpcpp/ZrtpPacketBase.h> | | #include <libzrtpcpp/ZrtpPacketBase.h> | |
| | | | |
| /** | | /** | |
| * Implement the DHPart packet. | | * Implement the DHPart packet. | |
| * | | * | |
| | | | |
| skipping to change at line 50 | | skipping to change at line 49 | |
| public: | | public: | |
| ZrtpPacketDHPart(SupportedPubKeys pkt); /* Creates a DHPart packet w
ith default data */ | | ZrtpPacketDHPart(SupportedPubKeys pkt); /* Creates a DHPart packet w
ith default data */ | |
| ZrtpPacketDHPart(uint8_t* data); /* Creates a DHPart packet
from received data */ | | ZrtpPacketDHPart(uint8_t* data); /* Creates a DHPart packet
from received data */ | |
| virtual ~ZrtpPacketDHPart(); | | virtual ~ZrtpPacketDHPart(); | |
| | | | |
| uint8_t* getPv() { return pv; } | | uint8_t* getPv() { return pv; } | |
| uint8_t* getRs1Id() { return DHPartHeader->rs1Id; }; | | uint8_t* getRs1Id() { return DHPartHeader->rs1Id; }; | |
| uint8_t* getRs2Id() { return DHPartHeader->rs2Id; }; | | uint8_t* getRs2Id() { return DHPartHeader->rs2Id; }; | |
| uint8_t* getSigsId() { return DHPartHeader->sigsId; }; | | uint8_t* getSigsId() { return DHPartHeader->sigsId; }; | |
| uint8_t* getSrtpsId() { return DHPartHeader->srtpsId; }; | | uint8_t* getSrtpsId() { return DHPartHeader->srtpsId; }; | |
|
| uint8_t* getOtherSecretId() { return DHPartHeader->otherSecretId; }; | | uint8_t* getOtherSecretId() { return DHPartHeader->otherSecretId; }; | |
| | | | |
|
| void setPv(uint8_t* text) { memcpy(pv, text, ((pktype == Dh30 | | void setPv(uint8_t* text) { memcpy(pv, text, ((pktype == Dh3072) | |
| 72) ? 384 :512)); }; | | ? 384 :512)); }; | |
| void setRs1Id(uint8_t* text) { memcpy(DHPartHeader->rs1Id, text | | void setRs1Id(uint8_t* text) { memcpy(DHPartHeader->rs1Id, text, s | |
| , 8); }; | | izeof(DHPartHeader->rs1Id)); }; | |
| void setRs2Id(uint8_t* text) { memcpy(DHPartHeader->rs2Id, text | | void setRs2Id(uint8_t* text) { memcpy(DHPartHeader->rs2Id, text, s | |
| , 8); }; | | izeof(DHPartHeader->rs2Id)); }; | |
| void setSigsId(uint8_t* text) { memcpy(DHPartHeader->sigsId, tex | | void setSigsId(uint8_t* text) { memcpy(DHPartHeader->sigsId, text, | |
| t, 8); }; | | sizeof(DHPartHeader->sigsId)); }; | |
| void setSrtpsId(uint8_t* text) { memcpy(DHPartHeader->srtpsId, te | | void setSrtpsId(uint8_t* t) { memcpy(DHPartHeader->srtpsId, t, si | |
| xt, 8); }; | | zeof(DHPartHeader->srtpsId)); }; | |
| void setOtherSecretId(uint8_t* text) { memcpy(DHPartHeader->otherSecret | | void setOtherSecretId(uint8_t* t) { memcpy(DHPartHeader->otherSecretId, | |
| Id, text, 8); }; | | t, sizeof(DHPartHeader->otherSecretId)); }; | |
| | | | |
| private: | | private: | |
| SupportedPubKeys pktype; | | SupportedPubKeys pktype; | |
|
| | | // DHPart packet is of variable length. It maximum size is 141 words: | |
| | | // - 13 words fixed sizze | |
| | | // - up to 128 words variable part, depending on DH algorithm | |
| | | // leads to a maximum of 4*141=5644 bytes. | |
| | | uint8_t data[768]; // large enough to hold a full blown DHPart p | |
| | | acket | |
| | | | |
| }; | | }; | |
| | | | |
| #endif // ZRTPPACKETDHPART | | #endif // ZRTPPACKETDHPART | |
| | | | |
End of changes. 7 change blocks. |
| 19 lines changed or deleted | | 25 lines changed or added | |
|
| ZrtpPacketHello.h | | ZrtpPacketHello.h | |
| /* | | /* | |
|
| Copyright (C) 2006 Werner Dittmann | | Copyright (C) 2006-2007 Werner Dittmann | |
| | | | |
|
| This program is free software; you can redistribute it and/or modify | | This program is free software: you can redistribute it and/or modify | |
| it under the terms of the GNU General Public License as published by | | it under the terms of the GNU General Public License as published by | |
|
| the Free Software Foundation; either version 2, or (at your option) | | the Free Software Foundation, either version 3 of the License, or | |
| any later version. | | (at your option) any later version. | |
| | | | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| GNU General Public License for more details. | | GNU General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU General Public License | | You should have received a copy of the GNU General Public License | |
|
| along with this program; if not, write to the Free Software | | along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| Foundation, Inc., 59 Temple Place, Boston, MA 02111. | | | |
| */ | | */ | |
| | | | |
| #ifndef _ZRTPPACKETHELLO_H_ | | #ifndef _ZRTPPACKETHELLO_H_ | |
| #define _ZRTPPACKETHELLO_H_ | | #define _ZRTPPACKETHELLO_H_ | |
| | | | |
| #include <libzrtpcpp/ZrtpPacketBase.h> | | #include <libzrtpcpp/ZrtpPacketBase.h> | |
| | | | |
| /** | | /** | |
| * Implement the Hello packet. | | * Implement the Hello packet. | |
| * | | * | |
| | | | |
| skipping to change at line 40 | | skipping to change at line 39 | |
| * other party selects methods and parameters it can support | | * other party selects methods and parameters it can support | |
| * and uses the Commit message to commit these. | | * and uses the Commit message to commit these. | |
| * | | * | |
| * @author Werner Dittmann <Werner.Dittmann@t-online.de> | | * @author Werner Dittmann <Werner.Dittmann@t-online.de> | |
| */ | | */ | |
| | | | |
| class ZrtpPacketHello : public ZrtpPacketBase { | | class ZrtpPacketHello : public ZrtpPacketBase { | |
| | | | |
| protected: | | protected: | |
| Hello_t* helloHeader; | | Hello_t* helloHeader; | |
|
| | | bool passive; | |
| | | // number of the algorithms | |
| | | int32_t nHash, nCipher, nPubkey, nSas, nAuth; | |
| | | // offsets in bytes into hello packet where algo names are stored | |
| | | int32_t oHash, oCipher, oPubkey, oSas, oAuth; | |
| | | | |
| public: | | public: | |
|
| ZrtpPacketHello(); /* Creates a Hello packet with default data
*/ | | ZrtpPacketHello(); /* Creates a Hello packet with default
data */ | |
| ZrtpPacketHello(uint8_t *data); /* Creates a Hello packet from received
data */ | | ZrtpPacketHello(uint8_t *data); /* Creates a Hello packet from received
data */ | |
| virtual ~ZrtpPacketHello(); | | virtual ~ZrtpPacketHello(); | |
| | | | |
| uint8_t* getVersion() { return helloHeader->version; }; | | uint8_t* getVersion() { return helloHeader->version; }; | |
| uint8_t* getClientId() { return helloHeader->clientId; }; | | uint8_t* getClientId() { return helloHeader->clientId; }; | |
|
| bool isPassive() { return ((helloHeader->flag & 0x1) == 0x1); }; | | uint8_t* getZid() { return helloHeader->zid; }; | |
| | | | |
| | | void setVersion(uint8_t *text) { memcpy(helloHeader->version, text, | |
| | | ZRTP_WORD_SIZE ); } | |
| | | void setClientId(const uint8_t *t) { memcpy(helloHeader->clientId, t, s | |
| | | izeof(helloHeader->clientId)); } | |
| | | void setZid(uint8_t *text) { memcpy(helloHeader->zid, text, siz | |
| | | eof(helloHeader->zid)); } | |
| | | | |
| | | bool isPassive() { return passive; }; | |
| | | | |
| | | uint8_t* getHashType(int32_t n) { return ((uint8_t*)helloHeader)+oHas | |
| | | h+(n*ZRTP_WORD_SIZE); } | |
| | | uint8_t* getCipherType(int32_t n) { return ((uint8_t*)helloHeader)+oCip | |
| | | her+(n*ZRTP_WORD_SIZE); } | |
| | | uint8_t* getAuthLen(int32_t n) { return ((uint8_t*)helloHeader)+oAuth | |
| | | +(n*ZRTP_WORD_SIZE); } | |
| | | uint8_t* getPubKeyType(int32_t n) { return ((uint8_t*)helloHeader)+oPub | |
| | | key+(n*ZRTP_WORD_SIZE); } | |
| | | uint8_t* getSasType(int32_t n) { return ((uint8_t*)helloHeader)+oSas | |
| | | +(n*ZRTP_WORD_SIZE); } | |
| | | | |
| | | void setHashType(int32_t n, int8_t* t) | |
| | | { memcpy(((uint8_t*)helloHeader)+oHash+(n*ZRTP_WORD_SIZE), t, ZRTP_ | |
| | | WORD_SIZE); } | |
| | | void setCipherType(int32_t n, int8_t* t) | |
| | | { memcpy(((uint8_t*)helloHeader)+oCipher+(n*ZRTP_WORD_SIZE), t, ZRT | |
| | | P_WORD_SIZE); } | |
| | | void setAuthLen(int32_t n, int8_t* t) | |
| | | { memcpy(((uint8_t*)helloHeader)+oAuth+(n*ZRTP_WORD_SIZE), t, ZRTP_ | |
| | | WORD_SIZE); } | |
| | | void setPubKeyType(int32_t n, int8_t* t) | |
| | | { memcpy(((uint8_t*)helloHeader)+oPubkey+(n*ZRTP_WORD_SIZE), t, ZRT | |
| | | P_WORD_SIZE); } | |
| | | void setSasType(int32_t n, int8_t* t) | |
| | | { memcpy(((uint8_t*)helloHeader)+oSas+(n*ZRTP_WORD_SIZE), t, ZRTP_W | |
| | | ORD_SIZE); } | |
| | | | |
| | | int32_t getNumHashes() {return nHash; } | |
| | | int32_t getNumCiphers() {return nCipher; } | |
| | | int32_t getNumPubKeys() {return nPubkey; } | |
| | | int32_t getNumSas() {return nSas; } | |
| | | int32_t getNumAuth() {return nAuth; } | |
| | | | |
|
| uint8_t* getHashType(uint32_t number) { return helloHeader->hashes[n | | | |
| umber]; }; | | | |
| uint8_t* getCipherType(uint32_t number) { return helloHeader->ciphers[ | | | |
| number]; }; | | | |
| uint8_t* getAuthLen(uint32_t number) { return helloHeader->authleng | | | |
| ths[number]; }; | | | |
| uint8_t* getPubKeysType(uint32_t number) { return helloHeader->pubkeys[ | | | |
| number]; }; | | | |
| uint8_t* getSasType(uint32_t number) { return helloHeader->sas[numb | | | |
| er]; }; | | | |
| uint8_t* getZid() { return helloHeader->zid; }; | | | |
| | | | |
| void setVersion(uint8_t *text) { memcpy(helloHeader-> | | | |
| version, text, 4); } | | | |
| void setClientId(const uint8_t *text) { memcpy(helloHeader-> | | | |
| clientId, text, 15); } | | | |
| void setHashType(uint32_t number, char *text) { memcpy(helloHeader-> | | | |
| hashes[number], text, 8); }; | | | |
| void setCipherType(uint32_t number, char *text) { memcpy(helloHeader-> | | | |
| ciphers[number], text, 8); }; | | | |
| void setAuthLen(uint32_t number, char *text) { memcpy(helloHeader-> | | | |
| authlengths[number], text, 8); }; | | | |
| void setPubKeyType(uint32_t number, char *text) { memcpy(helloHeader-> | | | |
| pubkeys[number], text, 8); }; | | | |
| void setSasType(uint32_t number, char *text) { memcpy(helloHeader-> | | | |
| sas[number], text, 8); }; | | | |
| void setZid(uint8_t *text) { memcpy(helloHeader-> | | | |
| zid, text, 12); }; | | | |
| private: | | private: | |
|
| | | // Hello packet is of variable length. It maximum size is 46 words: | |
| | | // - 11 words fixed sizze | |
| | | // - up to 35 words variable part, depending on number of algorithms | |
| | | // leads to a maximum of 4*46=184 bytes. | |
| | | uint8_t data[256]; // large enough to hold a full blown Hello pa | |
| | | cket | |
| }; | | }; | |
| | | | |
| #endif // ZRTPPACKETHELLO | | #endif // ZRTPPACKETHELLO | |
| | | | |
End of changes. 9 change blocks. |
| 36 lines changed or deleted | | 60 lines changed or added | |
|
| ZrtpQueue.h | | ZrtpQueue.h | |
| /* | | /* | |
|
| Copyright (C) 2006 Werner Dittmann | | Copyright (C) 2006-2007 Werner Dittmann | |
| | | | |
|
| This program is free software; you can redistribute it and/or modify | | This program is free software: you can redistribute it and/or modify | |
| it under the terms of the GNU General Public License as published by | | it under the terms of the GNU General Public License as published by | |
|
| the Free Software Foundation; either version 2, or (at your option) | | the Free Software Foundation, either version 3 of the License, or | |
| any later version. | | (at your option) any later version. | |
| | | | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| GNU General Public License for more details. | | GNU General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU General Public License | | You should have received a copy of the GNU General Public License | |
|
| along with this program; if not, write to the Free Software | | along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| Foundation, Inc., 59 Temple Place, Boston, MA 02111. | | | |
| */ | | */ | |
| | | | |
| #ifndef _ZRTPQUEUE_H_ | | #ifndef _ZRTPQUEUE_H_ | |
| #define _ZRTPQUEUE_H_ | | #define _ZRTPQUEUE_H_ | |
| | | | |
| #include <ccrtp/cqueue.h> | | #include <ccrtp/cqueue.h> | |
|
| | | #include <ccrtp/rtppkt.h> | |
| #include <libzrtpcpp/ZrtpCallback.h> | | #include <libzrtpcpp/ZrtpCallback.h> | |
| #include <libzrtpcpp/ZRtp.h> | | #include <libzrtpcpp/ZRtp.h> | |
| | | | |
| /** | | /** | |
| * The bridge between the ZRTP implementation and GNU ccRTP. | | * The bridge between the ZRTP implementation and GNU ccRTP. | |
| * | | * | |
| * The ZRPT implementation is fairly independent from the underlying | | * The ZRPT implementation is fairly independent from the underlying | |
| * RTP/SRTP implementation. This class implements specific | | * RTP/SRTP implementation. This class implements specific | |
| * functions and interfaces that ZRTP uses to call functions of the | | * functions and interfaces that ZRTP uses to call functions of the | |
| * hosting RTP/SRTP environment. In this case the host is GNU ccRTP. | | * hosting RTP/SRTP environment. In this case the host is GNU ccRTP. | |
| | | | |
| skipping to change at line 56 | | skipping to change at line 56 | |
| | | | |
| class ZrtpUserCallback; | | class ZrtpUserCallback; | |
| | | | |
| #ifdef CCXX_NAMESPACES | | #ifdef CCXX_NAMESPACES | |
| namespace ost { | | namespace ost { | |
| #endif | | #endif | |
| | | | |
| class ZrtpQueue : public AVPQueue, public ZrtpCallback { | | class ZrtpQueue : public AVPQueue, public ZrtpCallback { | |
| | | | |
| public: | | public: | |
|
| | | | |
| | | /** | |
| | | * Initialize the ZrtpQueue. | |
| | | * | |
| | | * Before a programm can use ZRTP it has to initialize ZRTP | |
| | | * processing. This method initializes the timeout thread and | |
| | | * the ZID file that contais the retained secrets. | |
| | | * | |
| | | * If an application requires several ZRTP sessions all session use | |
| | | * the same timeout thread and use the same ZID file. Therefore an | |
| | | * application does not need to do any synchronisation regading | |
| | | * ZID files or timeouts. This is managed by the ZRTP implementation. | |
| | | * | |
| | | * The application may specify its own ZID file name. If no ZID file n | |
| | | ame | |
| | | * is specified it defaults to <code>$HOME/.GNUccRTP.zid</code> if the | |
| | | * <code>HOME</code>environment variable is set. If it is not set the | |
| | | * current directory is used. | |
| | | * | |
| | | * @param zidFilename | |
| | | * The name of the ZID file, can be a relative or absolut filename | |
| | | . | |
| | | * @return 1 on success, -1 on failure. In the latter case the method | |
| | | also | |
| | | * sets <code>setEnableZrtp(false)</code>. | |
| | | * | |
| | | */ | |
| int32_t initialize(const char *zidFilename); | | int32_t initialize(const char *zidFilename); | |
| | | | |
| /* | | /* | |
| * The following methods implement the external interface to control | | * The following methods implement the external interface to control | |
| * ZRTP behaviour. | | * ZRTP behaviour. | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * Enable overall ZRTP processing. | | * Enable overall ZRTP processing. | |
| * | | * | |
| | | | |
| skipping to change at line 188 | | skipping to change at line 212 | |
| * id string are allowed, the will be filled with blanks. Longer id | | * id string are allowed, the will be filled with blanks. Longer id | |
| * will be truncated to 15 characters. | | * will be truncated to 15 characters. | |
| * | | * | |
| * @param id | | * @param id | |
| * The client's id | | * The client's id | |
| */ | | */ | |
| void setClientId(std::string id) { | | void setClientId(std::string id) { | |
| clientIdString = id; | | clientIdString = id; | |
| } | | } | |
| | | | |
|
| | | /** | |
| | | * This is used to create a data packet in the send queue. | |
| | | * Sometimes a "NULL" or empty packet will be used instead, and | |
| | | * these are known as "silent" packets. "Silent" packets are | |
| | | * used simply to "push" the scheduler along more accurately | |
| | | * by giving the appearence that a next packet is waiting to | |
| | | * be sent and to provide a valid timestamp for that packet. | |
| | | * | |
| | | * This method overrides the same method in OutgoingDataQueue class. | |
| | | * During ZRTP processing it may be necessary to control the | |
| | | * flow of outgoing RTP payload packets (GoClear processing). | |
| | | * | |
| | | * @param stamp Timestamp for expected send time of packet. | |
| | | * @param data Value or NULL if special "silent" packet. | |
| | | * @param len May be 0 to indicate a default by payload type. | |
| | | **/ | |
| | | void | |
| | | putData(uint32 stamp, const unsigned char* data = NULL, size_t len = 0) | |
| | | ; | |
| | | | |
| | | /** | |
| | | * This is used to create a data packet and send it immediately. | |
| | | * Sometimes a "NULL" or empty packet will be used instead, and | |
| | | * these are known as "silent" packets. "Silent" packets are | |
| | | * used simply to "push" the scheduler along more accurately | |
| | | * by giving the appearence that a next packet is waiting to | |
| | | * be sent and to provide a valid timestamp for that packet. | |
| | | * | |
| | | * This method overrides the same method in OutgoingDataQueue class. | |
| | | * During ZRTP processing it may be necessary to control the | |
| | | * flow of outgoing RTP payload packets (GoClear processing). | |
| | | * | |
| | | * @param stamp Timestamp immediate send time of packet. | |
| | | * @param data Value or NULL if special "silent" packet. | |
| | | * @param len May be 0 to indicate a default by payload type. | |
| | | **/ | |
| | | void | |
| | | sendImmediate(uint32 stamp, const unsigned char* data = NULL, size_t le | |
| | | n = 0); | |
| | | | |
| void start(); | | void start(); | |
| void stop(); | | void stop(); | |
| | | | |
| /** | | /** | |
| * This function is used by the service thread to process | | * This function is used by the service thread to process | |
| * the next incoming packet and place it in the receive list. | | * the next incoming packet and place it in the receive list. | |
| * | | * | |
| * This class overloads the function of IncomingDataQueue | | * This class overloads the function of IncomingDataQueue | |
| * implementation. | | * implementation. | |
| * | | * | |
|
| * @return number of payload bytes received. <0 if error. | | * @return number of payload bytes received, <0 if error. | |
| */ | | */ | |
| virtual size_t takeInDataPacket(); | | virtual size_t takeInDataPacket(); | |
| | | | |
| /** | | /** | |
| * A hook that gets called if the decoding of an incoming SRTP was erro
neous | | * A hook that gets called if the decoding of an incoming SRTP was erro
neous | |
| * | | * | |
| * @param pkt | | * @param pkt | |
| * The SRTP packet with error. | | * The SRTP packet with error. | |
| * @param errorCode | | * @param errorCode | |
| * The error code: -1 - SRTP authentication failure, -2 - replay | | * The error code: -1 - SRTP authentication failure, -2 - replay | |
| | | | |
| skipping to change at line 232 | | skipping to change at line 294 | |
| */ | | */ | |
| void handleTimeout(const std::string &c) { | | void handleTimeout(const std::string &c) { | |
| if (zrtpEngine != NULL) { | | if (zrtpEngine != NULL) { | |
| zrtpEngine->processTimeout(); | | zrtpEngine->processTimeout(); | |
| } | | } | |
| }; | | }; | |
| | | | |
| /* | | /* | |
| * Refer to ZrtpCallback.h | | * Refer to ZrtpCallback.h | |
| */ | | */ | |
|
| int32_t sendDataRTP(const unsigned char* data, int32_t length); | | int32_t sendDataZRTP(const unsigned char* data, int32_t length); | |
| | | | |
| int32_t sendDataSRTP(const unsigned char* dataHeader, int32_t lengthHea | | | |
| der, | | | |
| char *dataContent, int32_t lengthContent); | | | |
| | | | |
| int32_t activateTimer(int32_t time); | | int32_t activateTimer(int32_t time); | |
| | | | |
| int32_t cancelTimer(); | | int32_t cancelTimer(); | |
| | | | |
| void sendInfo(MessageSeverity severity, char* msg); | | void sendInfo(MessageSeverity severity, char* msg); | |
| /** | | /** | |
| * Switch on the security for the defined part. | | * Switch on the security for the defined part. | |
| * | | * | |
| * Create an CryproContext with the negotiated ZRTP data and | | * Create an CryproContext with the negotiated ZRTP data and | |
| * register it with the respective part (sender or receiver) thus | | * register it with the respective part (sender or receiver) thus | |
| * replacing the current active context (usually an empty | | * replacing the current active context (usually an empty | |
| * context). This effectively enables SRTP. | | * context). This effectively enables SRTP. | |
| * | | * | |
| * @param secrets | | * @param secrets | |
| * The secret keys and salt negotiated by ZRTP | | * The secret keys and salt negotiated by ZRTP | |
| * @param part | | * @param part | |
| * An enum that defines wich direction to switch on: sender or recei
ver | | * An enum that defines wich direction to switch on: sender or recei
ver | |
|
| | | * @return | |
| | | * Returns false if something went wrong during initialization of SR | |
| | | TP | |
| | | * context, for example memory shortage. | |
| */ | | */ | |
|
| void srtpSecretsReady(SrtpSecret_t* secrets, EnableSecurity part); | | bool srtpSecretsReady(SrtpSecret_t* secrets, EnableSecurity part); | |
| | | | |
| /** | | /** | |
| * Switch off the security for the defined part. | | * Switch off the security for the defined part. | |
| * | | * | |
| * Create an empty CryproContext and register it with the | | * Create an empty CryproContext and register it with the | |
| * repective part (sender or receiver) thus replacing the current | | * repective part (sender or receiver) thus replacing the current | |
| * active context. This effectively disables SRTP. | | * active context. This effectively disables SRTP. | |
| * | | * | |
| * @param part | | * @param part | |
| * An enum that defines wich direction to switch off: sender or rece
iver | | * An enum that defines wich direction to switch off: sender or rece
iver | |
| | | | |
| skipping to change at line 331 | | skipping to change at line 393 | |
| * Local SSRC is given instead of computed by the queue. | | * Local SSRC is given instead of computed by the queue. | |
| */ | | */ | |
| ZrtpQueue(uint32 ssrc, uint32 size = | | ZrtpQueue(uint32 ssrc, uint32 size = | |
| RTPDataQueue::defaultMembersHashSize, | | RTPDataQueue::defaultMembersHashSize, | |
| RTPApplication& app = defaultApplication()); | | RTPApplication& app = defaultApplication()); | |
| | | | |
| virtual ~ZrtpQueue(); | | virtual ~ZrtpQueue(); | |
| | | | |
| private: | | private: | |
| void init(); | | void init(); | |
|
| | | size_t rtpDataPacket(IncomingRTPPkt* packet, int32 rtn, | |
| | | InetHostAddress network_address, | |
| | | tpport_t transport_port); | |
| | | | |
| ZRtp *zrtpEngine; | | ZRtp *zrtpEngine; | |
| ZrtpUserCallback* zrtpUserCallback; | | ZrtpUserCallback* zrtpUserCallback; | |
| | | | |
| std::string clientIdString; | | std::string clientIdString; | |
| | | | |
| bool enableZrtp; | | bool enableZrtp; | |
| | | | |
| int32 secureParts; | | int32 secureParts; | |
| | | | |
|
| uint32 recvZrtpSsrc; | | | |
| uint16 recvZrtpSeqNo; | | | |
| CryptoContext* recvCryptoContext; | | CryptoContext* recvCryptoContext; | |
|
| | | | |
| uint32 senderZrtpSsrc; | | | |
| uint16 senderZrtpSeqNo; | | | |
| CryptoContext* senderCryptoContext; | | CryptoContext* senderCryptoContext; | |
|
| | | int16 senderZrtpSeqNo; | |
| | | }; | |
| | | | |
| | | class IncomingZRTPPkt : public IncomingRTPPkt { | |
| | | | |
| | | public: | |
| | | /** | |
| | | * Build a ZRTP packet object from a data buffer. | |
| | | * | |
| | | * @param block pointer to the buffer the whole packet is stored in. | |
| | | * @param len length of the whole packet, expressed in octets. | |
| | | * | |
| | | **/ | |
| | | | |
| | | IncomingZRTPPkt(const unsigned char* block, size_t len); | |
| | | | |
| | | ~IncomingZRTPPkt() | |
| | | { } | |
| | | | |
| | | inline uint32 | |
| | | getZrtpMagic() const | |
| | | { return ntohl(getHeader()->timestamp); } | |
| | | }; | |
| | | | |
| | | class OutgoingZRTPPkt : public OutgoingRTPPkt { | |
| | | | |
| | | public: | |
| | | /** | |
| | | * Construct a new ZRTP packet to be sent. | |
| | | * | |
| | | * A new copy in memory (holding all this components | |
| | | * along with the fixed header) is created. | |
| | | * | |
| | | * @param hdrext whole header extension. | |
| | | * @param hdrextlen size of whole header extension, in octets. | |
| | | **/ | |
| | | OutgoingZRTPPkt(const unsigned char* const hdrext, uint32 hdrextlen); | |
| | | ~OutgoingZRTPPkt() | |
| | | { } | |
| }; | | }; | |
| | | | |
| #ifdef CCXX_NAMESPACES | | #ifdef CCXX_NAMESPACES | |
| }; | | }; | |
| #endif | | #endif | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 15 change blocks. |
| 18 lines changed or deleted | | 122 lines changed or added | |
|
| ZrtpStateClass.h | | ZrtpStateClass.h | |
| /* | | /* | |
|
| Copyright (C) 2006 Werner Dittmann | | Copyright (C) 2006-2007 Werner Dittmann | |
| | | | |
|
| This program is free software; you can redistribute it and/or modify | | This program is free software: you can redistribute it and/or modify | |
| it under the terms of the GNU General Public License as published by | | it under the terms of the GNU General Public License as published by | |
|
| the Free Software Foundation; either version 2, or (at your option) | | the Free Software Foundation, either version 3 of the License, or | |
| any later version. | | (at your option) any later version. | |
| | | | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| GNU General Public License for more details. | | GNU General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU General Public License | | You should have received a copy of the GNU General Public License | |
|
| along with this program; if not, write to the Free Software | | along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| Foundation, Inc., 59 Temple Place, Boston, MA 02111. | | | |
| */ | | */ | |
| | | | |
| #ifndef _ZRTPSTATECLASS_H_ | | #ifndef _ZRTPSTATECLASS_H_ | |
| #define _ZRTPSTATECLASS_H_ | | #define _ZRTPSTATECLASS_H_ | |
| | | | |
| #include <libzrtpcpp/ZrtpStates.h> | | #include <libzrtpcpp/ZrtpStates.h> | |
| #include <libzrtpcpp/ZrtpPacketBase.h> | | #include <libzrtpcpp/ZrtpPacketBase.h> | |
| | | | |
| /** | | /** | |
| * This class is the ZRTP protocol state engine. | | * This class is the ZRTP protocol state engine. | |
| | | | |
| skipping to change at line 50 | | skipping to change at line 49 | |
| enum zrtpStates { | | enum zrtpStates { | |
| Initial, | | Initial, | |
| Detect, | | Detect, | |
| AckDetected, | | AckDetected, | |
| WaitCommit, | | WaitCommit, | |
| CommitSent, | | CommitSent, | |
| WaitDHPart2, | | WaitDHPart2, | |
| WaitConfirm1, | | WaitConfirm1, | |
| WaitConfirm2, | | WaitConfirm2, | |
| WaitConfAck, | | WaitConfAck, | |
|
| | | WaitClearAck, | |
| SecureState, | | SecureState, | |
|
| | | WaitErrorAck, | |
| numberOfStates | | numberOfStates | |
| }; | | }; | |
| | | | |
| enum EventReturnCodes { | | enum EventReturnCodes { | |
|
| Fail = 0, // Event processing failed. Process RTP data | | Fail = 0, // ZRTP event processing failed. | |
| . | | Done = 1, // Event processing ok. | |
| Done = 1, // Event processing ok. Process RTP data. | | | |
| FailDismiss = 2, // Event processing failed, dismiss RTP data | | | |
| . | | | |
| OkDismiss = 3 // Event Processing ok, dismiss RTP data. | | | |
| }; | | }; | |
| | | | |
| enum EventDataType { | | enum EventDataType { | |
| ZrtpInitial = 1, | | ZrtpInitial = 1, | |
| ZrtpClose, | | ZrtpClose, | |
| ZrtpPacket, | | ZrtpPacket, | |
|
| Timer, | | Timer | |
| ZrtpGoClear | | | |
| }; | | }; | |
| | | | |
| typedef struct Event { | | typedef struct Event { | |
| EventDataType type; | | EventDataType type; | |
| union { | | union { | |
| uint8_t* packet; | | uint8_t* packet; | |
| int32_t* timer; | | int32_t* timer; | |
| } data; | | } data; | |
|
| uint8_t* content; | | | |
| } Event_t; | | } Event_t; | |
| | | | |
| /** | | /** | |
| * The ZRTP timer structure. | | * The ZRTP timer structure. | |
| * | | * | |
| * This structure holds all necessary data to compute the timer for | | * This structure holds all necessary data to compute the timer for | |
| * the protocol timers. The state engine allocate one structure for | | * the protocol timers. The state engine allocate one structure for | |
| * each timer. ZRTP uses two timers, T1 and T2, to monitor protocol | | * each timer. ZRTP uses two timers, T1 and T2, to monitor protocol | |
| * timeouts. As a slight misuse but to make overall handling a bit | | * timeouts. As a slight misuse but to make overall handling a bit | |
| * simpler this structure also contains the resend counter. This is | | * simpler this structure also contains the resend counter. This is | |
| | | | |
| skipping to change at line 112 | | skipping to change at line 109 | |
| ZRtp* parent; | | ZRtp* parent; | |
| ZrtpStates* engine; | | ZrtpStates* engine; | |
| Event_t* event; | | Event_t* event; | |
| | | | |
| /** | | /** | |
| * The last packet that was sent. | | * The last packet that was sent. | |
| * | | * | |
| * If we are <code>Initiator</code> then resend this packet in case of | | * If we are <code>Initiator</code> then resend this packet in case of | |
| * timeout. | | * timeout. | |
| */ | | */ | |
|
| ZrtpPacketBase *sentPacket; | | ZrtpPacketBase* sentPacket; | |
| | | | |
| zrtpTimer_t T1; | | zrtpTimer_t T1; | |
| zrtpTimer_t T2; | | zrtpTimer_t T2; | |
| | | | |
| public: | | public: | |
| ZrtpStateClass(ZRtp *p); | | ZrtpStateClass(ZRtp *p); | |
| ~ZrtpStateClass(); | | ~ZrtpStateClass(); | |
| | | | |
| int32_t inState(const int32_t state) { return engine->inState(state); }
; | | int32_t inState(const int32_t state) { return engine->inState(state); }
; | |
| void nextState(int32_t state) { engine->nextState(state); }; | | void nextState(int32_t state) { engine->nextState(state); }; | |
| | | | |
| skipping to change at line 139 | | skipping to change at line 136 | |
| */ | | */ | |
| int32_t evInitial(); | | int32_t evInitial(); | |
| int32_t evDetect(); | | int32_t evDetect(); | |
| int32_t evAckDetected(); | | int32_t evAckDetected(); | |
| int32_t evWaitCommit(); | | int32_t evWaitCommit(); | |
| int32_t evCommitSent(); | | int32_t evCommitSent(); | |
| int32_t evWaitDHPart2(); | | int32_t evWaitDHPart2(); | |
| int32_t evWaitConfirm1(); | | int32_t evWaitConfirm1(); | |
| int32_t evWaitConfirm2(); | | int32_t evWaitConfirm2(); | |
| int32_t evWaitConfAck(); | | int32_t evWaitConfAck(); | |
|
| | | int32_t evWaitClearAck(); | |
| int32_t evSecureState(); | | int32_t evSecureState(); | |
|
| | | int32_t evWaitErrorAck(); | |
| | | | |
| /** | | /** | |
| * Initialize and activate a timer. | | * Initialize and activate a timer. | |
| * | | * | |
| * @param | | * @param | |
| * The ZRTP timer structure to use for the timer. | | * The ZRTP timer structure to use for the timer. | |
| * @return | | * @return | |
| * 1 timer was activated | | * 1 timer was activated | |
| * 0 activation failed | | * 0 activation failed | |
| */ | | */ | |
| | | | |
| skipping to change at line 173 | | skipping to change at line 172 | |
| | | | |
| /** | | /** | |
| * Cancel the active timer. | | * Cancel the active timer. | |
| * | | * | |
| * @return | | * @return | |
| * 1 timer was canceled | | * 1 timer was canceled | |
| * 0 cancelation failed | | * 0 cancelation failed | |
| */ | | */ | |
| int32_t cancelTimer() {return parent->cancelTimer(); }; | | int32_t cancelTimer() {return parent->cancelTimer(); }; | |
| | | | |
|
| | | /** | |
| | | * Prepare and send an Error packet. | |
| | | * | |
| | | * Preparse an Error packet and sends it. It stores the Error | |
| | | * packet in the sentPacket variable to enable resending. The | |
| | | * method switches to protocol state Initial. | |
| | | */ | |
| | | int32_t sendErrorPacket(uint32_t errorCode); | |
| | | | |
| }; | | }; | |
| | | | |
| #endif // _ZRTPSTATECLASS_H_ | | #endif // _ZRTPSTATECLASS_H_ | |
| | | | |
End of changes. 13 change blocks. |
| 16 lines changed or deleted | | 22 lines changed or added | |
|
| zrtpPacket.h | | zrtpPacket.h | |
| /* | | /* | |
|
| Copyright (C) 2006 Werner Dittmann | | Copyright (C) 2006-2007 Werner Dittmann | |
| | | | |
|
| This program is free software; you can redistribute it and/or modify | | This program is free software: you can redistribute it and/or modify | |
| it under the terms of the GNU General Public License as published by | | it under the terms of the GNU General Public License as published by | |
|
| the Free Software Foundation; either version 2, or (at your option) | | the Free Software Foundation, either version 3 of the License, or | |
| any later version. | | (at your option) any later version. | |
| | | | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| GNU General Public License for more details. | | GNU General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU General Public License | | You should have received a copy of the GNU General Public License | |
|
| along with this program; if not, write to the Free Software | | along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| Foundation, Inc., 59 Temple Place, Boston, MA 02111. | | | |
| */ | | */ | |
| | | | |
| /* | | /* | |
| * Authors: Werner Dittmann <Werner.Dittmann@t-online.de> | | * Authors: Werner Dittmann <Werner.Dittmann@t-online.de> | |
| */ | | */ | |
| | | | |
| #ifndef ZRTPPACKET_H | | #ifndef ZRTPPACKET_H | |
| #define ZRTPPACKET_H | | #define ZRTPPACKET_H | |
| | | | |
| #include <stdio.h> | | #include <stdio.h> | |
| | | | |
|
| #define ZRTP_EXT_PACKET 0x505a | | #define ZRTP_MAGIC 0x5a525450 | |
| | | | |
| #define ZRTP_WORD_SIZE 4 | | #define ZRTP_WORD_SIZE 4 | |
|
| #define ZRTP_MSG_SIZE 8 // 2 * WORD_SIZE | | #define CRC_SIZE 4 | |
| | | | |
|
| #define MESSAGE_LENGTH 2 | | // The ZRTP Message header, refer to chapter 6.2ff | |
| typedef struct zrtpPacketHeader { | | typedef struct zrtpPacketHeader { | |
| uint16_t zrtpId; | | uint16_t zrtpId; | |
| uint16_t length; | | uint16_t length; | |
|
| uint8_t message[8]; | | uint8_t messageType[2*ZRTP_WORD_SIZE]; | |
| } zrtpPacketHeader_t; | | } zrtpPacketHeader_t; | |
| | | | |
|
| #define HELLO_LENGTH 62 /* plus the MESSAGE_LENGTH = 64 */ | | | |
| typedef struct Hello { | | typedef struct Hello { | |
|
| uint8_t version[4]; | | uint8_t version[ZRTP_WORD_SIZE]; | |
| uint8_t clientId[31]; | | uint8_t clientId[3*ZRTP_WORD_SIZE]; | |
| uint8_t flag; | | uint8_t zid[3*ZRTP_WORD_SIZE]; | |
| uint8_t hashes[5][8]; | | uint32_t flagLength; | |
| uint8_t ciphers[5][8]; | | | |
| uint8_t authlengths[5][8]; | | | |
| uint8_t pubkeys[5][8]; | | | |
| uint8_t sas[5][8]; | | | |
| uint8_t zid[12]; | | | |
| } Hello_t; | | } Hello_t; | |
| | | | |
| typedef struct HelloPacket { | | typedef struct HelloPacket { | |
| zrtpPacketHeader_t hdr; | | zrtpPacketHeader_t hdr; | |
| Hello_t hello; | | Hello_t hello; | |
| } HelloPacket_t; | | } HelloPacket_t; | |
| | | | |
|
| typedef struct HelloAck { /* Length is MESSAGE_LENGTH */ | | typedef struct HelloAckPacket { | |
| zrtpPacketHeader_t hdr; | | zrtpPacketHeader_t hdr; | |
|
| } HelloAck_t; | | uint8_t crc[ZRTP_WORD_SIZE]; | |
| | | } HelloAckPacket_t; | |
| | | | |
|
| #define COMMIT_LENGTH 21 /* plus MESSAGE_LENGTH = 23 */ | | | |
| typedef struct Commit { | | typedef struct Commit { | |
|
| uint8_t zid[12]; | | uint8_t zid[3*ZRTP_WORD_SIZE]; | |
| uint8_t hash[8]; | | uint8_t hash[ZRTP_WORD_SIZE]; | |
| uint8_t cipher[8]; | | uint8_t cipher[ZRTP_WORD_SIZE]; | |
| uint8_t authlengths[8]; | | uint8_t authlengths[ZRTP_WORD_SIZE]; | |
| uint8_t pubkey[8]; | | uint8_t pubkey[ZRTP_WORD_SIZE]; | |
| uint8_t sas[8]; | | uint8_t sas[ZRTP_WORD_SIZE]; | |
| uint8_t hvi[32]; | | uint8_t hvi[8*ZRTP_WORD_SIZE]; | |
| } Commit_t; | | } Commit_t; | |
| | | | |
| typedef struct CommitPacket { | | typedef struct CommitPacket { | |
| zrtpPacketHeader_t hdr; | | zrtpPacketHeader_t hdr; | |
| Commit_t commit; | | Commit_t commit; | |
|
| | | uint8_t crc[ZRTP_WORD_SIZE]; | |
| } CommitPacket_t; | | } CommitPacket_t; | |
| | | | |
|
| #define DHPART_LENGTH 10 /* plus MESSAGE_LENGTH + pvr length */ | | | |
| typedef struct DHPart { | | typedef struct DHPart { | |
|
| uint8_t rs1Id[8]; | | uint8_t rs1Id[2*ZRTP_WORD_SIZE]; | |
| uint8_t rs2Id[8]; | | uint8_t rs2Id[2*ZRTP_WORD_SIZE]; | |
| uint8_t sigsId[8]; | | uint8_t sigsId[2*ZRTP_WORD_SIZE]; | |
| uint8_t srtpsId[8]; | | uint8_t srtpsId[2*ZRTP_WORD_SIZE]; | |
| uint8_t otherSecretId[8]; | | uint8_t otherSecretId[2*ZRTP_WORD_SIZE]; | |
| } DHPart_t; | | } DHPart_t; | |
| | | | |
| typedef struct DHPartPacket { | | typedef struct DHPartPacket { | |
| zrtpPacketHeader_t hdr; | | zrtpPacketHeader_t hdr; | |
|
| | | DHPart_t dhPart; // Since 0.4a | |
| } DHPartPacket_t; | | } DHPartPacket_t; | |
| | | | |
|
| #define CONFIRM_LENGTH 2 /* the rest of Confirm data goes into payl
oad */ | | | |
| typedef struct Confirm { | | typedef struct Confirm { | |
|
| uint8_t plaintext[15]; | | uint8_t hmac[2*ZRTP_WORD_SIZE]; | |
| uint8_t flag; | | uint8_t iv[4*ZRTP_WORD_SIZE]; | |
| | | uint8_t filler[2]; | |
| | | uint8_t sigLength; | |
| | | uint8_t flags; | |
| uint32_t expTime; | | uint32_t expTime; | |
|
| uint8_t hmac[32]; | | uint8_t SASRenderScheme[ZRTP_WORD_SIZE]; | |
| | | uint32_t trustedSASValue; | |
| } Confirm_t; | | } Confirm_t; | |
| | | | |
| typedef struct ConfirmPacket { | | typedef struct ConfirmPacket { | |
| zrtpPacketHeader_t hdr; | | zrtpPacketHeader_t hdr; | |
| Confirm_t confirm; | | Confirm_t confirm; | |
| } ConfirmPacket_t; | | } ConfirmPacket_t; | |
| | | | |
|
| #define CONF2ACK_LENGTH 2 | | typedef struct Conf2AckPacket { | |
| typedef struct Conf2Ack { | | | |
| zrtpPacketHeader_t hdr; | | zrtpPacketHeader_t hdr; | |
|
| } Conf2Ack_t; | | uint8_t crc[ZRTP_WORD_SIZE]; | |
| | | } Conf2AckPacket_t; | |
| #define ERROR_LENGTH 2 /* plus MESSAGE_LENGTH = 4 */ | | | |
| typedef struct Error { | | | |
| uint8_t type[8]; | | | |
| } Error_t; | | | |
| | | | |
| typedef struct ErrorPacket { | | | |
| zrtpPacketHeader_t hdr; | | | |
| Error_t error; | | | |
| } ErrorPacket_t; | | | |
| | | | |
| typedef struct GoClear { | | typedef struct GoClear { | |
|
| uint8_t clearHmac[32]; | | uint8_t clearHmac[2*ZRTP_WORD_SIZE]; | |
| } GoClear_t; | | } GoClear_t; | |
| | | | |
|
| #define GOCLEAR_LENGTH 8 /* plus MESSAGE_LENGTH = 10 */ | | | |
| typedef struct GoClearPacket { | | typedef struct GoClearPacket { | |
| zrtpPacketHeader_t hdr; | | zrtpPacketHeader_t hdr; | |
| GoClear_t goClear; | | GoClear_t goClear; | |
|
| | | uint8_t crc[ZRTP_WORD_SIZE]; | |
| } GoClearPacket_t; | | } GoClearPacket_t; | |
| | | | |
|
| #define CLEARACK_LENGTH 2 | | typedef struct ClearAckPacket { | |
| typedef struct ClearAck { | | zrtpPacketHeader_t hdr; | |
| | | uint8_t crc[ZRTP_WORD_SIZE]; | |
| | | } ClearAckPacket_t; | |
| | | | |
| | | typedef struct Error { | |
| | | uint32_t errorCode; | |
| | | } Error_t; | |
| | | | |
| | | typedef struct ErrorPacket { | |
| | | zrtpPacketHeader_t hdr; | |
| | | Error_t error; | |
| | | uint8_t crc[ZRTP_WORD_SIZE]; | |
| | | } ErrorPacket_t; | |
| | | | |
| | | typedef struct ErrorAckPacket { | |
| zrtpPacketHeader_t hdr; | | zrtpPacketHeader_t hdr; | |
|
| } ClearAck_t; | | uint8_t crc[ZRTP_WORD_SIZE]; | |
| | | } ErrorAckPacket_t; | |
| | | | |
| /* big/little endian conversion */ | | /* big/little endian conversion */ | |
| | | | |
| #if 0 | | #if 0 | |
| | | | |
| static inline uint16_t U16_AT( void const * _p ) | | static inline uint16_t U16_AT( void const * _p ) | |
| { | | { | |
| const uint8_t * p = (const uint8_t *)_p; | | const uint8_t * p = (const uint8_t *)_p; | |
| return ( ((uint16_t)p[0] << 8) | p[1] ); | | return ( ((uint16_t)p[0] << 8) | p[1] ); | |
| } | | } | |
| | | | |
| skipping to change at line 176 | | skipping to change at line 178 | |
| # define hton32(i) U32_AT(&i) | | # define hton32(i) U32_AT(&i) | |
| # define hton64(i) U64_AT(&i) | | # define hton64(i) U64_AT(&i) | |
| # define ntoh16(i) U16_AT(&i) | | # define ntoh16(i) U16_AT(&i) | |
| # define ntoh32(i) U32_AT(&i) | | # define ntoh32(i) U32_AT(&i) | |
| # define ntoh64(i) U64_AT(&i) | | # define ntoh64(i) U64_AT(&i) | |
| #endif | | #endif | |
| | | | |
| #endif //hton16 | | #endif //hton16 | |
| | | | |
| #endif // ZRTPPACKET_H | | #endif // ZRTPPACKET_H | |
|
| | | | |
| | | /** EMACS ** | |
| | | * Local variables: | |
| | | * mode: c++ | |
| | | * c-default-style: ellemtel | |
| | | * c-basic-offset: 4 | |
| | | * End: | |
| | | */ | |
| | | | |
End of changes. 29 change blocks. |
| 58 lines changed or deleted | | 60 lines changed or added | |
|