[Pkg-privacy-commits] [libotr] 83/225: #define the magic value 45 (the length of a human-readable fingerprint)
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 12:44:59 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 e31c21d5a4901fa2fa5c57c8ec07b4365138df1f
Author: Ian Goldberg <iang at cs.uwaterloo.ca>
Date: Thu Jul 19 11:01:08 2012 -0400
#define the magic value 45 (the length of a human-readable fingerprint)
---
src/privkey.c | 7 +++++--
src/privkey.h | 11 +++++++++--
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/privkey.c b/src/privkey.c
index 5411b63..f57f2b8 100644
--- a/src/privkey.c
+++ b/src/privkey.c
@@ -32,7 +32,9 @@
#include "serial.h"
/* Convert a 20-byte hash value to a 45-byte human-readable value */
-void otrl_privkey_hash_to_human(char human[45], const unsigned char hash[20])
+void otrl_privkey_hash_to_human(
+ char human[OTRL_PRIVKEY_FPRINT_HUMAN_LEN],
+ const unsigned char hash[20])
{
int word, byte;
char *p = human;
@@ -52,7 +54,8 @@ void otrl_privkey_hash_to_human(char human[45], const unsigned char hash[20])
/* Calculate a human-readable hash of our DSA public key. Return it in
* the passed fingerprint buffer. Return NULL on error, or a pointer to
* the given buffer on success. */
-char *otrl_privkey_fingerprint(OtrlUserState us, char fingerprint[45],
+char *otrl_privkey_fingerprint(OtrlUserState us,
+ char fingerprint[OTRL_PRIVKEY_FPRINT_HUMAN_LEN],
const char *accountname, const char *protocol)
{
unsigned char hash[20];
diff --git a/src/privkey.h b/src/privkey.h
index 0fd2a46..3b2c173 100644
--- a/src/privkey.h
+++ b/src/privkey.h
@@ -25,13 +25,20 @@
#include "privkey-t.h"
#include "userstate.h"
+/* The length of a string representing a human-readable version of a
+ * fingerprint (including the trailing NUL) */
+#define OTRL_PRIVKEY_FPRINT_HUMAN_LEN 45
+
/* Convert a 20-byte hash value to a 45-byte human-readable value */
-void otrl_privkey_hash_to_human(char human[45], const unsigned char hash[20]);
+void otrl_privkey_hash_to_human(
+ char human[OTRL_PRIVKEY_FPRINT_HUMAN_LEN],
+ const unsigned char hash[20]);
/* Calculate a human-readable hash of our DSA public key. Return it in
* the passed fingerprint buffer. Return NULL on error, or a pointer to
* the given buffer on success. */
-char *otrl_privkey_fingerprint(OtrlUserState us, char fingerprint[45],
+char *otrl_privkey_fingerprint(OtrlUserState us,
+ char fingerprint[OTRL_PRIVKEY_FPRINT_HUMAN_LEN],
const char *accountname, const char *protocol);
/* Calculate a raw hash of our DSA public key. Return it in the passed
--
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