public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mike Hearn <mike@plan99.net>
To: Bryce McKinlay <bmckinlay@gmail.com>, GCC Java <java@gcc.gnu.org>
Subject: Re: Which library implementation to use/work on?
Date: Wed, 30 May 2012 21:14:00 -0000	[thread overview]
Message-ID: <CANEZrP3p5tm+qzcOQHN-ty67UbCXYK2cKMCU=oyEL59eceD3gQ@mail.gmail.com> (raw)
In-Reply-To: <CANEZrP0QcpHjxKHWoi=A8+CcE2gPzm2_eO4_PG5=BmMHj-f_+Q@mail.gmail.com>

Sorry Bryce, +mailing list ...

On Wed, May 30, 2012 at 11:13 PM, Mike Hearn <mike@plan99.net> wrote:
> Ugh, mailing lists that reject HTML ...
>
> OK, looks like GMP does indeed implement "next probable prime". All
> that's required is plumbing it through.
>
>> One step forward, one step back.
>>
>> I recently upgraded to the latest Bouncy Castle. It now contains an
>> implementation of "NTRU", an obscure crypto system that is theoretically
>> resistant to quantum computer attacks.
>>
>> Unfortunately the NTRU library uses BigInteger.nextProbablePrime(), which
>> is not implemented. I don't know if the GNU biginteger library makes it easy
>> to support this, so will take a quick look at how easy it is to expunge NTRU
>> from Bouncy Castle.
>>
>> On Tue, Apr 10, 2012 at 5:53 PM, Mike Hearn <mike@plan99.net> wrote:
>>>
>>> I finally got there, w00t! It turned out to be easier to switch to the
>>> "lite" versions of BouncyCastle and protobufs than to upgrade
>>> classpath, so that's what I did, and now I have a spiffy CNI exposed
>>> API that can be used from C++, which is what I was after. Thanks!
>>>
>>> On Sun, Apr 8, 2012 at 3:18 PM, Mike Hearn <mike@plan99.net> wrote:
>>> > Thanks, I got it to work eventually. That switch disables building of
>>> > ecj so I had to first compile without it, then install, then adjust my
>>> > path, then reconfigure/make/make install - bit confusing.
>>> >
>>> > I then encountered a couple of other issues. Firstly it seems there's
>>> > something odd about the Google protocol buffers library that gcj does
>>> > not like:
>>> >
>>> > com/google/protobuf/SingleFieldBuilder.java: In method
>>> >
>>> > 'com.google.protobuf.SingleFieldBuilder.mergeFrom(com.google.protobuf.GeneratedMessage)':
>>> > com/google/protobuf/SingleFieldBuilder.java:192:0: error: class
>>> > 'com.google.protobuf.GeneratedMessage' has no method named
>>> > 'getDefaultInstanceForType' matching signature
>>> > '()Lcom/google/protobuf/Message;'
>>> >
>>> > The code is some morass of generics so it's hard for me to figure out
>>> > what the issue is here. The relevant code is:
>>> >
>>> > public class SingleFieldBuilder
>>> >    <MType extends GeneratedMessage,
>>> >     BType extends GeneratedMessage.Builder,
>>> >     IType extends MessageOrBuilder>
>>> >    implements GeneratedMessage.BuilderParent {
>>> >
>>> >  ....
>>> >  private MType message;
>>> >
>>> >  public SingleFieldBuilder<MType, BType, IType> mergeFrom(
>>> >      MType value) {
>>> >    if (builder == null && message ==
>>> > message.getDefaultInstanceForType()) {
>>> >      message = value;
>>> >    } else {
>>> >      getBuilder().mergeFrom(value);
>>> >    }
>>> >    onChanged();
>>> >    return this;
>>> >  }
>>> > }
>>> >
>>> > Sure enough the GeneratedMessage class doesn't have
>>> > getDefaultInstanceForType - it's implemented by subclasses.
>>> >
>>> > GeneratedMessage says this at the top:
>>> >
>>> >
>>> > /**
>>> >  * All generated protocol message classes extend this class.  This
>>> > class
>>> >  * implements most of the Message and Builder interfaces using Java
>>> > reflection.
>>> >  * Users can ignore this class and pretend that generated messages
>>> > implement
>>> >  * the Message interface directly.
>>> >  *
>>> >  * @author kenton@google.com Kenton Varda
>>> >  */
>>> >
>>> > I suspect the reference to "implementing most of the interfaces using
>>> > reflection" is key. I don't know what that means exactly, the class is
>>> > very large and complicated:
>>> >
>>> >
>>> > http://code.google.com/p/protobuf/source/browse/trunk/java/src/main/java/com/google/protobuf/GeneratedMessage.java
>>> >
>>> > I switched to the "lite" runtime which is simpler and the issue went
>>> > away.
>>> >
>>> > The next problem is more stubs in classpath: specifically the elliptic
>>> > curve related classes in java.security.spec. I'm already using
>>> > BouncyCastle to implement the EC crypto - these classes are literally
>>> > just data structures. They're probably quite trivial to do.
>>> >
>>> > I'll try copying the equivalent code from openjdk and see if that
>>> > works.
>>
>>

      parent reply	other threads:[~2012-05-30 21:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-13 16:57 Mike Hearn
2012-03-13 17:07 ` Andrew Haley
2012-03-13 18:26 ` Mike Hearn
2012-03-13 18:39   ` Andrew Haley
2012-03-14 10:40   ` Mike Hearn
2012-03-14 10:43     ` Chris Burdess
2012-03-14 11:11       ` Mike Hearn
2012-03-14 11:12         ` Andrew Haley
2012-03-14 12:14 ` Andrew Hughes
2012-03-14 12:17   ` Mike Hearn
2012-03-14 12:31     ` Andrew Hughes
2012-03-14 12:35       ` Mike Hearn
2012-03-14 18:32         ` Andrew Hughes
2012-03-15 12:24           ` Mike Hearn
2012-03-15 12:37             ` Andrew Hughes
2012-04-07 15:29               ` Mike Hearn
2012-04-07 18:28                 ` Bryce McKinlay
2012-04-08 13:18                   ` Mike Hearn
2012-04-10 15:53                     ` Mike Hearn
     [not found]                       ` <CANEZrP2ukT8zjNjma9yBREJ6wEuhdU6Qb=bPSOjemTYjzwrH5g@mail.gmail.com>
     [not found]                         ` <CANEZrP0QcpHjxKHWoi=A8+CcE2gPzm2_eO4_PG5=BmMHj-f_+Q@mail.gmail.com>
2012-05-30 21:14                           ` Mike Hearn [this message]

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='CANEZrP3p5tm+qzcOQHN-ty67UbCXYK2cKMCU=oyEL59eceD3gQ@mail.gmail.com' \
    --to=mike@plan99.net \
    --cc=bmckinlay@gmail.com \
    --cc=java@gcc.gnu.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 read-only IMAP folder(s) and NNTP newsgroup(s).