Code Monkey home page Code Monkey logo

curve25519-php's Introduction

Hi! 👋

I'm mgp25.

I am an independent security researcher.

Contact with me via email if you are looking for any research or audits:

  • Technical research
  • Penetration testing
  • Android and iOS reverse engineering courses
  • Auditing software, networks and websites
  • Security Awareness Campaigns
  • Hardware hacking
  • Auditing Smart contracts

"To find yourself, think for yourself" - Socrates

curve25519-php's People

Contributors

charlesportwoodii avatar mgp25 avatar pinfort avatar sgatu 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

Watchers

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

curve25519-php's Issues

Unable to run on Windows 64-bit

Hello, I am unable to run on a 64-bit environment, and did not understand whether it is possible to compile this version.

Can you help me?

EDIT: Windows Server 2008 64-bit

libtool version mismatch while trying to build the package

Trying to build it on my gentoo linux v13, I'm getting
libtool: Version mismatch error.

During the make process.

Full log:

avenger@ethereal ~/whatsapi/curve25519-php $ phpize
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226
avenger@ethereal ~/whatsapi/curve25519-php $ ./configure
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/lib64/php5.6
checking for PHP includes... -I/usr/lib64/php5.6/include/php -I/usr/lib64/php5.6/include/php/main -I/usr/lib64/php5.6/include/php/TSRM -I/usr/lib64/php5.6/include/php/Zend -I/usr/lib64/php5.6/include/php/ext -I/usr/lib64/php5.6/include/php/ext/date/lib
checking for PHP extension directory... /usr/lib64/php5.6/lib/extensions/no-debug-zts-20131226
checking for PHP installed headers prefix... /usr/lib64/php5.6/include/php
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 whether to enable cuve25519 extension... yes, shared
checking for ld used by cc... /usr/x86_64-pc-linux-gnu/bin/ld
checking if the linker (/usr/x86_64-pc-linux-gnu/bin/ld) is GNU ld... yes
checking for /usr/x86_64-pc-linux-gnu/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
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 dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/x86_64-pc-linux-gnu/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

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
avenger@ethereal ~/whatsapi/curve25519-php $ make
/bin/sh /home/avenger/whatsapi/curve25519-php/libtool --mode=compile cc  -I. -I/home/avenger/whatsapi/curve25519-php -DPHP_ATOM_INC -I/home/avenger/whatsapi/curve25519-php/include -I/home/avenger/whatsapi/curve25519-php/main -I/home/avenger/whatsapi/curve25519-php -I/usr/lib64/php5.6/include/php -I/usr/lib64/php5.6/include/php/main -I/usr/lib64/php5.6/include/php/TSRM -I/usr/lib64/php5.6/include/php/Zend -I/usr/lib64/php5.6/include/php/ext -I/usr/lib64/php5.6/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /home/avenger/whatsapi/curve25519-php/curve.c -o curve.lo
libtool: Version mismatch error.  This is libtool 2.4.6, but the
libtool: definition of this LT_INIT comes from an older release.
libtool: You should recreate aclocal.m4 with macros from libtool 2.4.6
libtool: and run autoconf again.
Makefile:180: recipe for target 'curve.lo' failed
make: *** [curve.lo] Error 63
avenger@ethereal ~/whatsapi/curve25519-php $

I have tried to run autoreconf with several flags for no avail, so I'll be trying a full update on my machine and update here if I succeed or with what solution worked for me (if I can find one).

Linux - library precompiled?

Hi,

Due to some weird php-Settings (restrictions) on my server (virtual host) I am not able to compile the library. Is there a pre-compiled version for Gentoo 2.2 64bit out there?
I guess I would just need the *.so-file?

Call to undefined function curve25519_private()

I have installed curve and can find it in my PHPinfo():
PHPInfo() Curve25519

But my script give the error:

PHP Fatal error:  Call to undefined function curve25519_private() in Curve.php on line 14

Which has the following code:

<?php
/* codeline 1-12... */

   $secureRandom = self::getSecureRandom();
   $private = curve25519_private($secureRandom);
   $public = curve25519_public($private);

/* .... */

After more research the extension only returns the following functions

/* print_r(get_extension_funcs("curve25519")); */
Array
(
    [0] => curve25519_public
    [1] => curve25519_shared
)

So not the curve25519_private(), curve25519_sign() or curve25519_verify() functions...

How to handle this?

Error while running "make"

This is what I got:

