From owner-svn-src-projects@freebsd.org Wed Sep 19 07:08:28 2018 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15D4D1091BF7 for ; Wed, 19 Sep 2018 07:08:28 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B883C7490F; Wed, 19 Sep 2018 07:08:27 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B1BDA3AFD; Wed, 19 Sep 2018 07:08:27 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8J78R5I072134; Wed, 19 Sep 2018 07:08:27 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8J78RYn072133; Wed, 19 Sep 2018 07:08:27 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201809190708.w8J78RYn072133@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Wed, 19 Sep 2018 07:08:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r338784 - projects/openssl111/usr.bin/dc X-SVN-Group: projects X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: projects/openssl111/usr.bin/dc X-SVN-Commit-Revision: 338784 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Sep 2018 07:08:28 -0000 Author: jkim Date: Wed Sep 19 07:08:27 2018 New Revision: 338784 URL: https://svnweb.freebsd.org/changeset/base/338784 Log: Make dc(1) buildable. Modified: projects/openssl111/usr.bin/dc/bcode.c projects/openssl111/usr.bin/dc/inout.c Modified: projects/openssl111/usr.bin/dc/bcode.c ============================================================================== --- projects/openssl111/usr.bin/dc/bcode.c Wed Sep 19 07:08:04 2018 (r338783) +++ projects/openssl111/usr.bin/dc/bcode.c Wed Sep 19 07:08:27 2018 (r338784) @@ -594,7 +594,7 @@ set_scale(void) warnx("scale must be a nonnegative number"); else { scale = get_ulong(n); - if (scale != BN_MASK2 && scale <= UINT_MAX) + if (scale != ULONG_MAX && scale <= UINT_MAX) bmachine.scale = (u_int)scale; else warnx("scale too large"); @@ -622,7 +622,7 @@ set_obase(void) n = pop_number(); if (n != NULL) { base = get_ulong(n); - if (base != BN_MASK2 && base > 1 && base <= UINT_MAX) + if (base != ULONG_MAX && base > 1 && base <= UINT_MAX) bmachine.obase = (u_int)base; else warnx("output base must be a number greater than 1"); @@ -649,7 +649,7 @@ set_ibase(void) n = pop_number(); if (n != NULL) { base = get_ulong(n); - if (base != BN_MASK2 && 2 <= base && base <= 16) + if (base != ULONG_MAX && 2 <= base && base <= 16) bmachine.ibase = (u_int)base; else warnx("input base must be a number between 2 and 16 " @@ -889,7 +889,7 @@ load_array(void) idx = get_ulong(inumber); if (BN_is_negative(inumber->number)) warnx("negative idx"); - else if (idx == BN_MASK2 || idx > MAX_ARRAY_INDEX) + else if (idx == ULONG_MAX || idx > MAX_ARRAY_INDEX) warnx("idx too big"); else { stack = &bmachine.reg[reg]; @@ -929,7 +929,7 @@ store_array(void) if (BN_is_negative(inumber->number)) { warnx("negative idx"); stack_free_value(value); - } else if (idx == BN_MASK2 || idx > MAX_ARRAY_INDEX) { + } else if (idx == ULONG_MAX || idx > MAX_ARRAY_INDEX) { warnx("idx too big"); stack_free_value(value); } else { @@ -1218,7 +1218,7 @@ bexp(void) b = BN_get_word(p->number); m = max(a->scale, bmachine.scale); rscale = a->scale * (u_int)b; - if (rscale > m || (a->scale > 0 && (b == BN_MASK2 || + if (rscale > m || (a->scale > 0 && (b == ULONG_MAX || b > UINT_MAX))) rscale = m; } @@ -1587,7 +1587,7 @@ quitN(void) return; i = get_ulong(n); free_number(n); - if (i == BN_MASK2 || i == 0) + if (i == ULONG_MAX || i == 0) warnx("Q command requires a number >= 1"); else if (bmachine.readsp < i) warnx("Q command argument exceeded string execution depth"); @@ -1609,7 +1609,7 @@ skipN(void) if (n == NULL) return; i = get_ulong(n); - if (i == BN_MASK2) + if (i == ULONG_MAX) warnx("J command requires a number >= 0"); else if (i > 0 && bmachine.readsp < i) warnx("J command argument exceeded string execution depth"); Modified: projects/openssl111/usr.bin/dc/inout.c ============================================================================== --- projects/openssl111/usr.bin/dc/inout.c Wed Sep 19 07:08:04 2018 (r338783) +++ projects/openssl111/usr.bin/dc/inout.c Wed Sep 19 07:08:27 2018 (r338784) @@ -362,19 +362,21 @@ printnumber(FILE *f, const struct number *b, u_int bas stack_clear(&stack); if (b->scale > 0) { struct number *num_base; - BIGNUM mult, stop; + BIGNUM *mult, *stop; putcharwrap(f, '.'); num_base = new_number(); bn_check(BN_set_word(num_base->number, base)); - BN_init(&mult); - bn_check(BN_one(&mult)); - BN_init(&stop); - bn_check(BN_one(&stop)); - scale_number(&stop, b->scale); + mult = BN_new(); + bn_checkp(mult); + bn_check(BN_one(mult)); + stop = BN_new(); + bn_checkp(stop); + bn_check(BN_one(stop)); + scale_number(stop, b->scale); i = 0; - while (BN_cmp(&mult, &stop) < 0) { + while (BN_cmp(mult, stop) < 0) { u_long rem; if (i && base > 16) @@ -392,11 +394,11 @@ printnumber(FILE *f, const struct number *b, u_int bas int_part->number)); printwrap(f, p); free(p); - bn_check(BN_mul_word(&mult, base)); + bn_check(BN_mul_word(mult, base)); } free_number(num_base); - BN_free(&mult); - BN_free(&stop); + BN_free(mult); + BN_free(stop); } flushwrap(f); free_number(int_part);