Mercurial > hg > php_nacl
changeset 1:84e0f7ead583
Changed the order of function arguments to match those of the original code
author | Ivo Smits <Ivo@UCIS.nl> |
---|---|
date | Sun, 27 Feb 2011 23:56:54 +0100 |
parents | 96c976fb3c3d |
children | 04384d01b1d7 |
files | nacl.c tests/test.phpt |
diffstat | 2 files changed, 8 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/nacl.c Sun Feb 27 18:58:38 2011 +0100 +++ b/nacl.c Sun Feb 27 23:56:54 2011 +0100 @@ -75,7 +75,7 @@ PHP_FUNCTION(nacl_crypto_box_curve25519xsalsa20poly1305) { //(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *,const unsigned char *) char *m, *n, *pk, *sk; int lm, ln, lpk, lsk; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssss", &m, &lm, &pk, &lpk, &sk, &lsk, &n, &ln) == FAILURE) RETURN_NULL(); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssss", &m, &lm, &n, &ln, &pk, &lpk, &sk, &lsk) == FAILURE) RETURN_NULL(); if (ln != crypto_box_curve25519xsalsa20poly1305_NONCEBYTES) RETURN_FALSE; if (lpk != crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES) RETURN_FALSE; if (lsk != crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES) RETURN_FALSE; @@ -96,7 +96,7 @@ PHP_FUNCTION(nacl_crypto_box_curve25519xsalsa20poly1305_open) { //(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *,const unsigned char *) char *c, *n, *pk, *sk; int lc, ln, lpk, lsk; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssss", &c, &lc, &pk, &lpk, &sk, &lsk, &n, &ln) == FAILURE) RETURN_NULL(); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssss", &c, &lc, &n, &ln, &pk, &lpk, &sk, &lsk) == FAILURE) RETURN_NULL(); if (ln != crypto_box_curve25519xsalsa20poly1305_NONCEBYTES) RETURN_FALSE; if (lpk != crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES) RETURN_FALSE; if (lsk != crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES) RETURN_FALSE; @@ -127,7 +127,7 @@ PHP_FUNCTION(nacl_crypto_box_curve25519xsalsa20poly1305_afternm) { //(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *) char *m, *n, *k; int lm, ln, lk; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss", &m, &lm, &k, &lk, &n, &ln) == FAILURE) RETURN_NULL(); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss", &m, &lm, &n, &ln, &k, &lk) == FAILURE) RETURN_NULL(); if (ln != crypto_box_curve25519xsalsa20poly1305_NONCEBYTES) RETURN_FALSE; if (lk != crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES) RETURN_FALSE; int mlen = lm + crypto_box_curve25519xsalsa20poly1305_ZEROBYTES; @@ -147,7 +147,7 @@ PHP_FUNCTION(nacl_crypto_box_curve25519xsalsa20poly1305_open_afternm) { //(unsigned char *,const unsigned char *,unsigned long long,const unsigned char *,const unsigned char *) char *c, *n, *k; int lc, ln, lk; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss", &c, &lc, &k, &lk, &n, &ln) == FAILURE) RETURN_NULL(); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss", &c, &lc, &n, &ln, &k, &lk) == FAILURE) RETURN_NULL(); if (ln != crypto_box_curve25519xsalsa20poly1305_NONCEBYTES) RETURN_FALSE; if (lk != crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES) RETURN_FALSE; int clen = lc + crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES;
--- a/tests/test.phpt Sun Feb 27 18:58:38 2011 +0100 +++ b/tests/test.phpt Sun Feb 27 23:56:54 2011 +0100 @@ -15,15 +15,15 @@ $pk = nacl_crypto_box_curve25519xsalsa20poly1305_getpublickey($sk); echo strlen($pk).' - '.bin2hex($pk)."\n"; $pk = pack('H*', 'd394ec9fce78084c1fbc208e5a17bef3bdc4f38cc1ed9e54b9e68ecb56be1418'); - $c = nacl_crypto_box_curve25519xsalsa20poly1305($m, $pk, $sk, $n); + $c = nacl_crypto_box_curve25519xsalsa20poly1305($m, $n, $pk, $sk); echo strlen($c).' - '.bin2hex($c)."\n"; - $m = nacl_crypto_box_curve25519xsalsa20poly1305_open($c, $pk, $sk, $n); + $m = nacl_crypto_box_curve25519xsalsa20poly1305_open($c, $n, $pk, $sk); echo strlen($m).' - '.bin2hex($m)."\n"; $k = nacl_crypto_box_curve25519xsalsa20poly1305_beforenm($pk, $sk); echo strlen($k).' - '.bin2hex($k)."\n"; - $c = nacl_crypto_box_curve25519xsalsa20poly1305_afternm($m, $k, $n); + $c = nacl_crypto_box_curve25519xsalsa20poly1305_afternm($m, $n, $k); echo strlen($c).' - '.bin2hex($c)."\n"; - $m = nacl_crypto_box_curve25519xsalsa20poly1305_open_afternm($c, $k, $n); + $m = nacl_crypto_box_curve25519xsalsa20poly1305_open_afternm($c, $n, $k); echo strlen($m).' - '.bin2hex($m)."\n"; echo "ok\n"; ?>