From owner-freebsd-current@freebsd.org Sun Dec 29 05:34:57 2019 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 1150D1D4CB5 for ; Sun, 29 Dec 2019 05:34:57 +0000 (UTC) (envelope-from freebsd-rwg@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47lq5C5t0yz48K9 for ; Sun, 29 Dec 2019 05:34:55 +0000 (UTC) (envelope-from freebsd-rwg@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id xBT5YqBr046010; Sat, 28 Dec 2019 21:34:52 -0800 (PST) (envelope-from freebsd-rwg@gndrsh.dnsmgr.net) Received: (from freebsd-rwg@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id xBT5YqVp046009; Sat, 28 Dec 2019 21:34:52 -0800 (PST) (envelope-from freebsd-rwg) From: "Rodney W. Grimes" Message-Id: <201912290534.xBT5YqVp046009@gndrsh.dnsmgr.net> Subject: Re: OpenSSL breaks factor(6) In-Reply-To: <20191229051035.GA68947@troutmask.apl.washington.edu> To: sgk@troutmask.apl.washington.edu Date: Sat, 28 Dec 2019 21:34:52 -0800 (PST) CC: Garance A Drosehn , freebsd-current@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 47lq5C5t0yz48K9 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd-rwg@gndrsh.dnsmgr.net has no SPF policy when checking 69.59.192.140) smtp.mailfrom=freebsd-rwg@gndrsh.dnsmgr.net X-Spamd-Result: default: False [-0.46 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.72)[-0.716,0]; RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[dnsmgr.net]; AUTH_NA(1.00)[]; NEURAL_HAM_LONG(-0.68)[-0.682,0]; TO_MATCH_ENVRCPT_SOME(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:13868, ipnet:69.59.192.0/19, country:US]; MID_RHS_MATCH_FROM(0.00)[]; IP_SCORE(0.04)[ip: (0.14), ipnet: 69.59.192.0/19(0.07), asn: 13868(0.02), country: US(-0.05)]; 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: Sun, 29 Dec 2019 05:34:57 -0000 > On Sat, Dec 28, 2019 at 10:46:52PM -0500, Garance A Drosehn wrote: > > On 27 Dec 2019, at 17:42, Steve Kargl wrote: > > > > > > This patch now includes a fix for hexadecimal conversion. It > > > simple scans the string for a hex digit in [a,...,f] and assumes > > > that a hexadecimal string has been entered. A string that includes > > > character from the decimal digits is assumed to by a decimal > > > representation. > > > > What if the user wants to factor a hexadecimal value which does not > > happen to include [a...f]? > > > > How about recognizing a prefix of '0x' as a way to indicate the value > > is hexadecimal? > > > > An interested user will need to add that support. AFAIK, factor(6) > has never recognized the 0x prefix, and I'm not trying to add new > features. I'm simply fixing factor(6) to match its documentation, > and trying to ensure WITH_OPENSSL and WITHOUT_OPENSSL give the > same results where applicable. > > The logic is to first try to convert the string to a decimal if > the leading digits are members of the set [0,...,9]. If this > conversion fails, then try to convert the string as a hexadecimal > number. A problem occurs because OpenSSL's BN_dec2bn does not fail > for a number like '1abc' (converts it to 1) whereas the local > implementation of BN_dec2bn fails during the conversion, and so > the BN_hex2bn function is executed and '1abc' is converted. Wasnt the hex conversion undocumented? Since it seems to have issues, and is of dubious value might it might be best to just remove it? > -- > Steve -- Rod Grimes rgrimes@freebsd.org