/var/www/gecko/curve25519-php/curve.c: In function 'zif_curve25519_sign':
/var/www/gecko/curve25519-php/curve.c:37:40: error: macro "RETURN_STRINGL" passed 3 arguments, but takes just 2
   RETURN_STRINGL((char*)signature, 64,1);
                                        ^
/var/www/gecko/curve25519-php/curve.c:37:3: error: 'RETURN_STRINGL' undeclared (first use in this function)
   RETURN_STRINGL((char*)signature, 64,1);
   ^
/var/www/gecko/curve25519-php/curve.c:37:3: note: each undeclared identifier is reported only once for each function it appears in
/var/www/gecko/curve25519-php/curve.c: In function 'zif_curve25519_private':
/var/www/gecko/curve25519-php/curve.c:76:33: error: macro "RETURN_STRINGL" passed 3 arguments, but takes just 2
     RETURN_STRINGL(random, 32, 1);
                                 ^
/var/www/gecko/curve25519-php/curve.c:76:5: error: 'RETURN_STRINGL' undeclared (first use in this function)
     RETURN_STRINGL(random, 32, 1);
     ^
/var/www/gecko/curve25519-php/curve.c: In function 'zif_curve25519_public':
/var/www/gecko/curve25519-php/curve.c:97:37: error: macro "RETURN_STRINGL" passed 3 arguments, but takes just 2
  RETURN_STRINGL((char*)public, 32, 1);
                                     ^
/var/www/gecko/curve25519-php/curve.c:97:2: error: 'RETURN_STRINGL' undeclared (first use in this function)
  RETURN_STRINGL((char*)public, 32, 1);
  ^
/var/www/gecko/curve25519-php/curve.c: In function 'zif_curve25519_shared':
/var/www/gecko/curve25519-php/curve.c:124:34: error: macro "RETURN_STRINGL" passed 3 arguments, but takes just 2
  RETURN_STRINGL(shared_key, 32, 1);
                                  ^
/var/www/gecko/curve25519-php/curve.c:124:2: error: 'RETURN_STRINGL' undeclared (first use in this function)
  RETURN_STRINGL(shared_key, 32, 1);
  ^
make: *** [curve.lo] Error 1

I did installed PHP 7.

Any ideas ?

Error in command make

My php is 5.3.3
S.O CentOs 64 bits

I hope you can help me

regards

/bin/sh /opt/curve25519-php-master/libtool --mode=compile cc -I. -I/opt/curve25519-php-master -DPHP_ATOM_INC -I/opt/curve25519-php-master/include -I/opt/curve25519-php-master/main -I/opt/curve25519-php-master -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 -DHAVE_CONFIG_H -g -O2 -c /opt/curve25519-php-master/curve.c -o curve.lo
libtool: compile: cc -I. -I/opt/curve25519-php-master -DPHP_ATOM_INC -I/opt/curve25519-php-master/include -I/opt/curve25519-php-master/main -I/opt/curve25519-php-master -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 -DHAVE_CONFIG_H -g -O2 -c /opt/curve25519-php-master/curve.c -fPIC -DPIC -o .libs/curve.o
/opt/curve25519-php-master/curve.c:158: error: ‘PHP_FE_END’ undeclared here (not in a function)
make: *** [curve.lo] Error 1

It is supported on Raspberry PI?

Hello, just ask if these extensions (curve25519.so and protobuf.so) operating in the Raspberry PI, I use a Linux distribution (Raspbian), currently operating in WINDOWS achieved, but try Raspbian fails to operate.

Chat-API is great for use with WhastApp but my PC can not be on all day, so I need to run my Raspberry PI.

I use command: php -m
 photo img_zpsy7uqck1b.jpg

Error in make command

Hello I'm trying compile the extension but it produce some errors, I hope you can help me

Regards

About my development environment
CentOS 6.7
64 bits
Core 2.6.32
rhel 6
PHP 7.0.5RC1
Zend Engine v3.0.0

