]> andersk Git - openssh.git/blobdiff - dh.c
- (dtucker) [auth-sia.c] Bug #1241: support password expiry on Tru64 SIA
[openssh.git] / dh.c
diff --git a/dh.c b/dh.c
index 78e230b9f2417c4233748c8e5fb6606167284843..0908fcf113798fdb61cc570ff80c90c430158e49 100644 (file)
--- a/dh.c
+++ b/dh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dh.c,v 1.44 2006/11/07 13:02:07 markus Exp $ */
+/* $OpenBSD: dh.c,v 1.46 2008/04/13 00:22:17 djm Exp $ */
 /*
  * Copyright (c) 2000 Niels Provos.  All rights reserved.
  *
@@ -153,7 +153,7 @@ choose_dh(int min, int wantbits, int max)
        }
 
        linenum = 0;
-       which = arc4random() % bestcount;
+       which = arc4random_uniform(bestcount);
        while (fgets(line, sizeof(line), f)) {
                if (!parse_prime(linenum, line, &dhg))
                        continue;
@@ -185,7 +185,7 @@ dh_pub_is_valid(DH *dh, BIGNUM *dh_pub)
        BIGNUM *tmp;
 
        if (dh_pub->neg) {
-               logit("invalid public DH value: negativ");
+               logit("invalid public DH value: negative");
                return 0;
        }
        if (BN_cmp(dh_pub, BN_value_one()) != 1) {      /* pub_exp <= 1 */
@@ -193,8 +193,10 @@ dh_pub_is_valid(DH *dh, BIGNUM *dh_pub)
                return 0;
        }
 
-       if ((tmp = BN_new()) == NULL)
-               return (-1);
+       if ((tmp = BN_new()) == NULL) {
+               error("%s: BN_new failed", __func__);
+               return 0;
+       }
        if (!BN_sub(tmp, dh->p, BN_value_one()) ||
            BN_cmp(dh_pub, tmp) != -1) {                /* pub_exp > p-2 */
                BN_clear_free(tmp);
This page took 0.033608 seconds and 4 git commands to generate.