projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Enable and fix many extra warnings supported by GCC and Clang.
[tinc]
/
src
/
gcrypt
/
digest.c
diff --git
a/src/gcrypt/digest.c
b/src/gcrypt/digest.c
index
c8d4b31
..
1795277
100644
(file)
--- a/
src/gcrypt/digest.c
+++ b/
src/gcrypt/digest.c
@@
-1,6
+1,6
@@
/*
digest.c -- Digest handling
/*
digest.c -- Digest handling
- Copyright (C) 2007-20
1
2 Guus Sliepen <guus@tinc-vpn.org>
+ Copyright (C) 2007-20
2
2 Guus Sliepen <guus@tinc-vpn.org>
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
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
@@
-17,10
+17,11
@@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include "system.h"
+#include "
../
system.h"
#include "digest.h"
#include "digest.h"
-#include "logger.h"
+#include "../digest.h"
+#include "../logger.h"
static struct {
const char *name;
static struct {
const char *name;
@@
-35,9
+36,7
@@
static struct {
};
static bool nametodigest(const char *name, enum gcry_md_algos *algo) {
};
static bool nametodigest(const char *name, enum gcry_md_algos *algo) {
- int i;
-
- for(i = 0; i < sizeof(digesttable) / sizeof(*digesttable); i++) {
+ for(size_t i = 0; i < sizeof(digesttable) / sizeof(*digesttable); i++) {
if(digesttable[i].name && !strcasecmp(name, digesttable[i].name)) {
*algo = digesttable[i].algo;
return true;
if(digesttable[i].name && !strcasecmp(name, digesttable[i].name)) {
*algo = digesttable[i].algo;
return true;
@@
-48,7
+47,7
@@
static bool nametodigest(const char *name, enum gcry_md_algos *algo) {
}
static bool nidtodigest(int nid, enum gcry_md_algos *algo) {
}
static bool nidtodigest(int nid, enum gcry_md_algos *algo) {
- for(
in
t i = 0; i < sizeof(digesttable) / sizeof(*digesttable); i++) {
+ for(
size_
t i = 0; i < sizeof(digesttable) / sizeof(*digesttable); i++) {
if(nid == digesttable[i].nid) {
*algo = digesttable[i].algo;
return true;
if(nid == digesttable[i].nid) {
*algo = digesttable[i].algo;
return true;
@@
-59,7
+58,7
@@
static bool nidtodigest(int nid, enum gcry_md_algos *algo) {
}
static bool digesttonid(enum gcry_md_algos algo, int *nid) {
}
static bool digesttonid(enum gcry_md_algos algo, int *nid) {
- for(
in
t i = 0; i < sizeof(digesttable) / sizeof(*digesttable); i++) {
+ for(
size_
t i = 0; i < sizeof(digesttable) / sizeof(*digesttable); i++) {
if(algo == digesttable[i].algo) {
*nid = digesttable[i].nid;
return true;
if(algo == digesttable[i].algo) {
*nid = digesttable[i].nid;
return true;
@@
-77,7
+76,7
@@
static bool digest_open(digest_t *digest, enum gcry_md_algos algo, size_t maclen
unsigned int len = gcry_md_get_algo_dlen(algo);
unsigned int len = gcry_md_get_algo_dlen(algo);
- if(maclength > len
|| maclength < 0
) {
+ if(maclength > len) {
digest->maclength = len;
} else {
digest->maclength = maclength;
digest->maclength = len;
} else {
digest->maclength = maclength;
@@
-111,10
+110,6
@@
bool digest_open_by_nid(digest_t *digest, int nid, size_t maclength) {
return digest_open(digest, algo, maclength);
}
return digest_open(digest, algo, maclength);
}
-bool digest_open_sha1(digest_t *digest, size_t maclength) {
- return digest_open(digest, GCRY_MD_SHA1, maclength);
-}
-
void digest_close(digest_t *digest) {
if(digest->hmac) {
gcry_md_close(digest->hmac);
void digest_close(digest_t *digest) {
if(digest->hmac) {
gcry_md_close(digest->hmac);