Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: ecdsa_is_valid_private_key() first returns "true" but later "false" for the same value #3

Open
joelonsql opened this issue Dec 1, 2022 · 1 comment

Comments

@joelonsql
Copy link
Contributor

joelonsql commented Dec 1, 2022

I've tested this on PostgreSQL 15.1 (Ubuntu 15.1-1.pgdg22.04+1) on aarch64-unknown-linux-gnu, compiled by gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0, 64-bit

Very strange problem:

joel@linux:~/pg-ecdsa$ make installcheck
echo "+++ regress install-check in  +++" && /usr/lib/postgresql/15/lib/pgxs/src/makefiles/../../src/test/regress/pg_regress --inputdir=./ --bindir='/usr/lib/postgresql/15/bin'    --dbname=contrib_regression pguecc_test_raw pguecc_test_public
+++ regress install-check in  +++
(using postmaster on Unix socket, default port)
============== dropping database "contrib_regression" ==============
SET
DROP DATABASE
============== creating database "contrib_regression" ==============
CREATE DATABASE
ALTER DATABASE
ALTER DATABASE
ALTER DATABASE
ALTER DATABASE
ALTER DATABASE
ALTER DATABASE
============== running regression test queries        ==============
test pguecc_test_raw              ... ok           13 ms
test pguecc_test_public           ... FAILED       14 ms

======================
 1 of 2 tests failed.
======================

The differences that caused some tests to fail can be viewed in the
file "/home/joel/pg-ecdsa/regression.diffs".  A copy of the test summary that you see
above is saved in the file "/home/joel/pg-ecdsa/regression.out".

make: *** [/usr/lib/postgresql/15/lib/pgxs/src/makefiles/pgxs.mk:433: installcheck] Error 1

joel@linux:~/pg-ecdsa$ cat /home/joel/pg-ecdsa/regression.diffs
diff -U3 /home/joel/pg-ecdsa/expected/pguecc_test_public.out /home/joel/pg-ecdsa/results/pguecc_test_public.out
--- /home/joel/pg-ecdsa/expected/pguecc_test_public.out	2022-12-01 13:06:54.798948391 +0000
+++ /home/joel/pg-ecdsa/results/pguecc_test_public.out	2022-12-01 13:14:16.060144414 +0000
@@ -77,7 +77,7 @@
 select ecdsa_is_valid_private_key('000000000000000000000000000000000000000000', 'secp160r1');
  ecdsa_is_valid_private_key
 ----------------------------
- f
+ t
 (1 row)


joel@linux:~/pg-ecdsa$ psql test
psql (15.1 (Ubuntu 15.1-1.pgdg22.04+1))
Type "help" for help.

test=# select ecdsa_is_valid_private_key('000000000000000000000000000000000000000000', 'secp160r1');
 ecdsa_is_valid_private_key
----------------------------
 f
(1 row)

test=# select ecdsa_is_valid_private_key('000000000000000000000000000000000000000000', 'secp160r1');
 ecdsa_is_valid_private_key
----------------------------
 t
(1 row)

test=# select ecdsa_is_valid_private_key('000000000000000000000000000000000000000000', 'secp160r1');
 ecdsa_is_valid_private_key
----------------------------
 t
(1 row)

test=# \q
@SvanteRichter
Copy link

@joelonsql Did you investigate this more? I'm trying to gauge how serious this bug is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants