All of lore.kernel.org
 help / color / mirror / Atom feed
* Java userspace test (contrib/external-tests/java)
@ 2017-04-18  1:39 crasm
  2017-04-18  1:54 ` Jason A. Donenfeld
  0 siblings, 1 reply; 3+ messages in thread
From: crasm @ 2017-04-18  1:39 UTC (permalink / raw)
  To: wireguard

Hello,

I've written an initial attempt for a java userspace test in
[contrib/external-tests/java][], but am currently not getting any
response back from my own wireguard server or the demo server. 

[contrib/external-tests/java]:
https://github.com/crasm/WireGuard/blob/master/contrib/external-tests/java/src/main/java/wireguard/Main.java

I'm fairly sure the problem is in my code, but I'm not sure how to
debug. Is there anyone who would be willing to take a look at this and
compare it to the other external tests?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Java userspace test (contrib/external-tests/java)
  2017-04-18  1:39 Java userspace test (contrib/external-tests/java) crasm
@ 2017-04-18  1:54 ` Jason A. Donenfeld
  2017-04-19 16:06   ` crasm
  0 siblings, 1 reply; 3+ messages in thread
From: Jason A. Donenfeld @ 2017-04-18  1:54 UTC (permalink / raw)
  To: crasm; +Cc: WireGuard mailing list

>From your code:

Blake2sMessageDigest blake2s = new Blake2sMessageDigest(preshared);
blake2s.update(theirPublic);
blake2s.update(buf.array(), 0, buf.position());
// Note: Blake2s returns 32 bytes, but we only use the first 16.
buf.put(blake2s.digest(), 0, 16);

The final length needs to be passed to Blake2sMessageDigest in the
constructor, because Blake2 encodes the final length into the initial
block. The implementation from here might work better:
https://github.com/Geal/android-wireguard/blob/master/app/src/main/java/com/southernstorm/noise/crypto/Blake2sMessageDigest.java

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Java userspace test (contrib/external-tests/java)
  2017-04-18  1:54 ` Jason A. Donenfeld
@ 2017-04-19 16:06   ` crasm
  0 siblings, 0 replies; 3+ messages in thread
From: crasm @ 2017-04-19 16:06 UTC (permalink / raw)
  To: Jason A. Donenfeld; +Cc: WireGuard mailing list

I did replace it, but I'm still having the same problem.

https://github.com/crasm/noise-java/blob/wireguard-contrib-external-tests/src/main/java/com/southernstorm/noise/crypto/Blake2sMessageDigest.java
https://github.com/crasm/WireGuard/blob/master/contrib/external-tests/java/src/main/java/wireguard/Main.java

If anyone can help, it would be appreciated, but I'll continue debugging
on my own as well.

On Mon, Apr 17, 2017, at 09:54 PM, Jason A. Donenfeld wrote:
> From your code:
> 
> Blake2sMessageDigest blake2s = new Blake2sMessageDigest(preshared);
> blake2s.update(theirPublic);
> blake2s.update(buf.array(), 0, buf.position());
> // Note: Blake2s returns 32 bytes, but we only use the first 16.
> buf.put(blake2s.digest(), 0, 16);
> 
> The final length needs to be passed to Blake2sMessageDigest in the
> constructor, because Blake2 encodes the final length into the initial
> block. The implementation from here might work better:
> https://github.com/Geal/android-wireguard/blob/master/app/src/main/java/com/southernstorm/noise/crypto/Blake2sMessageDigest.java

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-19 15:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-18  1:39 Java userspace test (contrib/external-tests/java) crasm
2017-04-18  1:54 ` Jason A. Donenfeld
2017-04-19 16:06   ` crasm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.