Commit f1051fd4 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Fix constants to be consistent with SHA-256.

Also rename DIGEST_LEN to MAX_DIGEST_LEN.
parent 9688b688
...@@ -226,7 +226,7 @@ add_hmac(struct buffered *buf, struct interface *ifp, ...@@ -226,7 +226,7 @@ add_hmac(struct buffered *buf, struct interface *ifp,
} }
src = ifp->ll[0]; src = ifp->ll[0];
if(buf->len + 2 + DIGEST_LEN > buf->size) { if(buf->len + 2 + MAX_DIGEST_LEN > buf->size) {
fprintf(stderr, "Buffer overflow in add_hmac.\n"); fprintf(stderr, "Buffer overflow in add_hmac.\n");
return -1; return -1;
} }
...@@ -248,7 +248,7 @@ compare_hmac(const unsigned char *src, const unsigned char *dst, ...@@ -248,7 +248,7 @@ compare_hmac(const unsigned char *src, const unsigned char *dst,
const unsigned char *packet, int bodylen, const unsigned char *packet, int bodylen,
const unsigned char *hmac, int hmaclen) const unsigned char *hmac, int hmaclen)
{ {
unsigned char true_hmac[DIGEST_LEN]; unsigned char true_hmac[MAX_DIGEST_LEN];
int true_hmaclen; int true_hmaclen;
int i; int i;
for(i = 0; i < numkeys; i++) { for(i = 0; i < numkeys; i++) {
......
...@@ -20,9 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ...@@ -20,9 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
#define DIGEST_LEN 20 #define MAX_DIGEST_LEN 32
#define SHA1_BLOCK_SIZE 64
#define RIPEMD160_BLOCK_SIZE 64
struct key *find_key(const char *id); struct key *find_key(const char *id);
struct key *retain_key(struct key *key); struct key *retain_key(struct key *key);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment