Giter Site home page Giter Site logo

bit-wasp / secp256k1-php Goto Github PK

View Code? Open in Web Editor NEW
57.0 9.0 36.0 740 KB

PHP bindings for bitcoin-core/secp256k1

License: The Unlicense

PHP 64.53% C 27.46% JavaScript 0.12% M4 1.06% C++ 1.24% Shell 4.24% Dockerfile 1.36%
secp256k1 ext-secp256k1 php-extension php-bindings

secp256k1-php's Introduction

secp256k1-php

Build Status codecov

PHP bindings for https://github.com/bitcoin-core/secp256k1

Please note that the upstream library, libsecp256k1 is still considered experimental by it's authors, and has not yet been formally released. For this reason, it's use should be discouraged. For consensus systems this warning is critical.

The library supports the EcDH, and signature recovery modules - these libraries are required for installation.

Requirements

PHP 5.* versions are supported in the v0.0.x release. PHP 7 is supported in the v0.1.x series.

About the extension

  • Fully unit tested, with >99 code coverage since the v0.1.3 release.
  • This extension only supports deterministic signatures at present. In fact, no RNG is utilized in this extension - private keys must be generated elsewhere.
  • The extension exposes the same raw API of libsecp256k1. As such, you must ensure you are passing the binary representations of each value.
  • In keeping with libsecp256k1, this extension returns certain data to the user by writing to a variable reference, and returning a code indicating the failure/success.

To Install:

libsecp256k1:

    git clone [email protected]:bitcoin-core/secp256k1 && \
    cd secp256k1 &&                                    \
    ./autogen.sh &&                                    \
    ./configure --enable-experimental --enable-module-{ecdh,recovery} && \
     make &&                                           \
     sudo make install &&                              \
     cd ../

secp256k1-php:

    git clone [email protected]:Bit-Wasp/secp256k1-php && \
    cd secp256k1-php/secp256k1 &&                      \
    phpize &&                                          \ 
    ./configure --with-secp256k1 &&                    \  
    make && sudo make install &&                       \
    cd ../../

Examples

See the examples folder, or the *_basic.phpt files in the test suite

(Optional) - Enable extension by default!

If you're a heavy user, you can add this line to your php.ini files for php-cli, apache2, or php-fpm.

/etc/php/7.0/cli/conf.d/20-secp256k1.ini -> /etc/php/7.0/mods-available/secp256k1.ini

extension=secp256k1.so

Run Tests

(Commands issued from secp256k1-php directory)

Basic tests:

cd secp256k1-php/secp256k1 && make test

secp256k1-php's People

Contributors

afk11 avatar bablakeluke avatar deweller avatar rubensayshi avatar vamenard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

secp256k1-php's Issues

130 char long public key

Hi,
I'm using secp256k1_ec_pubkey_serialize to recover serialized public key from public key.
However it return me a 130 char long public key.
And the expected public key is the 128 right characters. I have no idea why my result is prefixed with a 0x04.
For the moment I went ahead by ignoring those 2 chars but I really want to unterstand why I got this.
Cheers,

error in benchmark.php

With a fresh git clone, as instructed in the README.

$time php -dextension=secp256k1.so ../benchmark.php > /dev/null

PHP Warning: secp256k1_ecdsa_verify() expects exactly 4 parameters, 3 given in /home/websites/secp256k1-php/benchmark.php on line 8
<... warning repeats many times ...>

Looks like it is missing the initial context parameter. But I tried adding that and got another error, so gave up for now.

(regardless, I can tell the library is working in bitcoin-php lib, because now my app is much faster.)

Unable to install secp256k1 on Windows PHP 7

Hello, I've been unable to compile secp256k1 on my localhost for 3 days now. The only command that works is the clone command and nothing else after that. I have PHP installed via XAMPP and if I need anything else to make it work, I'd love to know as a library I need is dependent on secp256k1. Thanks.
Screenshot (4)

Use zend_api macros to assign type hints - aka strict types

It looks like some macros have existed since php 7.0 that let you assign php7 type hints to function arguments and return types. A scan of the php codebase shows that barely any functions use them, but they work great with the ReflectionExtension API, so you can generate php7 aware stubs if we go this route.

Going to hold back on this one a little while until I'm sure they're meant to be used yet, I really don't want to end up using something that breaks often. (or would force us maintaining separate PHP7.0/7.1/7.2 code bases..)

Building secp256k1-php with secp256k1 master fails to compile

Hey guys!

PHPize

root@nmind:~/secp256k1-php-0.1/secp256k1# phpize
Configuring for:
PHP Api Version: 20170718
Zend Module Api No: 20170718
Zend Extension Api No: 320170718

PHPversion

root@nmind:/secp256k1-php-0.1/secp256k1# php -v
PHP 7.2.11-2+0-20181015120801.9+stretch-1.gbp8105e0 (cli) (built: Oct 15 2018 12:08:03) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.11-2+0-20181015120801.9+stretch-1.gbp8105e0, Copyright (c) 1999-2018, by Zend Technologies
root@nmind:-/secp256k1-php-0.1/secp256k1#

I'm using branch v0.1
When i try make i get this error:

