From: Nick Owens <mischief@offblast.org>
To: 9front@9front.org
Subject: Re: [9front] mpmod aliasing
Date: Sat, 4 Feb 2017 16:26:45 -0800 [thread overview]
Message-ID: <CAH_zEu7MwgkRsVJF4CJZWGN1GL7WQANV+Yz+CDzcy18fi16_AA@mail.gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1702050108240.4258@phi>
for reference, i found this in rsafill()'s call mpmod(c2, x, x), where
d parameter is negative (rsagen created a rsa key with negative dk).
On Sat, Feb 4, 2017 at 4:09 PM, Julius Schmidt <aiju@phicode.de> wrote:
> mpmod has a bug when n==r and x is negative.
> my best attempt at a fix:
>
> void
> mpmod(mpint *x, mpint *n, mpint *r)
> {
> int sign;
> mpint *ns;
>
> sign = x->sign;
> ns = sign < 0 && n == r ? mpcopy(n) : n;
> if((n->flags & MPfield) == 0
> || ((Mfield*)n)->reduce((Mfield*)n, x, r) != 0)
> mpdiv(x, n, nil, r);
> if(sign < 0)
> mpmagsub(ns, r, r);
> if(ns != n) mpfree(ns);
> }
>
next prev parent reply other threads:[~2017-02-05 0:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-05 0:09 Julius Schmidt
2017-02-05 0:26 ` Nick Owens [this message]
2017-02-05 1:40 ` [9front] " cinap_lenrek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAH_zEu7MwgkRsVJF4CJZWGN1GL7WQANV+Yz+CDzcy18fi16_AA@mail.gmail.com \
--to=mischief@offblast.org \
--cc=9front@9front.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).