1
0
mirror of https://github.com/signalwire/freeswitch.git synced 2025-04-24 11:48:48 +00:00

Miscellaneous updates

This commit is contained in:
Viktor Krikun 2011-07-06 23:39:18 +00:00 committed by Travis Cross
parent b218edc790
commit ee5dac01e3
4 changed files with 33 additions and 13 deletions

@ -12,8 +12,8 @@
#define LIBZRTP_VERSION_MAJOR 1 #define LIBZRTP_VERSION_MAJOR 1
#define LIBZRTP_VERSION_MINOR 10 #define LIBZRTP_VERSION_MINOR 12
#define LIBZRTP_VERSION_BUILD 594 #define LIBZRTP_VERSION_BUILD 598
#define LIBZRTP_VERSION_STR "v1.10 594" #define LIBZRTP_VERSION_STR "v1.12 598"
#endif /*__ZRTP_VERSION_H__*/ #endif /*__ZRTP_VERSION_H__*/

@ -1,5 +1,5 @@
# #
# Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. # Copyright (c) 2006-2011 Philip R. Zimmermann. All rights reserved.
# Contact: http://philzimmermann.com # Contact: http://philzimmermann.com
# For licensing and other legal details, see the file zrtp_legal.c. # For licensing and other legal details, see the file zrtp_legal.c.
# #
@ -32,7 +32,7 @@ case $target_os in
esac esac
AM_INIT_AUTOMAKE([libzrtp], [0.91]) AM_INIT_AUTOMAKE([libzrtp], [1.12])
AX_PREFIX_CONFIG_H(../../include/zrtp_config_unix.h,ZRTP,config/config.h) AX_PREFIX_CONFIG_H(../../include/zrtp_config_unix.h,ZRTP,config/config.h)
CFLAGS="$CFLAGS -Wno-unused-parameter -fno-strict-aliasing -fPIC -DZRTP_AUTOMAKE=1" CFLAGS="$CFLAGS -Wno-unused-parameter -fno-strict-aliasing -fPIC -DZRTP_AUTOMAKE=1"

@ -314,12 +314,30 @@ static zrtp_status_t _derive_s0(zrtp_stream_t* stream, int is_initiator)
comp_length = zrtp_hton32(1L); comp_length = zrtp_hton32(1L);
session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)&comp_length, 4); session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)&comp_length, 4);
switch (stream->pubkeyscheme->base.id) {
case ZRTP_PKTYPE_DH2048:
case ZRTP_PKTYPE_DH3072:
case ZRTP_PKTYPE_DH4096:
comp_length = stream->pubkeyscheme->pv_length;
ZRTP_LOG(3,(_ZTU_,"DH comp_length=%u\n", comp_length));
break;
case ZRTP_PKTYPE_EC256P:
case ZRTP_PKTYPE_EC384P:
case ZRTP_PKTYPE_EC521P:
comp_length = stream->pubkeyscheme->pv_length/2;
ZRTP_LOG(3,(_ZTU_,"ECDH comp_length=%u\n", comp_length));
break;
default:
break;
}
bnBegin(&dhresult); bnBegin(&dhresult);
stream->pubkeyscheme->compute( stream->pubkeyscheme, stream->pubkeyscheme->compute(stream->pubkeyscheme,
&stream->dh_cc, &stream->dh_cc,
&dhresult, &dhresult,
&stream->dh_cc.peer_pv); &stream->dh_cc.peer_pv);
comp_length = stream->pubkeyscheme->pv_length;
bnExtractBigBytes(&dhresult, (uint8_t *)buffer, 0, comp_length); bnExtractBigBytes(&dhresult, (uint8_t *)buffer, 0, comp_length);
session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)buffer, comp_length); session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)buffer, comp_length);
bnEnd(&dhresult); bnEnd(&dhresult);

@ -430,7 +430,7 @@ zrtp_status_t _zrtp_compute_preshared_key( zrtp_session_t *session,
{ {
static const zrtp_string8_t presh_key_str = ZSTR_INIT_WITH_CONST_CSTRING(ZRTP_COMMIT_HV_KEY_STR); static const zrtp_string8_t presh_key_str = ZSTR_INIT_WITH_CONST_CSTRING(ZRTP_COMMIT_HV_KEY_STR);
zrtp_string32_t preshared_key = ZSTR_INIT_EMPTY(preshared_key); zrtp_string32_t preshared_key = ZSTR_INIT_EMPTY(preshared_key);
static const uint32_t length_rs = ZRTP_RS_SIZE; static uint32_t length_rs = ZRTP_RS_SIZE;
static const uint32_t length_zero = 0; static const uint32_t length_zero = 0;
void *hash_ctx = session->hash->hash_begin(session->hash); void *hash_ctx = session->hash->hash_begin(session->hash);
@ -438,6 +438,8 @@ zrtp_status_t _zrtp_compute_preshared_key( zrtp_session_t *session,
return zrtp_status_alloc_fail; return zrtp_status_alloc_fail;
} }
length_rs = zrtp_hton32(length_rs);
if (rs1) { if (rs1) {
session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)&length_rs, 4); session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)&length_rs, 4);
session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)rs1->buffer, ZRTP_RS_SIZE); session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)rs1->buffer, ZRTP_RS_SIZE);
@ -466,8 +468,8 @@ zrtp_status_t _zrtp_compute_preshared_key( zrtp_session_t *session,
if (key_id) { if (key_id) {
session->hash->hmac_truncated( session->hash, session->hash->hmac_truncated( session->hash,
ZSTR_GV(presh_key_str),
ZSTR_GV(preshared_key), ZSTR_GV(preshared_key),
ZSTR_GV(presh_key_str),
ZRTP_HV_KEY_SIZE, ZRTP_HV_KEY_SIZE,
ZSTR_GVP(key_id)); ZSTR_GVP(key_id));
} }