Error Message:
[root@admin curve25519-php-master]# make
/bin/sh /opt/curve25519-php-master/libtool --mode=compile cc -I. -I/opt/curve25519-php-master -DPHP_ATOM_INC -I/opt/curve25519-php-master/include -I/opt/curve25519-php-master/main -I/opt/curve25519-php-master -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 -DHAVE_CONFIG_H -g -O2 -c /opt/curve25519-php-master/curve.c -o curve.lo
libtool: compile: cc -I. -I/opt/curve25519-php-master -DPHP_ATOM_INC -I/opt/curve25519-php-master/include -I/opt/curve25519-php-master/main -I/opt/curve25519-php-master -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 -DHAVE_CONFIG_H -g -O2 -c /opt/curve25519-php-master/curve.c -fPIC -DPIC -o .libs/curve.o
/opt/curve25519-php-master/curve.c:37:40: error: macro "RETURN_STRINGL" passed 3 arguments, but takes just 2
/opt/curve25519-php-master/curve.c: In function ‘zif_curve25519_sign’:
/opt/curve25519-php-master/curve.c:37: error: ‘RETURN_STRINGL’ undeclared (first use in this function)
/opt/curve25519-php-master/curve.c:37: error: (Each undeclared identifier is reported only once
/opt/curve25519-php-master/curve.c:37: error: for each function it appears in.)
/opt/curve25519-php-master/curve.c:76:33: error: macro "RETURN_STRINGL" passed 3 arguments, but takes just 2
/opt/curve25519-php-master/curve.c: In function ‘zif_curve25519_private’:
/opt/curve25519-php-master/curve.c:76: error: ‘RETURN_STRINGL’ undeclared (first use in this function)
/opt/curve25519-php-master/curve.c:97:37: error: macro "RETURN_STRINGL" passed 3 arguments, but takes just 2
/opt/curve25519-php-master/curve.c: In function ‘zif_curve25519_public’:
/opt/curve25519-php-master/curve.c:97: error: ‘RETURN_STRINGL’ undeclared (first use in this function)
/opt/curve25519-php-master/curve.c:124:34: error: macro "RETURN_STRINGL" passed 3 arguments, but takes just 2
/opt/curve25519-php-master/curve.c: In function ‘zif_curve25519_shared’:
/opt/curve25519-php-master/curve.c:124: error: ‘RETURN_STRINGL’ undeclared (first use in this function)
make: *** [curve.lo] Error 1

Error while making

When executing make after phpize'ing it, this is what I receive:

/bin/sh /tmp/curve25519-php/libtool --mode=compile cc  -I. -I/tmp/curve25519-php -DPHP_ATOM_INC -I/tmp/curve25519-php/include -I/tmp/curve25519-php/main -I/tmp/curve25519-php -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/curve25519-php/curve.c -o curve.lo
libtool: compile:  cc -I. -I/tmp/curve25519-php -DPHP_ATOM_INC -I/tmp/curve25519-php/include -I/tmp/curve25519-php/main -I/tmp/curve25519-php -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/curve25519-php/curve.c  -fPIC -DPIC -o .libs/curve.o
/tmp/curve25519-php/curve.c: In function 'zif_curve25519_sign':
/tmp/curve25519-php/curve.c:37:40: error: macro "RETURN_STRINGL" passed 3 arguments, but takes just 2
   RETURN_STRINGL((char*)signature, 64,1);
                                        ^
/tmp/curve25519-php/curve.c:37:3: error: 'RETURN_STRINGL' undeclared (first use in this function)
   RETURN_STRINGL((char*)signature, 64,1);
   ^
/tmp/curve25519-php/curve.c:37:3: note: each undeclared identifier is reported only once for each function it appears in
/tmp/curve25519-php/curve.c: In function 'zif_curve25519_private':
/tmp/curve25519-php/curve.c:76:33: error: macro "RETURN_STRINGL" passed 3 arguments, but takes just 2
     RETURN_STRINGL(random, 32, 1);
                                 ^
/tmp/curve25519-php/curve.c:76:5: error: 'RETURN_STRINGL' undeclared (first use in this function)
     RETURN_STRINGL(random, 32, 1);
     ^
/tmp/curve25519-php/curve.c: In function 'zif_curve25519_public':
/tmp/curve25519-php/curve.c:97:37: error: macro "RETURN_STRINGL" passed 3 arguments, but takes just 2
  RETURN_STRINGL((char*)public, 32, 1);
                                     ^
/tmp/curve25519-php/curve.c:97:2: error: 'RETURN_STRINGL' undeclared (first use in this function)
  RETURN_STRINGL((char*)public, 32, 1);
  ^
/tmp/curve25519-php/curve.c: In function 'zif_curve25519_shared':
/tmp/curve25519-php/curve.c:124:34: error: macro "RETURN_STRINGL" passed 3 arguments, but takes just 2
  RETURN_STRINGL(shared_key, 32, 1);
                                  ^
