Giter VIP home page Giter VIP logo

Comments (12)

kriskwiatkowski avatar kriskwiatkowski commented on June 1, 2024 1

As far as I remember FourQ uses MULXQ instruction which may not be supported on your CPU.

MULXQ R8, R12, R13 \

The fix which worked for me was to first check if CPU supports MULX and, if not, fallback to unoptimized implementation which doesn't use assembly (I think I needed to add non-assembly implementation to my local clone).

Obviously using newer CPU "solves" the issue :)

from circl.

billbuchanan avatar billbuchanan commented on June 1, 2024 1

You are correct. It was using the old version of the code. I had to remove the old version of the Circl library, and fully re-download. It works perfectly now:

Online demo

from circl.

armfazh avatar armfazh commented on June 1, 2024

@billbuchanan we will investigate this issue. In the meantime, which Go version did you use? Did you see this error with other keys, or it is a consistent error for any key? Which CPU model are you using, e.g. Core i5-4000x?

from circl.

billbuchanan avatar billbuchanan commented on June 1, 2024

I am using Go 1.12.6 windows/amd64

I have managed to get all of the other key exchange methods to work (post-quantum, X25519, X448, and so on), but I get an exception with Fourq using a basic multiplication of the base point (I tried lots of different key value, from simple to random, but still get an exception). My CPU is AMD Phenom II X6 1055T, 2.80 GHz.

from circl.

billbuchanan avatar billbuchanan commented on June 1, 2024

Thanks for this. Do you have instructions on building for the non-assembly implementation?

from circl.

armfazh avatar armfazh commented on June 1, 2024

I am working on a patch, it will be released this week.

from circl.

billbuchanan avatar billbuchanan commented on June 1, 2024

Thank you so much. Excellent support, and love the library.

from circl.

armfazh avatar armfazh commented on June 1, 2024

The PR #96 has added support for legacy multiplication instructions.
Let us know if some other issues arise.

from circl.

billbuchanan avatar billbuchanan commented on June 1, 2024

Thanks for the update. I now get the error of:
\github.com\cloudflare\circl\ecc\fourq\fp_amd64.s:50: unrecognized instruction "_fpMulLeg"
asm: assembly of github.com\cloudflare\circl\ecc\fourq\fp_amd64.s failed

from circl.

armfazh avatar armfazh commented on June 1, 2024

@billbuchanan
I could not reproduce that failure. I tried using go1.12.6, but in a linux machine.
Does that error happen during compilation or running time?

I recommend you to update Go to a more recent version. Also, make sure to clean compilation cache using go clean -cache

from circl.

billbuchanan avatar billbuchanan commented on June 1, 2024

I can get it to work here:

https://repl.it/@billbuchanan/gofourq

But on my server, I get a runtime error:
c:>fourq.exe
Secret [250 133 245 228 228 163 21 170 121 63 215 199 226 215 181 104 55 156 72
117 141 179 146 105 216 0 226 124 140 33 131 80]

Exception 0xc000001d 0x0 0x0 0x4b2758
PC=0x4b2758

github.com/cloudflare/circl/ecc/fourq.doubleAsm(0xc000085d10)
d:/go/src/src/github.com/cloudflare/circl/ecc/fourq/point_amd64.s:8 +0x8
8
github.com/cloudflare/circl/ecc/fourq.(*pointR1).double(...)
d:/go/src/src/github.com/cloudflare/circl/ecc/fourq/point_amd64.go:24
github.com/cloudflare/circl/ecc/fourq.(*pointR1).ScalarBaseMult(0xc000085d10, 0x
c000058140)
d:/go/src/src/github.com/cloudflare/circl/ecc/fourq/point.go:190 +0x284
github.com/cloudflare/circl/ecc/fourq.(*Point).ScalarBaseMult(0xc000085dd0, 0xc0
00058140)
d:/go/src/src/github.com/cloudflare/circl/ecc/fourq/curve.go:82 +0x70
main.KeyGen(0xc000085ec8, 0xc000058140)
c:/Python27/godir/fourq.go:22 +0x53
main.main()
c:/Python27/godir/fourq.go:49 +0x1d0
rax 0x0
rbx 0x0
rcx 0x0
rdi 0xc000085d10
rsi 0x0
rbp 0xc000085cf0
rsp 0xc000085b28
r8 0x0
r9 0x0
r10 0x0
r11 0x0
r12 0x6c2a26
r13 0x4db6e0
r14 0x0
r15 0x0
rip 0x4b2758
rflags 0x10246
cs 0x33
fs 0x53
gs 0x2b

from circl.

armfazh avatar armfazh commented on June 1, 2024

Please take a look on your go.mod file, it should point to the master version rather than to v1.0.0.

File: go.mod

module main

go 1.13

require github.com/cloudflare/circl master

Note that the error message still points to the function doubleAsm, which was removed after you reported us the initial bug.

github.com/cloudflare/circl/ecc/fourq.doubleAsm(0xc000085d10)
d:/go/src/src/github.com/cloudflare/circl/ecc/fourq/point_amd64.s:8 +0x8

from circl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.