[Pkg-privacy-commits] [libotr] 158/225: Imported Upstream version 4.0.0
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 12:45:22 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository libotr.
commit 41339e0c77babd1e33e4b537851c5cddf431f324
Author: intrigeri <intrigeri at boum.org>
Date: Tue Feb 18 20:12:58 2014 +0000
Imported Upstream version 4.0.0
---
ChangeLog | 15 +++++++++++++++
README | 2 +-
UPGRADING | 12 ++++++++++++
src/auth.c | 6 +++---
src/context.c | 2 +-
src/message.c | 8 ++++----
src/message.h | 14 +++++++-------
src/proto.c | 6 ++++--
src/proto.h | 7 +++++--
src/sm.c | 2 +-
10 files changed, 53 insertions(+), 21 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 82984bf..9104ee3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2012-09-04
+
+ * README: Release 4.0.0
+
+2012-08-28
+
+ * UPGRADING:
+ * src/proto.h:
+ * src/proto.c: Don't have otrl_init call exit(1) if the
+ application's requested version number differs from libotr's.
+ Rather, return a non-zero error code, and have the application
+ clean up gracefully. The OTRL_INIT macro now checks the error
+ code and does an exit(1) as the default behaviour, but the
+ application can do what it likes.
+
2012-08-27
* src/auth.h:
diff --git a/README b/README
index a2e4983..d3cf5d8 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
Off-the-Record Messaging Library and Toolkit
- v4.0.0, 24 Aug 2012
+ v4.0.0, 4 Sep 2012
This is a library and toolkit which implements Off-the-Record (OTR) Messaging.
diff --git a/UPGRADING b/UPGRADING
index 58cfc78..f7445c3 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -15,6 +15,7 @@ Table of Contents
3.2. Instance Tags
3.3. Fragmentation Changes
3.4. Asynchronous Private Key Generation
+3.5. Library Initialization
1. Introduction
@@ -499,5 +500,16 @@ If the privkey generation was cancelled, the application should call:
void otrl_privkey_generate_cancelled(OtrlUserState us, void *newkey)
+3.5. Library Initialization
+If you currently initialize libotr with the recommended OTRL_INIT;
+macro, you do not need to change anything.
+
+If you call otrl_init(ver_major, ver_minor, ver_sub) directly, then know
+that this function no longer returns void. Previously, if the
+application requested version numbers incompatible with those of the
+library, the library would exit(1). Now, the otrl_init call will return
+a non-zero error code. You must check the return value of otrl_init (a
+gcry_error_t), and if it is non-zero, your application's expected
+API/ABI does not match the installed libotr, and libotr cannot be used.
diff --git a/src/auth.c b/src/auth.c
index 107dee8..74f16c3 100644
--- a/src/auth.c
+++ b/src/auth.c
@@ -194,7 +194,7 @@ gcry_error_t otrl_auth_start_v23(OtrlAuthInfo *auth, int version)
enc = NULL;
/* Now serialize the message */
- lenp = OTRL_HEADER_LEN + (auth->protocol_version == 3 ? 8 : 0) + 4
+ lenp = OTRL_HEADER_LEN + (auth->protocol_version == 3 ? 8 : 0) + 4
+ auth->encgx_len + 4 + 32;
bufp = malloc(lenp);
if (bufp == NULL) goto memerr;
@@ -652,7 +652,7 @@ static gcry_error_t create_revealsig_message(OtrlAuthInfo *auth,
auth->our_dh.pub, auth->their_pub, privkey, auth->our_keyid);
if (err) goto err;
- buflen = OTRL_HEADER_LEN + (auth->protocol_version == 3 ? 8 : 0) + 4 + 16
+ buflen = OTRL_HEADER_LEN + (auth->protocol_version == 3 ? 8 : 0) + 4 + 16
+ 4 + authlen + 20;
buf = malloc(buflen);
if (buf == NULL) goto memerr;
@@ -731,7 +731,7 @@ static gcry_error_t create_signature_message(OtrlAuthInfo *auth,
auth->our_keyid);
if (err) goto err;
- buflen = OTRL_HEADER_LEN + (auth->protocol_version == 3 ? 8 : 0) + 4
+ buflen = OTRL_HEADER_LEN + (auth->protocol_version == 3 ? 8 : 0) + 4
+ authlen + 20;
buf = malloc(buflen);
if (buf == NULL) goto memerr;
diff --git a/src/context.c b/src/context.c
index bdde699..1ba236e 100644
--- a/src/context.c
+++ b/src/context.c
@@ -267,7 +267,7 @@ ConnContext * otrl_context_find(OtrlUserState us, const char *user,
(usercmp == 0 && acctcmp == 0 &&
(protocmp = strcmp((*curp)->protocol, protocol)) > 0) ||
(usercmp == 0 && acctcmp == 0 && protocmp == 0
- && (their_instance < OTRL_MIN_VALID_INSTAG ||
+ && (their_instance < OTRL_MIN_VALID_INSTAG ||
((*curp)->their_instance >= their_instance))))
/* We're at the right place in the list. We've either found
* it, or gone too far. */
diff --git a/src/message.c b/src/message.c
index 5aa14d9..7c39529 100644
--- a/src/message.c
+++ b/src/message.c
@@ -898,10 +898,10 @@ static void message_malformed(const OtrlMessageAppOps *ops,
* "context->app" field, for example. If you don't need to do this, you
* can pass NULL for the last two arguments of otrl_message_receiving.
*
- * If non-NULL, ops->convert_msg will be called after a data message is
+ * If non-NULL, ops->convert_msg will be called after a data message is
* decrypted.
*
- * If "contextp" is not NULL, it will be set to the ConnContext used for
+ * If "contextp" is not NULL, it will be set to the ConnContext used for
* receiving the message.
*
* If otrl_message_receiving returns 1, then the message you received
@@ -1929,7 +1929,7 @@ void otrl_message_disconnect_all_instances(OtrlUserState us,
ConnContext *context;
if (!username || !accountname || !protocol) return;
-
+
context = otrl_context_find(us, username, accountname,
protocol, OTRL_INSTAG_MASTER, 0, NULL, NULL, NULL);
@@ -2015,7 +2015,7 @@ void otrl_message_poll(OtrlUserState us, const OtrlMessageAppOps *ops,
int still_waiting = 0;
if (us == NULL) return;
-
+
for (contextp = us->context_root; contextp; contextp = contextp->next) {
/* If this is a master context, and it's still waiting for a
* v3 DHKEY message, see if it's waited long enough. */
diff --git a/src/message.h b/src/message.h
index 45b1305..7d5ce95 100644
--- a/src/message.h
+++ b/src/message.h
@@ -257,19 +257,19 @@ typedef struct s_OtrlMessageAppOps {
/* When timer_control is called, turn off any existing periodic
* timer.
- *
+ *
* Additionally, if interval > 0, set a new periodic timer
* to go off every interval seconds. When that timer fires, you
* must call otrl_message_poll(userstate, uiops, uiopdata); from the
* main libotr thread.
- *
+ *
* The timing does not have to be exact; this timer is used to
* provide forward secrecy by cleaning up stale private state that
* may otherwise stick around in memory. Note that the
* timer_control callback may be invoked from otrl_message_poll
* itself, possibly to indicate that interval == 0 (that is, that
* there's no more periodic work to be done at this time).
- *
+ *
* If you set this callback to NULL, then you must ensure that your
* application calls otrl_message_poll(userstate, uiops, uiopdata);
* from the main libotr thread every definterval seconds (where
@@ -278,11 +278,11 @@ typedef struct s_OtrlMessageAppOps {
* right after creating the userstate). The advantage of
* implementing the timer_control callback is that the timer can be
* turned on by libotr only when it's needed.
- *
+ *
* It is not a problem (except for a minor performance hit) to call
* otrl_message_poll more often than requested, whether
* timer_control is implemented or not.
- *
+ *
* If you fail to implement the timer_control callback, and also
* fail to periodically call otrl_message_poll, then you open your
* users to a possible forward secrecy violation: an attacker that
@@ -350,10 +350,10 @@ gcry_error_t otrl_message_sending(OtrlUserState us,
* "context->app" field, for example. If you don't need to do this, you
* can pass NULL for the last two arguments of otrl_message_receiving.
*
- * If non-NULL, ops->convert_msg will be called after a data message is
+ * If non-NULL, ops->convert_msg will be called after a data message is
* decrypted.
*
- * If "contextp" is not NULL, it will be set to the ConnContext used for
+ * If "contextp" is not NULL, it will be set to the ConnContext used for
* receiving the message.
*
* If otrl_message_receiving returns 1, then the message you received
diff --git a/src/proto.c b/src/proto.c
index 3522249..b6c773a 100644
--- a/src/proto.c
+++ b/src/proto.c
@@ -48,7 +48,7 @@ unsigned int otrl_api_version = 0;
/* Initialize the OTR library. Pass the version of the API you are
* using. */
-void otrl_init(unsigned int ver_major, unsigned int ver_minor,
+gcry_error_t otrl_init(unsigned int ver_major, unsigned int ver_minor,
unsigned int ver_sub)
{
unsigned int api_version;
@@ -60,7 +60,7 @@ void otrl_init(unsigned int ver_major, unsigned int ver_minor,
"with actual version %u.%u.%u. Aborting.\n",
ver_major, ver_minor, ver_sub,
OTRL_VERSION_MAJOR, OTRL_VERSION_MINOR, OTRL_VERSION_SUB);
- exit(1);
+ return gcry_error(GPG_ERR_INV_VALUE);
}
/* Set the API version. If we get called multiple times for some
@@ -84,6 +84,8 @@ void otrl_init(unsigned int ver_major, unsigned int ver_minor,
fprintf(stderr, "\nlibotr debugging is available. Type %s in a message\n"
" to see debug info.\n\n", OTRL_DEBUGGING_DEBUGSTR);
#endif
+
+ return gcry_error(GPG_ERR_NO_ERROR);
}
/* Return a pointer to a static string containing the version number of
diff --git a/src/proto.h b/src/proto.h
index 3419e9b..28be83f 100644
--- a/src/proto.h
+++ b/src/proto.h
@@ -102,12 +102,15 @@ typedef enum {
/* Initialize the OTR library. Pass the version of the API you are
* using. */
-void otrl_init(unsigned int ver_major, unsigned int ver_minor,
+gcry_error_t otrl_init(unsigned int ver_major, unsigned int ver_minor,
unsigned int ver_sub);
/* Shortcut */
#define OTRL_INIT do { \
- otrl_init(OTRL_VERSION_MAJOR, OTRL_VERSION_MINOR, OTRL_VERSION_SUB); \
+ if (otrl_init(OTRL_VERSION_MAJOR, OTRL_VERSION_MINOR, \
+ OTRL_VERSION_SUB)) { \
+ exit(1); \
+ } \
} while(0)
/* Return a pointer to a static string containing the version number of
diff --git a/src/sm.c b/src/sm.c
index 653030a..4d72825 100644
--- a/src/sm.c
+++ b/src/sm.c
@@ -443,7 +443,7 @@ static gcry_error_t otrl_sm_proof_know_log(gcry_mpi_t *c, gcry_mpi_t *d,
}
/*
- * Verify a proof of knowledge of a discrete logarithm.
+ * Verify a proof of knowledge of a discrete logarithm.
* Checks that c = h(g^d x^c)
*/
static int otrl_sm_check_know_log(const gcry_mpi_t c, const gcry_mpi_t d,
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/libotr.git
More information about the Pkg-privacy-commits
mailing list