]> andersk Git - openssh.git/blobdiff - mac.c
- (tim) [configure.ac] Bug #1149. Changes in QNX section only. Patch by
[openssh.git] / mac.c
diff --git a/mac.c b/mac.c
index ab9a03d84e867379aa8386d9b1b4a137c9f14293..2bda5a1b994928ebd6bbde55dcc3c6693190d495 100644 (file)
--- a/mac.c
+++ b/mac.c
@@ -23,7 +23,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: mac.c,v 1.5 2002/05/16 22:02:50 markus Exp $");
+RCSID("$OpenBSD: mac.c,v 1.7 2005/06/17 02:44:32 djm Exp $");
 
 #include <openssl/hmac.h>
 
@@ -51,12 +51,15 @@ struct {
 int
 mac_init(Mac *mac, char *name)
 {
-       int i;
+       int i, evp_len;
+
        for (i = 0; macs[i].name; i++) {
                if (strcmp(name, macs[i].name) == 0) {
                        if (mac != NULL) {
                                mac->md = (*macs[i].mdfunc)();
-                               mac->key_len = mac->mac_len = EVP_MD_size(mac->md);
+                               if ((evp_len = EVP_MD_size(mac->md)) <= 0)
+                                       fatal("mac %s len %d", name, evp_len);
+                               mac->key_len = mac->mac_len = (u_int)evp_len;
                                if (macs[i].truncatebits != 0)
                                        mac->mac_len = macs[i].truncatebits/8;
                        }
This page took 0.032101 seconds and 4 git commands to generate.