/tmp/curve25519-php/curve.c:124:2: error: 'RETURN_STRINGL' undeclared (first use in this function)
  RETURN_STRINGL(shared_key, 32, 1);
  ^
Makefile:193: recipe for target 'curve.lo' failed
make: *** [curve.lo] Error 1

How to use the library in my own PHP file

Hi,
I am a PHP noob, and i don't understand how to import your code.
I want to be able to run this in myscript.php:

$secureRandom = self::getSecureRandom();
$private = curve25519_private($secureRandom);
$public  = curve25519_public($private);
$keyPair = new ECKeyPair(new DjbECPublicKey($public),new DjbECPrivateKey($private));
$agreement = curve25519_shared( $keyPair->getPrivateKey(),$keyPair->getPublicKey());

I cloned the repo and installed it, how do I use the curve25519_private function (for example) inside my PHP file?

When I run php run-tests.php I get this:

PHP Warning:  PHP Startup: Unable to load dynamic library 'libsodium.so' (tried: /usr/lib/php/modules/libsodium.so (/usr/lib/php/modules/libsodium.so: cannot open shared object file: No such file or directory), /usr/lib/php/modules/libsodium.so.so (/usr/lib/php/modules/libsodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'libsodium.so' (tried: /usr/lib/php/modules/libsodium.so (/usr/lib/php/modules/libsodium.so: cannot open shared object file: No such file or directory), /usr/lib/php/modules/libsodium.so.so (/usr/lib/php/modules/libsodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'libsodium.so' (tried: /usr/lib/php/modules/libsodium.so (/usr/lib/php/modules/libsodium.so: cannot open shared object file: No such file or directory), /usr/lib/php/modules/libsodium.so.so (/usr/lib/php/modules/libsodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

=====================================================================
PHP         : /usr/bin/php 
Warning: PHP Startup: Unable to load dynamic library 'libsodium.so' (tried: /usr/lib/php/modules/libsodium.so (/usr/lib/php/modules/libsodium.so: cannot open shared object file: No such file or directory), /usr/lib/php/modules/libsodium.so.so (/usr/lib/php/modules/libsodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

PHP_SAPI    : cli
PHP_VERSION : 7.4.3
ZEND_VERSION: 3.4.0
PHP_OS      : Linux *** x86_64
INI actual  : /etc/php/php.ini
More .INIs  :   
CWD         : /***/curve25519-php
Extra dirs  : 
VALGRIND    : Not used
=====================================================================
TIME START 2020-03-02 18:42:26
=====================================================================
No tests were run.

When i run php -m I get:

PHP Warning:  PHP Startup: Unable to load dynamic library 'libsodium.so' (tried: /usr/lib/php/modules/libsodium.so (/usr/lib/php/modules/libsodium.so: cannot open shared object file: No such file or directory), /usr/lib/php/modules/libsodium.so.so (/usr/lib/php/modules/libsodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[PHP Modules]
Core
ctype
curl
date
dom
fileinfo
filter
hash
json
libxml
mbstring
mysqlnd
openssl
pcntl
pcre
PDO
Phar
posix
readline
Reflection
session
SimpleXML
SPL
standard
tokenizer
xml
xmlreader
xmlwriter
zip
zlib

[Zend Modules]

I'm on Arch Linux

Thanks in advance.

Unable to phpize in windows

This module easily got phpized in linux and gave .so, but phpizing in windows is not happening. Can you provide dll for it?

Not working in windows 10

Hi, the dlls are not working in windows 10. Its running fine in windows 7. Anyone have this problem? The error:

PHP Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_curve25519_ts.dll' - %1 is not a valid Win32 application.

in Unknown on line 0

PHP Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_protobuf_ts.dll' - %1 is not a valid Win32 application.

in Unknown on line 0

Please advice.

Ubuntu 16.04 curve25519 installed but not decrypting

I am setting up a Ubuntu 16.04, in theory everything installed, curve25519, protobuf and crypto.
But for some how, curve25519 seems to be not decrypting my messages.
Is there some other environment variable that I should check?

I have a Centos running smoothly, this time I am trying another machine this time with Ubuntu.

[PHP Modules]
bcmath
bz2
calendar
Core
crypto
ctype
curl
curve25519
date
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
imap
intl
json
libxml
mbstring
mcrypt
mhash
mysql
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
protobuf
pspell
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

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.