`

root@nmind:~/secp256k1-php-0.1/secp256k1# make
/bin/bash /root/secp256k1-php-0.1/secp256k1/libtool --mode=compile cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/root/secp256k1-php-0.1/secp256k1 -DPHP_ATOM_INC -I/root/secp256k1-php-0.1/secp256k1/include -I/root/secp256k1-php-0.1/secp256k1/main -I/root/secp256k1-php-0.1/secp256k1 -I/usr/include/php/20170718 -I/usr/include/php/20170718/main -I/usr/include/php/20170718/TSRM -I/usr/include/php/20170718/Zend -I/usr/include/php/20170718/ext -I/usr/include/php/20170718/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /root/secp256k1-php-0.1/secp256k1/secp256k1.c -o secp256k1.lo
libtool: compile: cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/root/secp256k1-php-0.1/secp256k1 -DPHP_ATOM_INC -I/root/secp256k1-php-0.1/secp256k1/include -I/root/secp256k1-php-0.1/secp256k1/main -I/root/secp256k1-php-0.1/secp256k1 -I/usr/include/php/20170718 -I/usr/include/php/20170718/main -I/usr/include/php/20170718/TSRM -I/usr/include/php/20170718/Zend -I/usr/include/php/20170718/ext -I/usr/include/php/20170718/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /root/secp256k1-php-0.1/secp256k1/secp256k1.c -fPIC -DPIC -o .libs/secp256k1.o
/root/secp256k1-php-0.1/secp256k1/secp256k1.c: In function ‘zif_secp256k1_context_randomize’:
/root/secp256k1-php-0.1/secp256k1/secp256k1.c:435:17: warning: implicit declaration of function ‘zend_throw_exception_ex’ [-Wimplicit-function-declaration]
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC,
^~~~~~~~~~~~~~~~~~~~~~~
/root/secp256k1-php-0.1/secp256k1/secp256k1.c: In function ‘zif_secp256k1_ecdh’:
/root/secp256k1-php-0.1/secp256k1/secp256k1.c:1329:14: error: too few arguments to function ‘secp256k1_ecdh’
result = secp256k1_ecdh(ctx, resultChars, pubkey, privKey->val);
^~~~~~~~~~~~~~
In file included from /root/secp256k1-php-0.1/secp256k1/php_secp256k1.h:3:0,
from /root/secp256k1-php-0.1/secp256k1/secp256k1.c:10:
/usr/local/include/secp256k1_ecdh.h:42:48: note: declared here
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdh(
^~~~~~~~~~~~~~

Makefile:194: fallo en las instrucciones para el objetivo 'secp256k1.lo'
make: *** [secp256k1.lo] Error 1
root@nmind:~/secp256k1-php-0.1/secp256k1#

PHP 7.2 doesn't work

$ php -v

PHP 7.2.12-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Nov 12 2018 09:55:44) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.12-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

$ php -m

[PHP Modules]
...
Reflection
secp256k1
session
shmop
SimpleXML
...

[Zend Modules]
Zend OPcache

compiling it with php7.2 fails

/root/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_context_randomize’:
/root/secp256k1-php/secp256k1/secp256k1.c:566:17: warning: implicit declaration of function ‘zend_throw_exception_ex’; did you mean ‘zend_try_exception_handler’? [-Wimplicit-function-declaration]
                 zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC,
                 ^~~~~~~~~~~~~~~~~~~~~~~
                 zend_try_exception_handler
/root/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_ecdh’:
/root/secp256k1-php/secp256k1/secp256k1.c:1444:14: error: too few arguments to function ‘secp256k1_ecdh’
     result = secp256k1_ecdh(ctx, resultChars, pubkey, privKey->val);
              ^~~~~~~~~~~~~~
In file included from /root/secp256k1-php/secp256k1/php_secp256k1.h:3:0,
                 from /root/secp256k1-php/secp256k1/secp256k1.c:11:
/usr/local/include/secp256k1_ecdh.h:42:48: note: declared here

Depends on libsecp2561k1 being installed on the host

We should be able to build against a copy of libsecp256k1 in git, to avoid the constant breaks in upstream software when libsecp25k1 upgrades. .

I think there are examples of this out there (zip in php-src, for example) but config.m4 scripts are horrible to digest.

Any extension developers who can help, please do get in touch.

secp256k1_ec_pubkey_serialize - fix API

upstream now takes serialization flags, which we generate in place based on fCompressed.

we should remove fCompressed in favor of directly accepting serialization flags.

See #101

The tests take forever to start..

I read that travis lets you use container based builds, which are quicker to start up. Apparently it decides this based on whether you use sudo - which we do to install the libsecp256k1 library.

If we can avoid running sudo make install somehow hopefully we'll see some speed in the run time :/

Publish on PECL

Please publish this extension to PECL, so it's more easily available.

Installation Error

Branch 0.0

# make
/bin/sh /home/areal/scp/secp256k1/libtool --mode=compile cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/home/areal/scp/secp256k1 -DPHP_ATOM_INC -I/home/areal/scp/secp256k1/include -I/home/areal/scp/secp256k1/main -I/home/areal/scp/secp256k1 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -g -O2   -c /home/areal/scp/secp256k1/secp256k1.c -o secp256k1.lo
libtool: compile:  cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/home/areal/scp/secp256k1 -DPHP_ATOM_INC -I/home/areal/scp/secp256k1/include -I/home/areal/scp/secp256k1/main -I/home/areal/scp/secp256k1 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /home/areal/scp/secp256k1/secp256k1.c  -fPIC -DPIC -o .libs/secp256k1.o
/home/areal/scp/secp256k1/secp256k1.c: In function 'zif_secp256k1_ecdh':
/home/areal/scp/secp256k1/secp256k1.c:991:5: error: too few arguments to function 'secp256k1_ecdh'
     result = secp256k1_ecdh(ctx, resultChars, pubkey, privKey);
     ^
In file included from /home/areal/scp/secp256k1/php_secp256k1.h:3:0,
                 from /home/areal/scp/secp256k1/secp256k1.c:10:
/usr/local/include/secp256k1_ecdh.h:42:48: note: declared here
 SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdh(
                                                ^
make: *** [secp256k1.lo] Error 1

secp256k1_ecdsa_recoverable_signature_serialize_compact - fix API

Saving this for a backwards incompatible release, but it looks like

    secp256k1_ecdsa_recoverable_signature_serialize_compact(
         resource $context, 
         resource $sig, 
         &$sigOut, 
         &$recID
    );

is wrong and should be

    secp256k1_ecdsa_recoverable_signature_serialize_compact(
         resource $context, 
         &$sigOut, 
         &$recID, 
         resource $sig
    );

Add valgrind run to CI

as mentioned in #131, we should have travis run valgrind tests.

recently I've done some work on this using a php build from source with the following:
./buildconf && ./configure --with-valgrind --with-pcre-valgrind --with-secp256k1 && make -j8

with the projects secp256k1 dir located in ./ext/secp256k1 and then using the following to run valgrind tests: make test TESTS="./ext/secp256k1/tests -m"

ideally we'd be able to run this on multiple php versions - maybe several Docker files in phpqa?

Warning on secp256k1 make from current master and error on secp256k1-php make

Hello, I got following warning during secp256k1 make:

gcc -I. -g -O2 -Wall -Wextra -Wno-unused-function -c src/gen_context.c -o gen_context.o
gcc gen_context.o -o gen_context
./gen_context
CC src/libsecp256k1_la-secp256k1.lo
CCLD libsecp256k1.la
CC src/bench_verify.o
CCLD bench_verify
CC src/bench_sign.o
CCLD bench_sign
CC src/bench_internal-bench_internal.o
CCLD bench_internal
CC src/bench_ecmult-bench_ecmult.o
CCLD bench_ecmult
CC src/tests-tests.o
In file included from src/secp256k1.c:15:0,
from src/tests.c:17:
src/ecmult_const_impl.h: In function ‘secp256k1_wnaf_const’:
src/ecmult_const_impl.h:113:20: warning: ‘u’ may be used uninitialized in this function [-Wmaybe-uninitialized]
wnaf[word] = u * global_sign;
^
CCLD tests
CC src/exhaustive_tests-tests_exhaustive.o
CCLD exhaustive_tests
CC src/bench_ecdh.o
CCLD bench_ecdh
CC src/bench_recover.o
CCLD bench_recover

For secp256k1-php make (master):

/bin/bash /home/www/erc20/secp256k1-php-master/secp256k1/libtool --mode=compile cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/home/www/erc20/secp256k1-php-master/secp256k1 -DPHP_ATOM_INC -I/home/www/erc20/secp256k1-php-master/secp256k1/include -I/home/www/erc20/secp256k1-php-master/secp256k1/main -I/home/www/erc20/secp256k1-php-master/secp256k1 -I/usr/include/php/20170718 -I/usr/include/php/20170718/main -I/usr/include/php/20170718/TSRM -I/usr/include/php/20170718/Zend -I/usr/include/php/20170718/ext -I/usr/include/php/20170718/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /home/www/erc20/secp256k1-php-master/secp256k1/secp256k1.c -o secp256k1.lo
libtool: compile: cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/home/www/erc20/secp256k1-php-master/secp256k1 -DPHP_ATOM_INC -I/home/www/erc20/secp256k1-php-master/secp256k1/include -I/home/www/erc20/secp256k1-php-master/secp256k1/main -I/home/www/erc20/secp256k1-php-master/secp256k1 -I/usr/include/php/20170718 -I/usr/include/php/20170718/main -I/usr/include/php/20170718/TSRM -I/usr/include/php/20170718/Zend -I/usr/include/php/20170718/ext -I/usr/include/php/20170718/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /home/www/erc20/secp256k1-php-master/secp256k1/secp256k1.c -fPIC -DPIC -o .libs/secp256k1.o
/home/www/erc20/secp256k1-php-master/secp256k1/secp256k1.c: In function 'zif_secp256k1_ecdh':
/home/www/erc20/secp256k1-php-master/secp256k1/secp256k1.c:1444:5: error: too few arguments to function 'secp256k1_ecdh'
result = secp256k1_ecdh(ctx, resultChars, pubkey, privKey->val);
^
In file included from /home/www/erc20/secp256k1-php-master/secp256k1/php_secp256k1.h:3:0,
from /home/www/erc20/secp256k1-php-master/secp256k1/secp256k1.c:11:
/usr/local/include/secp256k1_ecdh.h:42:48: note: declared here
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdh(
^
make: *** [secp256k1.lo] Error 1

Critical: potentially invalid derivations? (php7.3 only?)

this one is scary - very recently, on travis php nightly builds I started getting invalid derivations in bip32 and electrum derivations. the culprit seems to be one of the priv/pub_tweak_add functions. I have yet to investigate this one, but it is of the utmost importance that if you use ext-secp256k1 that you have a comprehensive test suite covering your derivation code, lest something like this ever slip into production.

https://travis-ci.org/Bit-Wasp/bitcoin-php/jobs/333897496

这个是什么问题啊

/www/wwwroot/b_com/secp256k1-php/secp256k1/secp256k1.c: 在函数‘zif_secp256k1_ecdh’中:
/www/wwwroot/b_com/secp256k1-php/secp256k1/secp256k1.c:1444:5: 错误:提供给函数‘secp256k1_ecdh’的实参太少
result = secp256k1_ecdh(ctx, resultChars, pubkey, privKey->val);
^
In file included from /www/wwwroot/b_com/secp256k1-php/secp256k1/php_secp256k1.h:3:0,
from /www/wwwroot/b_com/secp256k1-php/secp256k1/secp256k1.c:11:
/usr/local/include/secp256k1_ecdh.h:42:48: 附注:在此声明
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdh(
^
make: *** [secp256k1.lo] 错误 1

error

administratordeMacBook-Air:secp256k1 administrator$ ./configure --with-secp256k1
-bash: ./configure: No such file or directory

memleak in secp256k1_ec_pubkey_serialize

version 0.1.3
In secp256k1_ec_pubkey_serialize and also secp256k1_ec_privkey_tweak_add (didn't check the others) emalloc is not freed:
$ ZEND_DONT_UNLOAD_MODULES=1 USE_ZEND_ALLOC=0 valgrind --leak-check=full --show-reachable=yes --track-origins=yes -v /usr/bin/php ./testec.php

==9623== 160 bytes in 5 blocks are definitely lost in loss record 39 of 52
==9623== at 0x4C2BBAF: malloc (vg_replace_malloc.c:299)
==9623== by 0x378D68: __zend_malloc (in /usr/bin/php7.2)
==9623== by 0x12CE72BC: zif_secp256k1_ec_privkey_tweak_add (secp256k1.c:950)
==9623== by 0x454595: execute_ex (in /usr/bin/php7.2)
==9623== by 0x456ABD: zend_execute (in /usr/bin/php7.2)
==9623== by 0x3A4A62: zend_execute_scripts (in /usr/bin/php7.2)
==9623== by 0x33E9A7: php_execute_script (in /usr/bin/php7.2)
==9623== by 0x458E8E: ??? (in /usr/bin/php7.2)
==9623== by 0x1F2FC1: ??? (in /usr/bin/php7.2)
==9623== by 0x69922E0: (below main) (libc-start.c:291)

==9623== 198 bytes in 6 blocks are definitely lost in loss record 42 of 52
==9623== at 0x4C2BBAF: malloc (vg_replace_malloc.c:299)
==9623== by 0x378D68: __zend_malloc (in /usr/bin/php7.2)
==9623== by 0x12CE7108: zif_secp256k1_ec_pubkey_serialize (secp256k1.c:909)
==9623== by 0x454595: execute_ex (in /usr/bin/php7.2)
==9623== by 0x456ABD: zend_execute (in /usr/bin/php7.2)
==9623== by 0x3A4A62: zend_execute_scripts (in /usr/bin/php7.2)
==9623== by 0x33E9A7: php_execute_script (in /usr/bin/php7.2)
==9623== by 0x458E8E: ??? (in /usr/bin/php7.2)
==9623== by 0x1F2FC1: ??? (in /usr/bin/php7.2)
==9623== by 0x69922E0: (below main) (libc-start.c:291)

==9623== LEAK SUMMARY:
==9623== definitely lost: 358 bytes in 11 blocks
==9623== indirectly lost: 0 bytes in 0 blocks
==9623== possibly lost: 0 bytes in 0 blocks
==9623== still reachable: 113,977 bytes in 348 blocks
==9623== suppressed: 0 bytes in 0 blocks
==9623==
==9623== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
==9623== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)

diff -Nru secp256k1-php-0.1.3.orig/secp256k1/secp256k1.c secp256k1-php-0.1.3/secp256k1/secp256k1.c
--- secp256k1-php-0.1.3.orig/secp256k1/secp256k1.c      2018-02-17 15:24:05.000000000 +0100
+++ secp256k1-php-0.1.3/secp256k1/secp256k1.c   2019-02-23 16:06:00.029970460 +0100
@@ -911,6 +911,7 @@
 
     zval_dtor(zPubOut);
     ZVAL_STRINGL(zPubOut, pubkeyout, pubkeylen);
+    efree(pubkeyout);
     RETURN_LONG(result);
 }
 /* }}} */
@@ -953,6 +954,7 @@
 
     zval_dtor(zSecKey);
     ZVAL_STRINGL(zSecKey, newseckey, SECRETKEY_LENGTH);
+    efree(newseckey);
     RETURN_LONG(result);
 }
 /* }}} */

same command with patch:
==9758== LEAK SUMMARY:
==9758== definitely lost: 0 bytes in 0 blocks
==9758== indirectly lost: 0 bytes in 0 blocks
==9758== possibly lost: 0 bytes in 0 blocks
==9758== still reachable: 113,977 bytes in 348 blocks
==9758== suppressed: 0 bytes in 0 blocks
==9758==
==9758== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==9758== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

Talk to bitcoin core?

I saw that at the moment PHP can only communicate over JSON RPC to bitcoin core. Also no push notifications are supported. For node.js there seem to be bindings https://github.com/bitpay/bitcore-node Could this extension provide similar functionality? An example of a notifcation would be a transaction getting verified.

Track code coverage

We'll have to compile PHP with gcov support for this, but really nice to have going forward.

Write simple test.php files

The build I used first time around created skeleton test files. Should remove them or just add some simple cases (prefer the latter)

How to generate private key?

Hi, I am wondering how to generate private key with this ropo?

And in the example create_public_key.php , there is a comment: //Private keys are never generated by secp256k1. Then how could I generate a private key?

Thanks for any information!

And by the way, could I use this library whth composer? I didn't find the "composer require" information for this library.

secp256k1_ecdh.h No such file or directory

In file included from /root/secp256k1-php/secp256k1/secp256k1.c:11:0:
/root/secp256k1-php/secp256k1/php_secp256k1.h:3:28: fatal error: secp256k1_ecdh.h: No such file or directory
#include <secp256k1_ecdh.h>

PHP8 Install Error

Hello there,

Recently upgraded to PHP8.0 and want to install this extension. Everything works fine until I hit the make command when in the secp256k1-php/sec256k1 folder.

This is the error I'm seeing:

/secp256k1-php/secp256k1/secp256k1.c:1995:47: error: expected ‘)’ before ‘TSRMLS_CC’
     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/rS|flz",
                                               ^~~~~~~~~
/secp256k1-php/secp256k1/secp256k1.c:1995:9: error: too few arguments to function ‘zend_parse_parameters’
     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/rS|flz",
         ^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/php/20200930/main/php.h:36:0,
                 from /secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php/20200930/Zend/zend_API.h:304:22: note: declared here
 ZEND_API zend_result zend_parse_parameters(uint32_t num_args, const char *type_spec, ...);

I don't know anything about C or PHP extensions so I don't know where to start to try and fix this. Can anyone help?

Clean up API, should match libsecp256k1

Leaving this as a TODO - some functions parameters are ordered differently, which will need to be changed. Also the flags API break hasn't been carried on to the extension, besides the constants values changing, secp25k1_ec_pubkey_serialize still takes a long for compressed, and flags are generated from this.

Also - secp256k1_ecdsa_verify normalizes all signatures rather than passing them directly to libsecp256k1's secp256k1_ecdsa_verify function.

Add DESTDIR support

I will try to do this when I get home after holidays and submit a patch to makefile if it is not done by then, but DESTDIR support would make installing in a package manager build environment (e.g. RPM) a lot easier.

error callbacks

We don't have support for configuring error callbacks. It'd be nice to add these for completeness.

secp256k1_ecdsa_verify: don't copy & normalize

ie, preserve upstreams semantics of rejecting signatures which are not normalized. Looking back on it, it was probably done to be helpful, but it's best not to introduce different behaviors I think.

PR is simple, but opening the issue to bring some visibility to what I'd call an issue, feedback would be welcome!

Installation Error

Hey guys

When I try that last line of the installation,
phpize && ./configure --with-secp256k1 && make && sudo make install

I get this error.

Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib
checking for PHP extension directory... /usr/lib/php5/20121212
checking for PHP installed headers prefix... /usr/include/php5
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking for secp256k1 support... yes, shared
checking for secp256k1 files in default path... found in /usr/local
checking for secp256k1_context_create in -lsecp256k1... yes
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @file support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... (cached) gawk
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands
/bin/bash /home/ubuntu/workspace/secp256k1-php/secp256k1/libtool --mode=compile cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/home/ubuntu/workspace/secp256k1-php/secp256k1 -DPHP_ATOM_INC -I/home/ubuntu/workspace/secp256k1-php/secp256k1/include -I/home/ubuntu/workspace/secp256k1-php/secp256k1/main -I/home/ubuntu/workspace/secp256k1-php/secp256k1 -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c -o secp256k1.lo
libtool: compile: cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/home/ubuntu/workspace/secp256k1-php/secp256k1 -DPHP_ATOM_INC -I/home/ubuntu/workspace/secp256k1-php/secp256k1/include -I/home/ubuntu/workspace/secp256k1-php/secp256k1/main -I/home/ubuntu/workspace/secp256k1-php/secp256k1 -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c -fPIC -DPIC -o .libs/secp256k1.o
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:259:32: error: unknown type name ‘zend_resource’
static void secp256k1_ctx_dtor(zend_resource rsrc TSRMLS_DC)
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:267:35: error: unknown type name ‘zend_resource’
static void secp256k1_pubkey_dtor(zend_resource *rsrc TSRMLS_DC)
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:275:32: error: unknown type name ‘zend_resource’
static void secp256k1_sig_dtor(zend_resource * rsrc TSRMLS_DC)
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:283:44: error: unknown type name ‘zend_resource’
static void secp256k1_recoverable_sig_dtor(zend_resource * rsrc TSRMLS_DC)
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zm_startup_secp256k1’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:292:58: error: ‘secp256k1_ctx_dtor’ undeclared (first use in this function)
le_secp256k1_ctx = zend_register_list_destructors_ex(secp256k1_ctx_dtor, NULL, SECP256K1_CTX_RES_NAME, module_number);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:292:58: note: each undeclared identifier is reported only once for each function it appears in
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:293:61: error: ‘secp256k1_pubkey_dtor’ undeclared (first use in this function)
le_secp256k1_pubkey = zend_register_list_destructors_ex(secp256k1_pubkey_dtor, NULL, SECP256K1_PUBKEY_RES_NAME, module_number);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:294:58: error: ‘secp256k1_sig_dtor’ undeclared (first use in this function)
le_secp256k1_sig = zend_register_list_destructors_ex(secp256k1_sig_dtor, NULL, SECP256K1_SIG_RES_NAME, module_number);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:295:70: error: ‘secp256k1_recoverable_sig_dtor’ undeclared (first use in this function)
le_secp256k1_recoverable_sig = zend_register_list_destructors_ex(secp256k1_recoverable_sig_dtor, NULL, SECP256K1_RECOVERABLE_SIG_RES_NAME, module_number);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_context_create’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:361:5: warning: passing argument 1 of ‘zend_register_resource’ from incompatible pointer type [enabled by default]
RETURN_RES(zend_register_resource(ctx, le_secp256k1_ctx));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘struct zval *’ but argument is of type ‘struct secp256k1_context *’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:361:5: warning: passing argument 2 of ‘zend_register_resource’ makes pointer from integer without a cast [enabled by default]
RETURN_RES(zend_register_resource(ctx, le_secp256k1_ctx));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘void *’ but argument is of type ‘int’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:361:5: error: too few arguments to function ‘zend_register_resource’
RETURN_RES(zend_register_resource(ctx, le_secp256k1_ctx));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: declared here
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_context_clone’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:393:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:398:5: warning: passing argument 1 of ‘zend_register_resource’ from incompatible pointer type [enabled by default]
RETURN_RES(zend_register_resource(newCtx, le_secp256k1_ctx));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘struct zval *’ but argument is of type ‘struct secp256k1_context *’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:398:5: warning: passing argument 2 of ‘zend_register_resource’ makes pointer from integer without a cast [enabled by default]
RETURN_RES(zend_register_resource(newCtx, le_secp256k1_ctx));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘void *’ but argument is of type ‘int’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:398:5: error: too few arguments to function ‘zend_register_resource’
RETURN_RES(zend_register_resource(newCtx, le_secp256k1_ctx));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: declared here
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_context_randomize’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:415:5: error: unknown type name ‘zend_string’
zend_string
seed32;
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:420:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context )zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:424:53: error: request for member ‘val’ in something not a structure or union
result = secp256k1_context_randomize(ctx, seed32->val);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_ecdsa_signature_serialize_der’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:442:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:446:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((sig = (secp256k1_ecdsa_signature *)zend_fetch_resource2_ex(zSig, SECP256K1_SIG_RES_NAME, le_secp256k1_sig, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:453:48: error: macro "ZVAL_STRINGL" requires 4 arguments, but only 3 given
ZVAL_STRINGL(zSigOut, sigout, sigoutlen);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:453:9: error: ‘ZVAL_STRINGL’ undeclared (first use in this function)
ZVAL_STRINGL(zSigOut, sigout, sigoutlen);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_ecdsa_signature_parse_der’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:473:5: error: unknown type name ‘zend_string’
zend_string *sigin;
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:479:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:484:65: error: request for member ‘val’ in something not a structure or union
result = secp256k1_ecdsa_signature_parse_der(ctx, sig, sigin->val, sigin->len);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:484:77: error: request for member ‘len’ in something not a structure or union
result = secp256k1_ecdsa_signature_parse_der(ctx, sig, sigin->val, sigin->len);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:487:9: warning: passing argument 1 of ‘zend_register_resource’ from incompatible pointer type [enabled by default]
ZVAL_RES(zSig, zend_register_resource(sig, le_secp256k1_sig));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘struct zval *’ but argument is of type ‘struct secp256k1_ecdsa_signature *’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:487:9: warning: passing argument 2 of ‘zend_register_resource’ makes pointer from integer without a cast [enabled by default]
ZVAL_RES(zSig, zend_register_resource(sig, le_secp256k1_sig));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘void *’ but argument is of type ‘int’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:487:9: error: too few arguments to function ‘zend_register_resource’
ZVAL_RES(zSig, zend_register_resource(sig, le_secp256k1_sig));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: declared here
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_ecdsa_signature_normalize’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:512:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:516:18: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((sigin = (secp256k1_ecdsa_signature *)zend_fetch_resource2_ex(zSigIn, SECP256K1_SIG_RES_NAME, le_secp256k1_sig, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:523:25: error: invalid type argument of ‘->’ (have ‘int’)
Z_RES_P(zSigOut)->ptr = zend_register_resource(sigout, le_secp256k1_sig);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:523:9: warning: passing argument 1 of ‘zend_register_resource’ from incompatible pointer type [enabled by default]
Z_RES_P(zSigOut)->ptr = zend_register_resource(sigout, le_secp256k1_sig);
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘struct zval *’ but argument is of type ‘struct secp256k1_ecdsa_signature *’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:523:9: warning: passing argument 2 of ‘zend_register_resource’ makes pointer from integer without a cast [enabled by default]
Z_RES_P(zSigOut)->ptr = zend_register_resource(sigout, le_secp256k1_sig);
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘void *’ but argument is of type ‘int’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:523:9: error: too few arguments to function ‘zend_register_resource’
Z_RES_P(zSigOut)->ptr = zend_register_resource(sigout, le_secp256k1_sig);
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: declared here
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_ecdsa_verify’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:546:5: error: unknown type name ‘zend_string’
zend_string *msg32;
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:553:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:557:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((sig = (secp256k1_ecdsa_signature *)zend_fetch_resource2_ex(zSig, SECP256K1_SIG_RES_NAME, le_secp256k1_sig, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:561:19: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((pubkey = (secp256k1_pubkey *)zend_fetch_resource2_ex(zPubKey, SECP256K1_PUBKEY_RES_NAME, le_secp256k1_pubkey, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:567:55: error: request for member ‘val’ in something not a structure or union
result = secp256k1_ecdsa_verify(ctx, sigcpy, msg32->val, pubkey);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_ecdsa_sign’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:619:5: error: unknown type name ‘zend_string’
zend_string *msg32, *seckey;
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:626:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:630:14: error: request for member ‘len’ in something not a structure or union
if (msg32->len != HASH_LENGTH) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:636:15: error: request for member ‘len’ in something not a structure or union
if (seckey->len != SECRETKEY_LENGTH) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:643:53: error: request for member ‘val’ in something not a structure or union
result = secp256k1_ecdsa_sign(ctx, newsig, msg32->val, seckey->val, NULL, NULL);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:643:66: error: request for member ‘val’ in something not a structure or union
result = secp256k1_ecdsa_sign(ctx, newsig, msg32->val, seckey->val, NULL, NULL);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:646:9: warning: passing argument 1 of ‘zend_register_resource’ from incompatible pointer type [enabled by default]
ZVAL_RES(zSig, zend_register_resource(newsig, le_secp256k1_sig));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘struct zval *’ but argument is of type ‘struct secp256k1_ecdsa_signature *’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:646:9: warning: passing argument 2 of ‘zend_register_resource’ makes pointer from integer without a cast [enabled by default]
ZVAL_RES(zSig, zend_register_resource(newsig, le_secp256k1_sig));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘void *’ but argument is of type ‘int’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:646:9: error: too few arguments to function ‘zend_register_resource’
ZVAL_RES(zSig, zend_register_resource(newsig, le_secp256k1_sig));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: declared here
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_ec_seckey_verify’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:663:5: error: unknown type name ‘zend_string’
zend_string *seckey;
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:670:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:674:15: error: request for member ‘len’ in something not a structure or union
if (seckey->len != SECRETKEY_LENGTH) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:679:52: error: request for member ‘val’ in something not a structure or union
result = secp256k1_ec_seckey_verify(ctx, seckey->val);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_ec_pubkey_create’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:705:5: error: unknown type name ‘zend_string’
zend_string *seckey;
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:712:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:716:15: error: request for member ‘len’ in something not a structure or union
if (seckey->len != SECRETKEY_LENGTH) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:722:77: error: request for member ‘val’ in something not a structure or union
result = secp256k1_ec_pubkey_create(ctx, pubkey, (unsigned char *)seckey->val);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:725:9: warning: passing argument 1 of ‘zend_register_resource’ from incompatible pointer type [enabled by default]
ZVAL_RES(zPubKey, zend_register_resource(pubkey, le_secp256k1_pubkey));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘struct zval *’ but argument is of type ‘struct secp256k1_pubkey *’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:725:9: warning: passing argument 2 of ‘zend_register_resource’ makes pointer from integer without a cast [enabled by default]
ZVAL_RES(zPubKey, zend_register_resource(pubkey, le_secp256k1_pubkey));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘void *’ but argument is of type ‘int’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:725:9: error: too few arguments to function ‘zend_register_resource’
ZVAL_RES(zPubKey, zend_register_resource(pubkey, le_secp256k1_pubkey));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: declared here
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_ec_pubkey_parse’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:745:5: error: unknown type name ‘zend_string’
zend_string *pubkeyin;
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:752:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:757:61: error: request for member ‘val’ in something not a structure or union
result = secp256k1_ec_pubkey_parse(ctx, pubkey, pubkeyin->val, pubkeyin->len);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:757:76: error: request for member ‘len’ in something not a structure or union
result = secp256k1_ec_pubkey_parse(ctx, pubkey, pubkeyin->val, pubkeyin->len);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:760:9: warning: passing argument 1 of ‘zend_register_resource’ from incompatible pointer type [enabled by default]
ZVAL_RES(zPubKey, zend_register_resource(pubkey, le_secp256k1_pubkey));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘struct zval *’ but argument is of type ‘struct secp256k1_pubkey *’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:760:9: warning: passing argument 2 of ‘zend_register_resource’ makes pointer from integer without a cast [enabled by default]
ZVAL_RES(zPubKey, zend_register_resource(pubkey, le_secp256k1_pubkey));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘void *’ but argument is of type ‘int’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:760:9: error: too few arguments to function ‘zend_register_resource’
ZVAL_RES(zPubKey, zend_register_resource(pubkey, le_secp256k1_pubkey));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: declared here
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_ec_pubkey_serialize’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:779:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:783:19: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((pubkey = (secp256k1_pubkey *)zend_fetch_resource2_ex(zPubKey, SECP256K1_PUBKEY_RES_NAME, le_secp256k1_pubkey, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:792:51: error: macro "ZVAL_STRINGL" requires 4 arguments, but only 3 given
ZVAL_STRINGL(zPubOut, pubkeyout, pubkeylen);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:792:9: error: ‘ZVAL_STRINGL’ undeclared (first use in this function)
ZVAL_STRINGL(zPubOut, pubkeyout, pubkeylen);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_ec_privkey_tweak_add’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:814:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, 0)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_ec_pubkey_tweak_add’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:839:5: error: unknown type name ‘zend_string’
zend_string *tweak;
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:846:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, 0)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:850:19: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((pubkey = (secp256k1_pubkey *)zend_fetch_resource2_ex(zPubKey, SECP256K1_PUBKEY_RES_NAME, le_secp256k1_pubkey, 0)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:854:14: error: request for member ‘len’ in something not a structure or union
if (tweak->len != SECRETKEY_LENGTH) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:859:62: error: request for member ‘val’ in something not a structure or union
result = secp256k1_ec_pubkey_tweak_add(ctx, pubkey, tweak->val);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_ec_privkey_tweak_mul’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:868:5: error: unknown type name ‘zend_string’
zend_string *tweak;
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:876:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:890:14: error: request for member ‘len’ in something not a structure or union
if (tweak->len != SECRETKEY_LENGTH) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:896:66: error: request for member ‘val’ in something not a structure or union
result = secp256k1_ec_privkey_tweak_mul(ctx, newseckey, tweak->val);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_ec_pubkey_tweak_mul’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:908:5: error: unknown type name ‘zend_string’
zend_string *tweak;
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:915:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:919:19: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((pubkey = (secp256k1_pubkey *)zend_fetch_resource2_ex(zPubKey, SECP256K1_PUBKEY_RES_NAME, le_secp256k1_pubkey, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:923:62: error: request for member ‘val’ in something not a structure or union
result = secp256k1_ec_pubkey_tweak_mul(ctx, pubkey, tweak->val);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_ecdsa_recoverable_signature_parse_compact’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:935:5: error: unknown type name ‘zend_string’
zend_string *input64;
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:943:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:948:83: error: request for member ‘val’ in something not a structure or union
result = secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, sig, input64->val, recid);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:950:9: warning: passing argument 1 of ‘zend_register_resource’ from incompatible pointer type [enabled by default]
ZVAL_RES(zSig, zend_register_resource(sig, le_secp256k1_recoverable_sig));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘struct zval *’ but argument is of type ‘struct secp256k1_ecdsa_recoverable_signature *’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:950:9: warning: passing argument 2 of ‘zend_register_resource’ makes pointer from integer without a cast [enabled by default]
ZVAL_RES(zSig, zend_register_resource(sig, le_secp256k1_recoverable_sig));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘void *’ but argument is of type ‘int’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:950:9: error: too few arguments to function ‘zend_register_resource’
ZVAL_RES(zSig, zend_register_resource(sig, le_secp256k1_recoverable_sig));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: declared here
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_ecdsa_recoverable_signature_convert’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:969:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:973:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((rSig = (secp256k1_ecdsa_recoverable_signature *)zend_fetch_resource2_ex(zRecoverableSig, SECP256K1_RECOVERABLE_SIG_RES_NAME, le_secp256k1_recoverable_sig, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:980:9: warning: passing argument 1 of ‘zend_register_resource’ from incompatible pointer type [enabled by default]
ZVAL_RES(zNormalSig, zend_register_resource(nSig, le_secp256k1_sig));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘struct zval *’ but argument is of type ‘struct secp256k1_ecdsa_signature *’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:980:9: warning: passing argument 2 of ‘zend_register_resource’ makes pointer from integer without a cast [enabled by default]
ZVAL_RES(zNormalSig, zend_register_resource(nSig, le_secp256k1_sig));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘void *’ but argument is of type ‘int’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:980:9: error: too few arguments to function ‘zend_register_resource’
ZVAL_RES(zNormalSig, zend_register_resource(nSig, le_secp256k1_sig));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: declared here
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_ecdsa_recoverable_signature_serialize_compact’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:999:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1003:19: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((recsig = (secp256k1_ecdsa_recoverable_signature *)zend_fetch_resource2_ex(zRecSig, SECP256K1_RECOVERABLE_SIG_RES_NAME, le_secp256k1_recoverable_sig, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1010:60: error: macro "ZVAL_STRINGL" requires 4 arguments, but only 3 given
ZVAL_STRINGL(zSigOut, sig, COMPACT_SIGNATURE_LENGTH);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1010:9: error: ‘ZVAL_STRINGL’ undeclared (first use in this function)
ZVAL_STRINGL(zSigOut, sig, COMPACT_SIGNATURE_LENGTH);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_ecdsa_sign_recoverable’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1021:5: error: unknown type name ‘zend_string’
zend_string *msg32, *seckey;
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1029:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1033:14: error: request for member ‘len’ in something not a structure or union
if (msg32->len != HASH_LENGTH) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1038:15: error: request for member ‘len’ in something not a structure or union
if (seckey->len != SECRETKEY_LENGTH) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1044:65: error: request for member ‘val’ in something not a structure or union
result = secp256k1_ecdsa_sign_recoverable(ctx, newsig, msg32->val, seckey->val, 0, 0);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1044:78: error: request for member ‘val’ in something not a structure or union
result = secp256k1_ecdsa_sign_recoverable(ctx, newsig, msg32->val, seckey->val, 0, 0);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1046:9: warning: passing argument 1 of ‘zend_register_resource’ from incompatible pointer type [enabled by default]
ZVAL_RES(zSig, zend_register_resource(newsig, le_secp256k1_recoverable_sig));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘struct zval *’ but argument is of type ‘struct secp256k1_ecdsa_recoverable_signature *’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1046:9: warning: passing argument 2 of ‘zend_register_resource’ makes pointer from integer without a cast [enabled by default]
ZVAL_RES(zSig, zend_register_resource(newsig, le_secp256k1_recoverable_sig));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘void *’ but argument is of type ‘int’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1046:9: error: too few arguments to function ‘zend_register_resource’
ZVAL_RES(zSig, zend_register_resource(newsig, le_secp256k1_recoverable_sig));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: declared here
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_ecdsa_recover’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1068:5: error: unknown type name ‘zend_string’
zend_string *msg32;
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1075:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, 0)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1079:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((sig = (secp256k1_ecdsa_recoverable_signature *)zend_fetch_resource2_ex(zSig, SECP256K1_RECOVERABLE_SIG_RES_NAME, le_secp256k1_recoverable_sig, 0)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1084:61: error: request for member ‘val’ in something not a structure or union
result = secp256k1_ecdsa_recover(ctx, pubkey, sig, msg32->val);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1086:9: warning: passing argument 1 of ‘zend_register_resource’ from incompatible pointer type [enabled by default]
ZVAL_RES(zPubKey, zend_register_resource(pubkey, le_secp256k1_pubkey));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘struct zval *’ but argument is of type ‘struct secp256k1_pubkey *’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1086:9: warning: passing argument 2 of ‘zend_register_resource’ makes pointer from integer without a cast [enabled by default]
ZVAL_RES(zPubKey, zend_register_resource(pubkey, le_secp256k1_pubkey));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘void *’ but argument is of type ‘int’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1086:9: error: too few arguments to function ‘zend_register_resource’
ZVAL_RES(zPubKey, zend_register_resource(pubkey, le_secp256k1_pubkey));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: declared here
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_ecdh’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1098:5: error: unknown type name ‘zend_string’
zend_string *privKey;
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1105:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1109:19: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((pubkey = (secp256k1_pubkey *)zend_fetch_resource2_ex(zPubKey, SECP256K1_PUBKEY_RES_NAME, le_secp256k1_pubkey, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1115:62: error: request for member ‘val’ in something not a structure or union
result = secp256k1_ecdh(ctx, resultChars, pubkey, privKey->val);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1117:46: error: macro "ZVAL_STRINGL" requires 4 arguments, but only 3 given
ZVAL_STRINGL(zResult, resultChars, 32);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1117:9: error: ‘ZVAL_STRINGL’ undeclared (first use in this function)
ZVAL_STRINGL(zResult, resultChars, 32);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_schnorr_verify’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1130:5: error: unknown type name ‘zend_string’
zend_string *msg32, *sig64;
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1137:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1141:19: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((pubkey = (secp256k1_pubkey *)zend_fetch_resource2_ex(zPubKey, SECP256K1_PUBKEY_RES_NAME, le_secp256k1_pubkey, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1145:49: error: request for member ‘val’ in something not a structure or union
result = secp256k1_schnorr_verify(ctx, sig64->val, msg32->val, pubkey);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1145:61: error: request for member ‘val’ in something not a structure or union
result = secp256k1_schnorr_verify(ctx, sig64->val, msg32->val, pubkey);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_schnorr_sign’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1154:5: error: unknown type name ‘zend_string’
zend_string *seckey, *msg32;
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1161:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1165:14: error: request for member ‘len’ in something not a structure or union
if (msg32->len != HASH_LENGTH) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1170:15: error: request for member ‘len’ in something not a structure or union
if (seckey->len != SECRETKEY_LENGTH) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1176:55: error: request for member ‘val’ in something not a structure or union
result = secp256k1_schnorr_sign(ctx, newsig, msg32->val, seckey->val, NULL, NULL);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1176:68: error: request for member ‘val’ in something not a structure or union
result = secp256k1_schnorr_sign(ctx, newsig, msg32->val, seckey->val, NULL, NULL);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1178:38: error: macro "ZVAL_STRINGL" requires 4 arguments, but only 3 given
ZVAL_STRINGL(zSig, newsig, 64);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1178:9: error: ‘ZVAL_STRINGL’ undeclared (first use in this function)
ZVAL_STRINGL(zSig, newsig, 64);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_schnorr_recover’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1198:5: error: unknown type name ‘zend_string’
zend_string *sig64, *msg32;
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1205:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1210:58: error: request for member ‘val’ in something not a structure or union
result = secp256k1_schnorr_recover(ctx, pubkey, sig64->val, msg32->val);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1210:70: error: request for member ‘val’ in something not a structure or union
result = secp256k1_schnorr_recover(ctx, pubkey, sig64->val, msg32->val);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1212:9: warning: passing argument 1 of ‘zend_register_resource’ from incompatible pointer type [enabled by default]
ZVAL_RES(zPubKey,zend_register_resource(pubkey, le_secp256k1_pubkey));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘struct zval *’ but argument is of type ‘struct secp256k1_pubkey *’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1212:9: warning: passing argument 2 of ‘zend_register_resource’ makes pointer from integer without a cast [enabled by default]
ZVAL_RES(zPubKey,zend_register_resource(pubkey, le_secp256k1_pubkey));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘void *’ but argument is of type ‘int’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1212:9: error: too few arguments to function ‘zend_register_resource’
ZVAL_RES(zPubKey,zend_register_resource(pubkey, le_secp256k1_pubkey));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: declared here
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_schnorr_generate_nonce_pair’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1225:5: error: unknown type name ‘zend_string’
zend_string *msg32, *seckey;
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1232:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1236:14: error: request for member ‘len’ in something not a structure or union
if (msg32->len != HASH_LENGTH) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1241:15: error: request for member ‘len’ in something not a structure or union
if (seckey->len != SECRETKEY_LENGTH) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1247:85: error: request for member ‘val’ in something not a structure or union
result = secp256k1_schnorr_generate_nonce_pair(ctx, pubnonce, privnonce32, msg32->val, seckey->val, NULL, NULL);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1247:98: error: request for member ‘val’ in something not a structure or union
result = secp256k1_schnorr_generate_nonce_pair(ctx, pubnonce, privnonce32, msg32->val, seckey->val, NULL, NULL);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1249:9: warning: passing argument 1 of ‘zend_register_resource’ from incompatible pointer type [enabled by default]
ZVAL_RES(zPubNonce, zend_register_resource(pubnonce, le_secp256k1_pubkey));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘struct zval *’ but argument is of type ‘struct secp256k1_pubkey *’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1249:9: warning: passing argument 2 of ‘zend_register_resource’ makes pointer from integer without a cast [enabled by default]
ZVAL_RES(zPubNonce, zend_register_resource(pubnonce, le_secp256k1_pubkey));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘void *’ but argument is of type ‘int’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1249:9: error: too few arguments to function ‘zend_register_resource’
ZVAL_RES(zPubNonce, zend_register_resource(pubnonce, le_secp256k1_pubkey));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: declared here
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1250:63: error: macro "ZVAL_STRINGL" requires 4 arguments, but only 3 given
ZVAL_STRINGL(zPrivNonce, privnonce32, SECRETKEY_LENGTH);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1250:9: error: ‘ZVAL_STRINGL’ undeclared (first use in this function)
ZVAL_STRINGL(zPrivNonce, privnonce32, SECRETKEY_LENGTH);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_schnorr_partial_sign’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1261:5: error: unknown type name ‘zend_string’
zend_string *seckey, *msg32, *secnonce32;
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1268:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1272:28: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((pubnonce_others = (secp256k1_pubkey *)zend_fetch_resource2_ex(zPubNonceOthers, SECP256K1_PUBKEY_RES_NAME, le_secp256k1_pubkey, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1276:14: error: request for member ‘len’ in something not a structure or union
if (msg32->len != HASH_LENGTH) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1281:15: error: request for member ‘len’ in something not a structure or union
if (seckey->len != SECRETKEY_LENGTH) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1286:19: error: request for member ‘len’ in something not a structure or union
if (secnonce32->len != SECRETKEY_LENGTH) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1292:63: error: request for member ‘val’ in something not a structure or union
result = secp256k1_schnorr_partial_sign(ctx, newsig, msg32->val, seckey->val, pubnonce_others, secnonce32->val);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1292:76: error: request for member ‘val’ in something not a structure or union
result = secp256k1_schnorr_partial_sign(ctx, newsig, msg32->val, seckey->val, pubnonce_others, secnonce32->val);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1292:110: error: request for member ‘val’ in something not a structure or union
result = secp256k1_schnorr_partial_sign(ctx, newsig, msg32->val, seckey->val, pubnonce_others, secnonce32->val);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1294:38: error: macro "ZVAL_STRINGL" requires 4 arguments, but only 3 given
ZVAL_STRINGL(zSig, newsig, 64);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1294:9: error: ‘ZVAL_STRINGL’ undeclared (first use in this function)
ZVAL_STRINGL(zSig, newsig, 64);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_schnorr_partial_combine’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1313:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1323:5: error: unknown type name ‘zend_string’
zend_string *key;
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1325:54: error: expected ‘;’ before ‘{’ token
ZEND_HASH_FOREACH_KEY_VAL(arr_hash, i, key, val) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1333:45: error: macro "ZVAL_STRINGL" requires 4 arguments, but only 3 given
ZVAL_STRINGL(zSigCombined, sig64, 64);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1333:9: error: ‘ZVAL_STRINGL’ undeclared (first use in this function)
ZVAL_STRINGL(zSigCombined, sig64, 64);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c: In function ‘zif_secp256k1_ec_pubkey_combine’:
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1352:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ((ctx = (secp256k1_context *)zend_fetch_resource2_ex(zCtx, SECP256K1_CTX_RES_NAME, le_secp256k1_ctx, -1)) == NULL) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1362:5: error: unknown type name ‘zend_string’
zend_string *key;
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1364:54: error: expected ‘;’ before ‘{’ token
ZEND_HASH_FOREACH_KEY_VAL(arr_hash, i, key, val) {
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1376:9: warning: passing argument 1 of ‘zend_register_resource’ from incompatible pointer type [enabled by default]
ZVAL_RES(zPubkeyCombined, zend_register_resource(combined, le_secp256k1_pubkey));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘struct zval *’ but argument is of type ‘struct secp256k1_pubkey *’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1376:9: warning: passing argument 2 of ‘zend_register_resource’ makes pointer from integer without a cast [enabled by default]
ZVAL_RES(zPubkeyCombined, zend_register_resource(combined, le_secp256k1_pubkey));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: expected ‘void *’ but argument is of type ‘int’
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
/home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:1376:9: error: too few arguments to function ‘zend_register_resource’
ZVAL_RES(zPubkeyCombined, zend_register_resource(combined, le_secp256k1_pubkey));
^
In file included from /usr/include/php5/Zend/zend_API.h:27:0,
from /usr/include/php5/main/php.h:39,
from /home/ubuntu/workspace/secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php5/Zend/zend_list.h:82:14: note: declared here
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
^
make: *
* [secp256k1.lo] Error 1

Secp256k1 failed to parse public key

I am getting this error from my application somewhat erratically but frequently. Once it starts to happen, it seems to be repeatable with successive executions for the same xpub.

If I disable the secp256k1 extension and run again without any code changes (using bitwasp/bitcoin-php lib) it always executes without fail.

So I get the feeling the extension is (randomly?) getting wedged into an unhappy state and then staying that way.

Sorry I do not have a simple test case at present. If I find/devise one, I will attach it.

The xpub that failed in this particular case was:
xpub697odnriKgTgWE4my6au8nd8haUfAMzLGFpDemAkRbCMgGVxANuj9DffNLgDjPA1dnxzi8oFmM79ZPgKVfCV7Saj8sQUL7tJfeZDuyQNGDm

Output from my program with relevant stack trace was:
2015-12-30T16:34:28-08:00 [pid: 15973] [exception] -- #1: RuntimeException. code: 0. Secp256k1 failed to parse public key

/home/websites/hd-wallet-addrs/vendor/bitwasp/bitcoin/src/Crypto/EcAdapter/Impl/Secp256k1/Serializer/Key/PublicKeySerializer.php : 72

Stack Trace:
#0 /home/websites/hd-wallet-addrs/vendor/bitwasp/bitcoin/src/Key/PublicKeyFactory.php(33): BitWasp\Bitcoin\Crypto\EcAdapter\Impl\Secp256k1\Serializer\Key\PublicKeySerializer->parse('0374e53bc70054c...')
#1 /home/websites/hd-wallet-addrs/vendor/bitwasp/bitcoin/src/Serializer/Key/HierarchicalKey/HexExtendedKeySerializer.php(103): BitWasp\Bitcoin\Key\PublicKeyFactory::fromHex('0374e53bc70054c...', Object(BitWasp\Bitcoin\Crypto\EcAdapter\Impl\Secp256k1\Adapter\EcAdapter))
#2 /home/websites/hd-wallet-addrs/vendor/bitwasp/bitcoin/src/Serializer/Key/HierarchicalKey/HexExtendedKeySerializer.php(117): BitWasp\Bitcoin\Serializer\Key\HierarchicalKey\HexExtendedKeySerializer->fromParser(Object(BitWasp\Buffertools\Parser))
#3 /home/websites/hd-wallet-addrs/vendor/bitwasp/bitcoin/src/Serializer/Key/HierarchicalKey/ExtendedKeySerializer.php(43): BitWasp\Bitcoin\Serializer\Key\HierarchicalKey\HexExtendedKeySerializer->parse(Object(BitWasp\Buffertools\Buffer))
#4 /home/websites/hd-wallet-addrs/vendor/bitwasp/bitcoin/src/Key/Deterministic/HierarchicalKeyFactory.php(67): BitWasp\Bitcoin\Serializer\Key\HierarchicalKey\ExtendedKeySerializer->parse('xpub697odnriKgT...')

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.