keybase / kbpgp

OpenPGP (RFC4880) Implementation in IcedCoffeeScript
https://keybase.io/kbpgp
BSD 3-Clause "New" or "Revised" License
534 stars 74 forks source link

Fix eddsa.iced subkey_algo bug #208

Closed zapu closed 3 years ago

zapu commented 3 years ago

I was investigating issues that are being fixed in https://github.com/keybase/kbpgp/pull/207 and found another bug, unrelated to circular import but also in subkey_algo function in another class.

subkey_algo is only called during key generation, where subkey algorithms are not specified by the caller.

Before the fix, the new test crashed with:

:: Caught sync exception: ReferenceError: ECDH is not defined
at Function.Pair.subkey_algo (/home/zapu/Projects/KB/kbpgp/lib/ecc/eddsa.js:221:9)
 or at /home/zapu/Projects/KB/kbpgp/test/files/ecc2.iced:156:20
In ecc2.iced/generate_default_subkeys: ReferenceError: ECDH is not defined
Full error object:
[ReferenceError: ECDH is not defined
  at Function.Pair.subkey_algo (/home/zapu/Projects/KB/kbpgp/lib/ecc/eddsa.js:221:9)
  at Function.KeyManager.generate (/home/zapu/Projects/KB/kbpgp/lib/openpgp/keymanager.js:907:52)
  at /home/zapu/Projects/KB/kbpgp/test/files/ecc2.iced:156:20
malgorithms commented 3 years ago

if I'm reading this correctly, did you change the lib .js file directly but not the .iced in src? maybe there is a missing change?

zapu commented 3 years ago

I must have messed up git add -p. Thanks, fixed now!