Fix warnings
This commit is contained in:
parent
e1a28d095a
commit
b6595822cb
|
@ -139,6 +139,7 @@ namespace uvg_rtp {
|
|||
namespace crc32 {
|
||||
void get_crc32(uint8_t *input, size_t len, uint32_t *output);
|
||||
bool verify_crc32(uint8_t *input, size_t len, uint32_t old_crc);
|
||||
uint32_t calculate_crc32(uint8_t *input, size_t len);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace uvg_rtp {
|
|||
|
||||
namespace zrtp_msg {
|
||||
|
||||
struct zrtp_confack {
|
||||
PACKED_STRUCT(zrtp_confack) {
|
||||
zrtp_msg msg_start;
|
||||
uint32_t crc;
|
||||
};
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace uvg_rtp {
|
|||
|
||||
namespace zrtp_msg {
|
||||
|
||||
struct zrtp_dh {
|
||||
PACKED_STRUCT(zrtp_dh) {
|
||||
zrtp_msg msg_start;
|
||||
uint32_t hash[8];
|
||||
uint8_t rs1_id[8];
|
||||
|
|
|
@ -249,6 +249,17 @@ void uvg_rtp::crypto::crc32::get_crc32(uint8_t *input, size_t len, uint32_t *out
|
|||
crc32.TruncatedFinal((uint8_t *)output, sizeof(uint32_t));
|
||||
}
|
||||
|
||||
uint32_t uvg_rtp::crypto::crc32::calculate_crc32(uint8_t *input, size_t len)
|
||||
{
|
||||
CryptoPP::CRC32 crc32;
|
||||
uint32_t out;
|
||||
|
||||
crc32.Update(input, len);
|
||||
crc32.TruncatedFinal((uint8_t *)&out, sizeof(uint32_t));
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
bool uvg_rtp::crypto::crc32::verify_crc32(uint8_t *input, size_t len, uint32_t old_crc)
|
||||
{
|
||||
CryptoPP::CRC32 crc32;
|
||||
|
|
|
@ -62,7 +62,7 @@ uvg_rtp::zrtp_msg::commit::commit(zrtp_session_t& session)
|
|||
memcpy(&msg->mac, mac_full, sizeof(uint64_t));
|
||||
|
||||
/* Calculate CRC32 for the whole ZRTP packet */
|
||||
uvg_rtp::crypto::crc32::get_crc32((uint8_t *)frame_, len_ - 4, &msg->crc);
|
||||
msg->crc = uvg_rtp::crypto::crc32::calculate_crc32((uint8_t *)frame_, len_ - sizeof(uint32_t));
|
||||
|
||||
/* Finally make a copy of the message and save it for later use */
|
||||
session.l_msg.commit.first = len_;
|
||||
|
|
|
@ -38,7 +38,7 @@ uvg_rtp::zrtp_msg::confack::confack(zrtp_session_t& session)
|
|||
memcpy(&msg->msg_start.msgblock, ZRTP_CONFACK, 8);
|
||||
|
||||
/* Calculate CRC32 for the whole ZRTP packet */
|
||||
uvg_rtp::crypto::crc32::get_crc32((uint8_t *)frame_, len_ - 4, &msg->crc);
|
||||
msg->crc = uvg_rtp::crypto::crc32::calculate_crc32((uint8_t *)frame_, len_ - sizeof(uint32_t));
|
||||
}
|
||||
|
||||
uvg_rtp::zrtp_msg::confack::~confack()
|
||||
|
|
|
@ -73,7 +73,7 @@ uvg_rtp::zrtp_msg::confirm::confirm(zrtp_session_t& session, int part)
|
|||
memcpy(&msg->confirm_mac, mac_full, sizeof(uint64_t));
|
||||
|
||||
/* Calculate CRC32 for the whole ZRTP packet */
|
||||
uvg_rtp::crypto::crc32::get_crc32((uint8_t *)frame_, len_ - 4, &msg->crc);
|
||||
msg->crc = uvg_rtp::crypto::crc32::calculate_crc32((uint8_t *)frame_, len_ - sizeof(uint32_t));
|
||||
|
||||
delete hmac_sha256;
|
||||
delete aes_cfb;
|
||||
|
|
|
@ -87,7 +87,7 @@ uvg_rtp::zrtp_msg::dh_key_exchange::dh_key_exchange(zrtp_session_t& session, int
|
|||
memcpy(msg->mac, mac_full, 8);
|
||||
|
||||
/* Calculate CRC32 for the whole ZRTP packet */
|
||||
uvg_rtp::crypto::crc32::get_crc32((uint8_t *)frame_, len_ - 4, &msg->crc);
|
||||
msg->crc = uvg_rtp::crypto::crc32::calculate_crc32((uint8_t *)frame_, len_ - sizeof(uint32_t));
|
||||
|
||||
/* Finally make a copy of the message and save it for later use */
|
||||
if (session.l_msg.dh.second)
|
||||
|
|
|
@ -27,7 +27,7 @@ uvg_rtp::zrtp_msg::error::error(int error_code)
|
|||
|
||||
msg->error = error_code;
|
||||
|
||||
uvg_rtp::crypto::crc32::get_crc32((uint8_t *)frame_, len_ - 4, &msg->crc);
|
||||
msg->crc = uvg_rtp::crypto::crc32::calculate_crc32((uint8_t *)frame_, len_ - sizeof(uint32_t));
|
||||
}
|
||||
|
||||
uvg_rtp::zrtp_msg::error::~error()
|
||||
|
|
|
@ -66,7 +66,7 @@ uvg_rtp::zrtp_msg::hello::hello(zrtp_session_t& session)
|
|||
memcpy(&msg->mac, mac_full, sizeof(uint64_t));
|
||||
|
||||
/* Calculate CRC32 of the whole packet (excluding crc) */
|
||||
uvg_rtp::crypto::crc32::get_crc32((uint8_t *)frame_, len_ - 4, &msg->crc);
|
||||
msg->crc = uvg_rtp::crypto::crc32::calculate_crc32((uint8_t *)frame_, len_ - sizeof(uint32_t));
|
||||
|
||||
/* Finally make a copy of the message and save it for later use */
|
||||
session.l_msg.hello.first = len_;
|
||||
|
|
|
@ -25,7 +25,7 @@ uvg_rtp::zrtp_msg::hello_ack::hello_ack()
|
|||
|
||||
memcpy(&msg->msg_start.msgblock, ZRTP_HELLO_ACK, 8);
|
||||
|
||||
uvg_rtp::crypto::crc32::get_crc32((uint8_t *)frame_, len_ - 4, &msg->crc);
|
||||
msg->crc = uvg_rtp::crypto::crc32::calculate_crc32((uint8_t *)frame_, len_ - sizeof(uint32_t));
|
||||
}
|
||||
|
||||
uvg_rtp::zrtp_msg::hello_ack::~hello_ack()
|
||||
|
|
|
@ -440,6 +440,8 @@ rtp_error_t uvg_rtp::rtcp::recv_packet_handler(void *arg, int flags, frame::rtp_
|
|||
|
||||
rtp_error_t uvg_rtp::rtcp::send_packet_handler_buf(void *arg, ssize_t len, void *buf)
|
||||
{
|
||||
(void)buf;
|
||||
|
||||
return ((uvg_rtp::rtcp *)arg)->update_sender_stats(len - uvg_rtp::frame::HEADER_SIZE_RTP);
|
||||
}
|
||||
|
||||
|
|
|
@ -209,6 +209,8 @@ rtp_error_t uvg_rtp::srtp::init_user(int type, int flags, uint8_t *key, uint8_t
|
|||
|
||||
rtp_error_t uvg_rtp::srtp::recv_packet_handler(void *arg, int flags, frame::rtp_frame **out)
|
||||
{
|
||||
(void)flags;
|
||||
|
||||
uvg_rtp::srtp *srtp = (uvg_rtp::srtp *)arg;
|
||||
uvg_rtp::srtp_ctx_t ctx = srtp->get_ctx();
|
||||
uvg_rtp::frame::rtp_frame *frame = *out;
|
||||
|
@ -226,7 +228,7 @@ rtp_error_t uvg_rtp::srtp::recv_packet_handler(void *arg, int flags, frame::rtp_
|
|||
if (seq == 0xffff)
|
||||
ctx.roc++;
|
||||
|
||||
if (srtp->create_iv(iv, frame->header.ssrc, index, ctx.key_ctx.remote.salt_key) != RTP_OK) {
|
||||
if (srtp->create_iv(iv, ssrc, index, ctx.key_ctx.remote.salt_key) != RTP_OK) {
|
||||
LOG_ERROR("Failed to create IV, unable to encrypt the RTP packet!");
|
||||
return RTP_INVALID_VALUE;
|
||||
}
|
||||
|
@ -247,8 +249,6 @@ rtp_error_t uvg_rtp::srtp::recv_packet_handler(void *arg, int flags, frame::rtp_
|
|||
hmac_sha1.update((uint8_t *)&ctx.roc, sizeof(ctx.roc));
|
||||
hmac_sha1.final((uint8_t *)&digest);
|
||||
|
||||
uint8_t *tmp_buffer = (uint8_t *)frame;
|
||||
|
||||
if (memcmp(&digest, &frame[frame->payload_len - AUTH_TAG_LENGTH], AUTH_TAG_LENGTH)) {
|
||||
LOG_ERROR("Authentication tag mismatch!");
|
||||
return RTP_AUTH_TAG_MISMATCH;
|
||||
|
|
|
@ -817,6 +817,8 @@ rtp_error_t uvg_rtp::zrtp::get_srtp_keys(
|
|||
|
||||
rtp_error_t uvg_rtp::zrtp::packet_handler(ssize_t size, void *packet, int flags, frame::rtp_frame **out)
|
||||
{
|
||||
(void)size, (void)flags, (void)out;
|
||||
|
||||
auto msg = (uvg_rtp::zrtp_msg::zrtp_msg *)packet;
|
||||
|
||||
/* not a ZRTP packet */
|
||||
|
@ -856,5 +858,7 @@ rtp_error_t uvg_rtp::zrtp::packet_handler(ssize_t size, void *packet, int flags,
|
|||
|
||||
/* TODO: goclear & co-opeartion with srtp */
|
||||
}
|
||||
|
||||
return RTP_OK;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue