From owner-freebsd-current@freebsd.org Mon Jan 6 20:05:22 2020 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 565311E8765 for ; Mon, 6 Jan 2020 20:05:22 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "troutmask", Issuer "troutmask" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 47s61s0RPhz48YT for ; Mon, 6 Jan 2020 20:05:20 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.15.2/8.15.2) with ESMTPS id 006K5CvV093938 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO) for ; Mon, 6 Jan 2020 12:05:12 -0800 (PST) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.15.2/8.15.2/Submit) id 006K5C3J093937 for freebsd-current@freebsd.org; Mon, 6 Jan 2020 12:05:12 -0800 (PST) (envelope-from sgk) Date: Mon, 6 Jan 2020 12:05:12 -0800 From: Steve Kargl To: freebsd-current@freebsd.org Subject: Re: OpenSSL breaks factor(6) Message-ID: <20200106200512.GA93930@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu References: <20191227212530.GA61314@troutmask.apl.washington.edu> <20191229160247.GA72129@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191229160247.GA72129@troutmask.apl.washington.edu> User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 47s61s0RPhz48YT X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=washington.edu (policy=none); spf=none (mx1.freebsd.org: domain of sgk@troutmask.apl.washington.edu has no SPF policy when checking 128.95.76.21) smtp.mailfrom=sgk@troutmask.apl.washington.edu X-Spamd-Result: default: False [-2.22 / 15.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.00)[sgk@troutmask.apl.washington.edu]; DMARC_POLICY_SOFTFAIL(0.10)[washington.edu : No valid SPF, No valid DKIM,none]; NEURAL_HAM_MEDIUM(-0.99)[-0.994,0]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; IP_SCORE(-0.23)[ip: (0.05), ipnet: 128.95.0.0/16(-0.25), asn: 73(-0.90), country: US(-0.05)]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-current@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; REPLYTO_ADDR_EQ_FROM(0.00)[]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:73, ipnet:128.95.0.0/16, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Jan 2020 20:05:22 -0000 On Sun, Dec 29, 2019 at 08:02:47AM -0800, Steve Kargl wrote: > Here's a final attempt at fixing and documenting FreeBSD's factor(6). > Do what you want with the patch. With and without OpenSSL, one now > gets > > % factor +123 123 123zzzz 123zabc 123abc +123abc 0x123abc +0x123abc > 123: 3 41 > 123: 3 41 > 123: 3 41 > 123: 3 41 > 1194684: 2 2 3 29 3433 > 1194684: 2 2 3 29 3433 > 1194684: 2 2 3 29 3433 > 1194684: 2 2 3 29 3433 > > * usr.bin/factor/factor.6: > . Update documentation to note that hexadecimal strings are accepted. > . Document that a hexadecimal number can have an optional 0x or 0X prefix. > . Document that a 0 value in interactive mode terminates factor(6). > . Fix the maximum value for 'stop' in primes(6). > . While here, spell "white-space" as "whitespace" and "non-digit" as > "nondigit". > > * usr.bin/factor/factor.c: > . Include stdbool to get acces to bool type. > . Use consistent style for function prototypes. > . New function. is_hex_str() looks for the longest substring and > determines if it is a hexadecimal number. > . New function. Factor (pun intended) out common code into convert_str2bn(). > . For the WIHTOUT_OPENSSL case, make BN_dec2bn() and BN_hex2bn() return 0 > on error like their OpenSSL counterparts. > > * usr.bin/primes/primes.c: > . Fix comment. > This is now https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=243136 -- steve