diff --git a/include/Makefile.am b/include/Makefile.am index 109f440..c70bb0c 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -19,6 +19,7 @@ PCPEXPORT = pcp.h \ pcp/zmq_z85.h \ pcp/ed.h \ pcp/base85.h \ - pcp/buffer.h + pcp/buffer.h \ + pcp/mgmt.h nobase_include_HEADERS = $(PCPEXPORT) diff --git a/include/pcp.h b/include/pcp.h index d9072e5..79325d7 100644 --- a/include/pcp.h +++ b/include/pcp.h @@ -7,6 +7,7 @@ extern "C" { #include "pcp/base85.h" #include "pcp/buffer.h" +#include "pcp/config.h" #include "pcp/crypto.h" #include "pcp/defines.h" #include "pcp/digital_crc32.h" @@ -17,6 +18,7 @@ extern "C" { #include "pcp/keyhash.h" #include "pcp/mac.h" #include "pcp/mem.h" +#include "pcp/mgmt.h" #include "pcp/pad.h" #include "pcp/platform.h" #include "pcp/plist.h" diff --git a/libpcp/Makefile.am b/libpcp/Makefile.am index f67237f..fbaeefc 100644 --- a/libpcp/Makefile.am +++ b/libpcp/Makefile.am @@ -30,6 +30,6 @@ libpcp1_la_SOURCES = mac.c mem.c pad.c version.c \ vault.c fatal.c jenhash.c digital_crc32.c \ crypto.c ed.c keyhash.c scrypt.c \ scrypt/crypto/sha256.c scrypt/crypto/crypto_scrypt-nosse.c \ - base85.c util.c buffer.c + base85.c util.c buffer.c mgmt.c include_HEADERS = ../include/pcp.h diff --git a/tests/bart.pub b/tests/bart.pub index 5af4b7f..9931763 100644 --- a/tests/bart.pub +++ b/tests/bart.pub @@ -1,35 +1,35 @@ ----- BEGIN PCP PUBLIC KEY ----- - Generated by: Pretty Curved Privacy Version 0.1.5 + Generated by: Pretty Curved Privacy Version 0.2.1 Cipher: CURVE25519-ED25519-SALSA20-POLY1305 Owner: Bart Mail: bart@local - Key-ID: 0x45AE802C2C338179 - Public-Key: 1aoiXG/sSsaV]E-WH/#GVl*Jh79V.&=rXRqkI05DzVx+q - Creation Time: 2014-01-19T19:23:33 - Checksum: 1F:CC:95:EB:21:AD:44:9B:F2:5C:69:79:4D:C8:15:5E - FD:30:52:81:07:91:A8:1A:A1:3A:C5:DF:FE:E5:B4:20 - Serial Number: 0x7F7EF76B + Key-ID: 0x1AAAC77510D883C9 + Public-Key: :FbOC%cR$8DkWh1PZW12.G + Creation Time: 2014-02-08T20:17:55 + Checksum: 8A:AB:90:72:98:EE:3F:76:BE:9C:66:38:9F:1B:CF:A8 + 9D:5C:81:92:90:F7:06:19:DB:DA:2C:BE:FA:DB:6F:58 + Serial Number: 0xD716902C Key Version: 0x00000005 Random Art ID: +----------------+ - | . +=. | - | .o++ | - | ...o. | - | . + | - | o . . | - | . | | | | | + | . | + | . . . | + | ...o . | + | .... | + | o. . .. | + |o o+.+o | +----------------+ -1aoiXG/sSsaV]E-WH/#GVl*Jh79V.&=rXRqkI05Dz.ocVE}GuwKiCaY.FgW>a^1jBkLk!$S -59:?6wqSA.A}WKBo4I-labfz?:bQ{Xo!NL6Z7tG/VWl0RuqnXn8JMO-?*q2cpK9Js:-Suoy -4-lIi=B+y](bA0Jhd#4<[rlyvL -A.Eo7)h>87eXC*WnPnq+sdYkvArnnKn[Z41{K>N#hvk#dFzzX:D1j(3=Xg -e5dm.erB?!a)hbD7LQ7W7^KWuj/N-!u0K?FJs13#qsG.fdh4{N^A7UjZ/6pm.%tDa[Hu[!F -Qgmf.%uzUT]doM3u+Rrku+ruq=VOHos/Dpdzv=Kf+<9ztlR8hwei{0q3WCMDTbkl0-c-xCU -uk/a}6X<>CYLhz1#g5Ho2f[Wx{}L.CNdR$yyF^jSotPS@D.A&Y] -@cq/t=y/(Q1>9bd7/P4a0Pe{s@4KxYc&48rN5=cz:b6B1^2=/DTigC4=MZipgg/qkR$8DkWh1PZW12.GTWVNd>TPIvWwa/eM!Q7Y29%(:o%s787P}?zw+S2?CF{9A7^}gY*O+!somv3jXe)C$y[oSy5xtuBVvr:h(KC=8fN4q8%& +jZag:lz8MH5v6HJ]Cq>CSyW6>YifUv]e34qfjb(WoI>(e!AHXX.6^UdcPr8=34vLS@:LkFj +OaA--.&DJrk%W<%h-irzl]WdZlPCbG00000qUC.500005/a%D0 ------ END PCP PUBLICKEY ------ diff --git a/tests/buffertest.c b/tests/buffertest.c index 1f430b0..991c305 100644 --- a/tests/buffertest.c +++ b/tests/buffertest.c @@ -34,7 +34,7 @@ int main() { for(x=0; x < bs; x+=32) { fprintf(stderr, "before get\n"); buffer_info(test); - if(buffer_get(test, g, 32) > 0) { + if(buffer_get_chunk(test, g, 32) > 0) { fprintf(stderr, "after get\n"); buffer_info(test); _dump("got", g, 32); diff --git a/tests/env/share/alice.pbp b/tests/env/share/alice.pbp new file mode 100644 index 0000000..6699a4c --- /dev/null +++ b/tests/env/share/alice.pbp @@ -0,0 +1 @@ +Hcw%wikuo`2xB^Eg3|A&jn`iC^8L`huRTz&$8JABJ~yzSdqgF?@J}LM5=-Pi$uYUKi7H6RfN|AyW(Xn)8X~?h^h^15?{A1GN3}61h?H68X~?h^h^15?{A1GN3}61h?H63>;bI)5h)TD_YZpLg)Shh5XPTRuFS@W?Nk7FaBvFGB7bTEif`IFg8>%IXX2sIxsmdFfcGMFfbq>ARr(hGB7bTEif`IFg8>%IXX2sIxsmdFfcGMFfbq>ARr(hL2PMbX<+~W \ No newline at end of file diff --git a/tests/env/share/bob.pbp b/tests/env/share/bob.pbp new file mode 100644 index 0000000..de640e0 --- /dev/null +++ b/tests/env/share/bob.pbp @@ -0,0 +1 @@ +8)hNsm5fgZv#P5AhByrYDp3=8ssB14Ld!M);KP*~-NII#9R&>44-BBfb4w`*yuC~dsPd57h1gd%I65^rIx;sdGC4RfF*qO~ARr(hGB7bUEif`IFg8>%I65^rIx;sdGC4RfIXEC7ARr(hLT_RK diff --git a/tests/env/share/build/bdist.freebsd-9.0-RELEASE-p3-amd64/egg/pysodium/__pycache__/_cffi__x6f20fc6x6947e85f.c b/tests/env/share/build/bdist.freebsd-9.0-RELEASE-p3-amd64/egg/pysodium/__pycache__/_cffi__x6f20fc6x6947e85f.c new file mode 100644 index 0000000..fc28deb --- /dev/null +++ b/tests/env/share/build/bdist.freebsd-9.0-RELEASE-p3-amd64/egg/pysodium/__pycache__/_cffi__x6f20fc6x6947e85f.c @@ -0,0 +1,1997 @@ + +#include +#include + +#ifdef MS_WIN32 +#include /* for alloca() */ +typedef __int8 int8_t; +typedef __int16 int16_t; +typedef __int32 int32_t; +typedef __int64 int64_t; +typedef unsigned __int8 uint8_t; +typedef unsigned __int16 uint16_t; +typedef unsigned __int32 uint32_t; +typedef unsigned __int64 uint64_t; +typedef unsigned char _Bool; +#endif + +#if PY_MAJOR_VERSION < 3 +# undef PyCapsule_CheckExact +# undef PyCapsule_GetPointer +# define PyCapsule_CheckExact(capsule) (PyCObject_Check(capsule)) +# define PyCapsule_GetPointer(capsule, name) \ + (PyCObject_AsVoidPtr(capsule)) +#endif + +#if PY_MAJOR_VERSION >= 3 +# define PyInt_FromLong PyLong_FromLong +#endif + +#define _cffi_from_c_double PyFloat_FromDouble +#define _cffi_from_c_float PyFloat_FromDouble +#define _cffi_from_c_long PyInt_FromLong +#define _cffi_from_c_ulong PyLong_FromUnsignedLong +#define _cffi_from_c_longlong PyLong_FromLongLong +#define _cffi_from_c_ulonglong PyLong_FromUnsignedLongLong + +#define _cffi_to_c_double PyFloat_AsDouble +#define _cffi_to_c_float PyFloat_AsDouble + +#define _cffi_from_c_SIGNED(x, type) \ + (sizeof(type) <= sizeof(long) ? PyInt_FromLong(x) : \ + PyLong_FromLongLong(x)) +#define _cffi_from_c_UNSIGNED(x, type) \ + (sizeof(type) < sizeof(long) ? PyInt_FromLong(x) : \ + sizeof(type) == sizeof(long) ? PyLong_FromUnsignedLong(x) : \ + PyLong_FromUnsignedLongLong(x)) + +#define _cffi_to_c_SIGNED(o, type) \ + (sizeof(type) == 1 ? _cffi_to_c_i8(o) : \ + sizeof(type) == 2 ? _cffi_to_c_i16(o) : \ + sizeof(type) == 4 ? _cffi_to_c_i32(o) : \ + sizeof(type) == 8 ? _cffi_to_c_i64(o) : \ + (Py_FatalError("unsupported size for type " #type), 0)) +#define _cffi_to_c_UNSIGNED(o, type) \ + (sizeof(type) == 1 ? _cffi_to_c_u8(o) : \ + sizeof(type) == 2 ? _cffi_to_c_u16(o) : \ + sizeof(type) == 4 ? _cffi_to_c_u32(o) : \ + sizeof(type) == 8 ? _cffi_to_c_u64(o) : \ + (Py_FatalError("unsupported size for type " #type), 0)) + +#define _cffi_to_c_i8 \ + ((int(*)(PyObject *))_cffi_exports[1]) +#define _cffi_to_c_u8 \ + ((int(*)(PyObject *))_cffi_exports[2]) +#define _cffi_to_c_i16 \ + ((int(*)(PyObject *))_cffi_exports[3]) +#define _cffi_to_c_u16 \ + ((int(*)(PyObject *))_cffi_exports[4]) +#define _cffi_to_c_i32 \ + ((int(*)(PyObject *))_cffi_exports[5]) +#define _cffi_to_c_u32 \ + ((unsigned int(*)(PyObject *))_cffi_exports[6]) +#define _cffi_to_c_i64 \ + ((long long(*)(PyObject *))_cffi_exports[7]) +#define _cffi_to_c_u64 \ + ((unsigned long long(*)(PyObject *))_cffi_exports[8]) +#define _cffi_to_c_char \ + ((int(*)(PyObject *))_cffi_exports[9]) +#define _cffi_from_c_pointer \ + ((PyObject *(*)(char *, CTypeDescrObject *))_cffi_exports[10]) +#define _cffi_to_c_pointer \ + ((char *(*)(PyObject *, CTypeDescrObject *))_cffi_exports[11]) +#define _cffi_get_struct_layout \ + ((PyObject *(*)(Py_ssize_t[]))_cffi_exports[12]) +#define _cffi_restore_errno \ + ((void(*)(void))_cffi_exports[13]) +#define _cffi_save_errno \ + ((void(*)(void))_cffi_exports[14]) +#define _cffi_from_c_char \ + ((PyObject *(*)(char))_cffi_exports[15]) +#define _cffi_from_c_deref \ + ((PyObject *(*)(char *, CTypeDescrObject *))_cffi_exports[16]) +#define _cffi_to_c \ + ((int(*)(char *, CTypeDescrObject *, PyObject *))_cffi_exports[17]) +#define _cffi_from_c_struct \ + ((PyObject *(*)(char *, CTypeDescrObject *))_cffi_exports[18]) +#define _cffi_to_c_wchar_t \ + ((wchar_t(*)(PyObject *))_cffi_exports[19]) +#define _cffi_from_c_wchar_t \ + ((PyObject *(*)(wchar_t))_cffi_exports[20]) +#define _cffi_to_c_long_double \ + ((long double(*)(PyObject *))_cffi_exports[21]) +#define _cffi_to_c__Bool \ + ((_Bool(*)(PyObject *))_cffi_exports[22]) +#define _cffi_prepare_pointer_call_argument \ + ((Py_ssize_t(*)(CTypeDescrObject *, PyObject *, char **))_cffi_exports[23]) +#define _cffi_convert_array_from_object \ + ((int(*)(char *, CTypeDescrObject *, PyObject *))_cffi_exports[24]) +#define _CFFI_NUM_EXPORTS 25 + +typedef struct _ctypedescr CTypeDescrObject; + +static void *_cffi_exports[_CFFI_NUM_EXPORTS]; +static PyObject *_cffi_types, *_cffi_VerificationError; + +static int _cffi_setup_custom(PyObject *lib); /* forward */ + +static PyObject *_cffi_setup(PyObject *self, PyObject *args) +{ + PyObject *library; + int was_alive = (_cffi_types != NULL); + if (!PyArg_ParseTuple(args, "OOO", &_cffi_types, &_cffi_VerificationError, + &library)) + return NULL; + Py_INCREF(_cffi_types); + Py_INCREF(_cffi_VerificationError); + if (_cffi_setup_custom(library) < 0) + return NULL; + return PyBool_FromLong(was_alive); +} + +static void _cffi_init(void) +{ + PyObject *module = PyImport_ImportModule("_cffi_backend"); + PyObject *c_api_object; + + if (module == NULL) + return; + + c_api_object = PyObject_GetAttrString(module, "_C_API"); + if (c_api_object == NULL) + return; + if (!PyCapsule_CheckExact(c_api_object)) { + PyErr_SetNone(PyExc_ImportError); + return; + } + memcpy(_cffi_exports, PyCapsule_GetPointer(c_api_object, "cffi"), + _CFFI_NUM_EXPORTS * sizeof(void *)); +} + +#define _cffi_type(num) ((CTypeDescrObject *)PyList_GET_ITEM(_cffi_types, num)) + +/**********/ + + +#include + +static int _cffi_const_crypto_box_BEFORENMBYTES(PyObject *lib) +{ + PyObject *o; + int res; + if (LONG_MIN <= (crypto_box_BEFORENMBYTES) && (crypto_box_BEFORENMBYTES) <= LONG_MAX) + o = PyInt_FromLong((long)(crypto_box_BEFORENMBYTES)); + else if ((crypto_box_BEFORENMBYTES) <= 0) + o = PyLong_FromLongLong((long long)(crypto_box_BEFORENMBYTES)); + else + o = PyLong_FromUnsignedLongLong((unsigned long long)(crypto_box_BEFORENMBYTES)); + if (o == NULL) + return -1; + res = PyObject_SetAttrString(lib, "crypto_box_BEFORENMBYTES", o); + Py_DECREF(o); + if (res < 0) + return -1; + return 0; +} + +static int _cffi_const_crypto_box_BOXZEROBYTES(PyObject *lib) +{ + PyObject *o; + int res; + if (LONG_MIN <= (crypto_box_BOXZEROBYTES) && (crypto_box_BOXZEROBYTES) <= LONG_MAX) + o = PyInt_FromLong((long)(crypto_box_BOXZEROBYTES)); + else if ((crypto_box_BOXZEROBYTES) <= 0) + o = PyLong_FromLongLong((long long)(crypto_box_BOXZEROBYTES)); + else + o = PyLong_FromUnsignedLongLong((unsigned long long)(crypto_box_BOXZEROBYTES)); + if (o == NULL) + return -1; + res = PyObject_SetAttrString(lib, "crypto_box_BOXZEROBYTES", o); + Py_DECREF(o); + if (res < 0) + return -1; + return _cffi_const_crypto_box_BEFORENMBYTES(lib); +} + +static int _cffi_const_crypto_box_NONCEBYTES(PyObject *lib) +{ + PyObject *o; + int res; + if (LONG_MIN <= (crypto_box_NONCEBYTES) && (crypto_box_NONCEBYTES) <= LONG_MAX) + o = PyInt_FromLong((long)(crypto_box_NONCEBYTES)); + else if ((crypto_box_NONCEBYTES) <= 0) + o = PyLong_FromLongLong((long long)(crypto_box_NONCEBYTES)); + else + o = PyLong_FromUnsignedLongLong((unsigned long long)(crypto_box_NONCEBYTES)); + if (o == NULL) + return -1; + res = PyObject_SetAttrString(lib, "crypto_box_NONCEBYTES", o); + Py_DECREF(o); + if (res < 0) + return -1; + return _cffi_const_crypto_box_BOXZEROBYTES(lib); +} + +static int _cffi_const_crypto_box_PUBLICKEYBYTES(PyObject *lib) +{ + PyObject *o; + int res; + if (LONG_MIN <= (crypto_box_PUBLICKEYBYTES) && (crypto_box_PUBLICKEYBYTES) <= LONG_MAX) + o = PyInt_FromLong((long)(crypto_box_PUBLICKEYBYTES)); + else if ((crypto_box_PUBLICKEYBYTES) <= 0) + o = PyLong_FromLongLong((long long)(crypto_box_PUBLICKEYBYTES)); + else + o = PyLong_FromUnsignedLongLong((unsigned long long)(crypto_box_PUBLICKEYBYTES)); + if (o == NULL) + return -1; + res = PyObject_SetAttrString(lib, "crypto_box_PUBLICKEYBYTES", o); + Py_DECREF(o); + if (res < 0) + return -1; + return _cffi_const_crypto_box_NONCEBYTES(lib); +} + +static int _cffi_const_crypto_box_SECRETKEYBYTES(PyObject *lib) +{ + PyObject *o; + int res; + if (LONG_MIN <= (crypto_box_SECRETKEYBYTES) && (crypto_box_SECRETKEYBYTES) <= LONG_MAX) + o = PyInt_FromLong((long)(crypto_box_SECRETKEYBYTES)); + else if ((crypto_box_SECRETKEYBYTES) <= 0) + o = PyLong_FromLongLong((long long)(crypto_box_SECRETKEYBYTES)); + else + o = PyLong_FromUnsignedLongLong((unsigned long long)(crypto_box_SECRETKEYBYTES)); + if (o == NULL) + return -1; + res = PyObject_SetAttrString(lib, "crypto_box_SECRETKEYBYTES", o); + Py_DECREF(o); + if (res < 0) + return -1; + return _cffi_const_crypto_box_PUBLICKEYBYTES(lib); +} + +static int _cffi_const_crypto_box_ZEROBYTES(PyObject *lib) +{ + PyObject *o; + int res; + if (LONG_MIN <= (crypto_box_ZEROBYTES) && (crypto_box_ZEROBYTES) <= LONG_MAX) + o = PyInt_FromLong((long)(crypto_box_ZEROBYTES)); + else if ((crypto_box_ZEROBYTES) <= 0) + o = PyLong_FromLongLong((long long)(crypto_box_ZEROBYTES)); + else + o = PyLong_FromUnsignedLongLong((unsigned long long)(crypto_box_ZEROBYTES)); + if (o == NULL) + return -1; + res = PyObject_SetAttrString(lib, "crypto_box_ZEROBYTES", o); + Py_DECREF(o); + if (res < 0) + return -1; + return _cffi_const_crypto_box_SECRETKEYBYTES(lib); +} + +static int _cffi_const_crypto_generichash_BLOCKBYTES(PyObject *lib) +{ + PyObject *o; + int res; + if (LONG_MIN <= (crypto_generichash_BLOCKBYTES) && (crypto_generichash_BLOCKBYTES) <= LONG_MAX) + o = PyInt_FromLong((long)(crypto_generichash_BLOCKBYTES)); + else if ((crypto_generichash_BLOCKBYTES) <= 0) + o = PyLong_FromLongLong((long long)(crypto_generichash_BLOCKBYTES)); + else + o = PyLong_FromUnsignedLongLong((unsigned long long)(crypto_generichash_BLOCKBYTES)); + if (o == NULL) + return -1; + res = PyObject_SetAttrString(lib, "crypto_generichash_BLOCKBYTES", o); + Py_DECREF(o); + if (res < 0) + return -1; + return _cffi_const_crypto_box_ZEROBYTES(lib); +} + +static int _cffi_const_crypto_generichash_BYTES(PyObject *lib) +{ + PyObject *o; + int res; + if (LONG_MIN <= (crypto_generichash_BYTES) && (crypto_generichash_BYTES) <= LONG_MAX) + o = PyInt_FromLong((long)(crypto_generichash_BYTES)); + else if ((crypto_generichash_BYTES) <= 0) + o = PyLong_FromLongLong((long long)(crypto_generichash_BYTES)); + else + o = PyLong_FromUnsignedLongLong((unsigned long long)(crypto_generichash_BYTES)); + if (o == NULL) + return -1; + res = PyObject_SetAttrString(lib, "crypto_generichash_BYTES", o); + Py_DECREF(o); + if (res < 0) + return -1; + return _cffi_const_crypto_generichash_BLOCKBYTES(lib); +} + +static int _cffi_const_crypto_generichash_BYTES_MIN(PyObject *lib) +{ + PyObject *o; + int res; + if (LONG_MIN <= (crypto_generichash_BYTES_MIN) && (crypto_generichash_BYTES_MIN) <= LONG_MAX) + o = PyInt_FromLong((long)(crypto_generichash_BYTES_MIN)); + else if ((crypto_generichash_BYTES_MIN) <= 0) + o = PyLong_FromLongLong((long long)(crypto_generichash_BYTES_MIN)); + else + o = PyLong_FromUnsignedLongLong((unsigned long long)(crypto_generichash_BYTES_MIN)); + if (o == NULL) + return -1; + res = PyObject_SetAttrString(lib, "crypto_generichash_BYTES_MIN", o); + Py_DECREF(o); + if (res < 0) + return -1; + return _cffi_const_crypto_generichash_BYTES(lib); +} + +static int _cffi_const_crypto_generichash_KEYBYTES(PyObject *lib) +{ + PyObject *o; + int res; + if (LONG_MIN <= (crypto_generichash_KEYBYTES) && (crypto_generichash_KEYBYTES) <= LONG_MAX) + o = PyInt_FromLong((long)(crypto_generichash_KEYBYTES)); + else if ((crypto_generichash_KEYBYTES) <= 0) + o = PyLong_FromLongLong((long long)(crypto_generichash_KEYBYTES)); + else + o = PyLong_FromUnsignedLongLong((unsigned long long)(crypto_generichash_KEYBYTES)); + if (o == NULL) + return -1; + res = PyObject_SetAttrString(lib, "crypto_generichash_KEYBYTES", o); + Py_DECREF(o); + if (res < 0) + return -1; + return _cffi_const_crypto_generichash_BYTES_MIN(lib); +} + +static int _cffi_const_crypto_generichash_KEYBYTES_MAX(PyObject *lib) +{ + PyObject *o; + int res; + if (LONG_MIN <= (crypto_generichash_KEYBYTES_MAX) && (crypto_generichash_KEYBYTES_MAX) <= LONG_MAX) + o = PyInt_FromLong((long)(crypto_generichash_KEYBYTES_MAX)); + else if ((crypto_generichash_KEYBYTES_MAX) <= 0) + o = PyLong_FromLongLong((long long)(crypto_generichash_KEYBYTES_MAX)); + else + o = PyLong_FromUnsignedLongLong((unsigned long long)(crypto_generichash_KEYBYTES_MAX)); + if (o == NULL) + return -1; + res = PyObject_SetAttrString(lib, "crypto_generichash_KEYBYTES_MAX", o); + Py_DECREF(o); + if (res < 0) + return -1; + return _cffi_const_crypto_generichash_KEYBYTES(lib); +} + +static int _cffi_const_crypto_generichash_KEYBYTES_MIN(PyObject *lib) +{ + PyObject *o; + int res; + if (LONG_MIN <= (crypto_generichash_KEYBYTES_MIN) && (crypto_generichash_KEYBYTES_MIN) <= LONG_MAX) + o = PyInt_FromLong((long)(crypto_generichash_KEYBYTES_MIN)); + else if ((crypto_generichash_KEYBYTES_MIN) <= 0) + o = PyLong_FromLongLong((long long)(crypto_generichash_KEYBYTES_MIN)); + else + o = PyLong_FromUnsignedLongLong((unsigned long long)(crypto_generichash_KEYBYTES_MIN)); + if (o == NULL) + return -1; + res = PyObject_SetAttrString(lib, "crypto_generichash_KEYBYTES_MIN", o); + Py_DECREF(o); + if (res < 0) + return -1; + return _cffi_const_crypto_generichash_KEYBYTES_MAX(lib); +} + +static int _cffi_const_crypto_scalarmult_curve25519_BYTES(PyObject *lib) +{ + PyObject *o; + int res; + if (LONG_MIN <= (crypto_scalarmult_curve25519_BYTES) && (crypto_scalarmult_curve25519_BYTES) <= LONG_MAX) + o = PyInt_FromLong((long)(crypto_scalarmult_curve25519_BYTES)); + else if ((crypto_scalarmult_curve25519_BYTES) <= 0) + o = PyLong_FromLongLong((long long)(crypto_scalarmult_curve25519_BYTES)); + else + o = PyLong_FromUnsignedLongLong((unsigned long long)(crypto_scalarmult_curve25519_BYTES)); + if (o == NULL) + return -1; + res = PyObject_SetAttrString(lib, "crypto_scalarmult_curve25519_BYTES", o); + Py_DECREF(o); + if (res < 0) + return -1; + return _cffi_const_crypto_generichash_KEYBYTES_MIN(lib); +} + +static int _cffi_const_crypto_secretbox_BOXZEROBYTES(PyObject *lib) +{ + PyObject *o; + int res; + if (LONG_MIN <= (crypto_secretbox_BOXZEROBYTES) && (crypto_secretbox_BOXZEROBYTES) <= LONG_MAX) + o = PyInt_FromLong((long)(crypto_secretbox_BOXZEROBYTES)); + else if ((crypto_secretbox_BOXZEROBYTES) <= 0) + o = PyLong_FromLongLong((long long)(crypto_secretbox_BOXZEROBYTES)); + else + o = PyLong_FromUnsignedLongLong((unsigned long long)(crypto_secretbox_BOXZEROBYTES)); + if (o == NULL) + return -1; + res = PyObject_SetAttrString(lib, "crypto_secretbox_BOXZEROBYTES", o); + Py_DECREF(o); + if (res < 0) + return -1; + return _cffi_const_crypto_scalarmult_curve25519_BYTES(lib); +} + +static int _cffi_const_crypto_secretbox_KEYBYTES(PyObject *lib) +{ + PyObject *o; + int res; + if (LONG_MIN <= (crypto_secretbox_KEYBYTES) && (crypto_secretbox_KEYBYTES) <= LONG_MAX) + o = PyInt_FromLong((long)(crypto_secretbox_KEYBYTES)); + else if ((crypto_secretbox_KEYBYTES) <= 0) + o = PyLong_FromLongLong((long long)(crypto_secretbox_KEYBYTES)); + else + o = PyLong_FromUnsignedLongLong((unsigned long long)(crypto_secretbox_KEYBYTES)); + if (o == NULL) + return -1; + res = PyObject_SetAttrString(lib, "crypto_secretbox_KEYBYTES", o); + Py_DECREF(o); + if (res < 0) + return -1; + return _cffi_const_crypto_secretbox_BOXZEROBYTES(lib); +} + +static int _cffi_const_crypto_secretbox_NONCEBYTES(PyObject *lib) +{ + PyObject *o; + int res; + if (LONG_MIN <= (crypto_secretbox_NONCEBYTES) && (crypto_secretbox_NONCEBYTES) <= LONG_MAX) + o = PyInt_FromLong((long)(crypto_secretbox_NONCEBYTES)); + else if ((crypto_secretbox_NONCEBYTES) <= 0) + o = PyLong_FromLongLong((long long)(crypto_secretbox_NONCEBYTES)); + else + o = PyLong_FromUnsignedLongLong((unsigned long long)(crypto_secretbox_NONCEBYTES)); + if (o == NULL) + return -1; + res = PyObject_SetAttrString(lib, "crypto_secretbox_NONCEBYTES", o); + Py_DECREF(o); + if (res < 0) + return -1; + return _cffi_const_crypto_secretbox_KEYBYTES(lib); +} + +static int _cffi_const_crypto_secretbox_ZEROBYTES(PyObject *lib) +{ + PyObject *o; + int res; + if (LONG_MIN <= (crypto_secretbox_ZEROBYTES) && (crypto_secretbox_ZEROBYTES) <= LONG_MAX) + o = PyInt_FromLong((long)(crypto_secretbox_ZEROBYTES)); + else if ((crypto_secretbox_ZEROBYTES) <= 0) + o = PyLong_FromLongLong((long long)(crypto_secretbox_ZEROBYTES)); + else + o = PyLong_FromUnsignedLongLong((unsigned long long)(crypto_secretbox_ZEROBYTES)); + if (o == NULL) + return -1; + res = PyObject_SetAttrString(lib, "crypto_secretbox_ZEROBYTES", o); + Py_DECREF(o); + if (res < 0) + return -1; + return _cffi_const_crypto_secretbox_NONCEBYTES(lib); +} + +static int _cffi_const_crypto_sign_BYTES(PyObject *lib) +{ + PyObject *o; + int res; + if (LONG_MIN <= (crypto_sign_BYTES) && (crypto_sign_BYTES) <= LONG_MAX) + o = PyInt_FromLong((long)(crypto_sign_BYTES)); + else if ((crypto_sign_BYTES) <= 0) + o = PyLong_FromLongLong((long long)(crypto_sign_BYTES)); + else + o = PyLong_FromUnsignedLongLong((unsigned long long)(crypto_sign_BYTES)); + if (o == NULL) + return -1; + res = PyObject_SetAttrString(lib, "crypto_sign_BYTES", o); + Py_DECREF(o); + if (res < 0) + return -1; + return _cffi_const_crypto_secretbox_ZEROBYTES(lib); +} + +static int _cffi_const_crypto_sign_PUBLICKEYBYTES(PyObject *lib) +{ + PyObject *o; + int res; + if (LONG_MIN <= (crypto_sign_PUBLICKEYBYTES) && (crypto_sign_PUBLICKEYBYTES) <= LONG_MAX) + o = PyInt_FromLong((long)(crypto_sign_PUBLICKEYBYTES)); + else if ((crypto_sign_PUBLICKEYBYTES) <= 0) + o = PyLong_FromLongLong((long long)(crypto_sign_PUBLICKEYBYTES)); + else + o = PyLong_FromUnsignedLongLong((unsigned long long)(crypto_sign_PUBLICKEYBYTES)); + if (o == NULL) + return -1; + res = PyObject_SetAttrString(lib, "crypto_sign_PUBLICKEYBYTES", o); + Py_DECREF(o); + if (res < 0) + return -1; + return _cffi_const_crypto_sign_BYTES(lib); +} + +static int _cffi_const_crypto_sign_SECRETKEYBYTES(PyObject *lib) +{ + PyObject *o; + int res; + if (LONG_MIN <= (crypto_sign_SECRETKEYBYTES) && (crypto_sign_SECRETKEYBYTES) <= LONG_MAX) + o = PyInt_FromLong((long)(crypto_sign_SECRETKEYBYTES)); + else if ((crypto_sign_SECRETKEYBYTES) <= 0) + o = PyLong_FromLongLong((long long)(crypto_sign_SECRETKEYBYTES)); + else + o = PyLong_FromUnsignedLongLong((unsigned long long)(crypto_sign_SECRETKEYBYTES)); + if (o == NULL) + return -1; + res = PyObject_SetAttrString(lib, "crypto_sign_SECRETKEYBYTES", o); + Py_DECREF(o); + if (res < 0) + return -1; + return _cffi_const_crypto_sign_PUBLICKEYBYTES(lib); +} + +static int _cffi_const_crypto_stream_KEYBYTES(PyObject *lib) +{ + PyObject *o; + int res; + if (LONG_MIN <= (crypto_stream_KEYBYTES) && (crypto_stream_KEYBYTES) <= LONG_MAX) + o = PyInt_FromLong((long)(crypto_stream_KEYBYTES)); + else if ((crypto_stream_KEYBYTES) <= 0) + o = PyLong_FromLongLong((long long)(crypto_stream_KEYBYTES)); + else + o = PyLong_FromUnsignedLongLong((unsigned long long)(crypto_stream_KEYBYTES)); + if (o == NULL) + return -1; + res = PyObject_SetAttrString(lib, "crypto_stream_KEYBYTES", o); + Py_DECREF(o); + if (res < 0) + return -1; + return _cffi_const_crypto_sign_SECRETKEYBYTES(lib); +} + +static int _cffi_const_crypto_stream_NONCEBYTES(PyObject *lib) +{ + PyObject *o; + int res; + if (LONG_MIN <= (crypto_stream_NONCEBYTES) && (crypto_stream_NONCEBYTES) <= LONG_MAX) + o = PyInt_FromLong((long)(crypto_stream_NONCEBYTES)); + else if ((crypto_stream_NONCEBYTES) <= 0) + o = PyLong_FromLongLong((long long)(crypto_stream_NONCEBYTES)); + else + o = PyLong_FromUnsignedLongLong((unsigned long long)(crypto_stream_NONCEBYTES)); + if (o == NULL) + return -1; + res = PyObject_SetAttrString(lib, "crypto_stream_NONCEBYTES", o); + Py_DECREF(o); + if (res < 0) + return -1; + return _cffi_const_crypto_stream_KEYBYTES(lib); +} + +static PyObject * +_cffi_f_crypto_box(PyObject *self, PyObject *args) +{ + unsigned char * x0; + unsigned char const * x1; + unsigned long long x2; + unsigned char const * x3; + unsigned char const * x4; + unsigned char const * x5; + Py_ssize_t datasize; + int result; + PyObject *arg0; + PyObject *arg1; + PyObject *arg2; + PyObject *arg3; + PyObject *arg4; + PyObject *arg5; + + if (!PyArg_ParseTuple(args, "OOOOOO:crypto_box", &arg0, &arg1, &arg2, &arg3, &arg4, &arg5)) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(0), arg0, (char **)&x0); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x0 = alloca(datasize); + memset((void *)x0, 0, datasize); + if (_cffi_convert_array_from_object((char *)x0, _cffi_type(0), arg0) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg1, (char **)&x1); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x1 = alloca(datasize); + memset((void *)x1, 0, datasize); + if (_cffi_convert_array_from_object((char *)x1, _cffi_type(1), arg1) < 0) + return NULL; + } + + x2 = _cffi_to_c_UNSIGNED(arg2, unsigned long long); + if (x2 == (unsigned long long)-1 && PyErr_Occurred()) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg3, (char **)&x3); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x3 = alloca(datasize); + memset((void *)x3, 0, datasize); + if (_cffi_convert_array_from_object((char *)x3, _cffi_type(1), arg3) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg4, (char **)&x4); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x4 = alloca(datasize); + memset((void *)x4, 0, datasize); + if (_cffi_convert_array_from_object((char *)x4, _cffi_type(1), arg4) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg5, (char **)&x5); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x5 = alloca(datasize); + memset((void *)x5, 0, datasize); + if (_cffi_convert_array_from_object((char *)x5, _cffi_type(1), arg5) < 0) + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + _cffi_restore_errno(); + { result = crypto_box(x0, x1, x2, x3, x4, x5); } + _cffi_save_errno(); + Py_END_ALLOW_THREADS + + return _cffi_from_c_SIGNED(result, int); +} + +static PyObject * +_cffi_f_crypto_box_afternm(PyObject *self, PyObject *args) +{ + unsigned char * x0; + unsigned char const * x1; + unsigned long long x2; + unsigned char const * x3; + unsigned char const * x4; + Py_ssize_t datasize; + int result; + PyObject *arg0; + PyObject *arg1; + PyObject *arg2; + PyObject *arg3; + PyObject *arg4; + + if (!PyArg_ParseTuple(args, "OOOOO:crypto_box_afternm", &arg0, &arg1, &arg2, &arg3, &arg4)) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(0), arg0, (char **)&x0); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x0 = alloca(datasize); + memset((void *)x0, 0, datasize); + if (_cffi_convert_array_from_object((char *)x0, _cffi_type(0), arg0) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg1, (char **)&x1); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x1 = alloca(datasize); + memset((void *)x1, 0, datasize); + if (_cffi_convert_array_from_object((char *)x1, _cffi_type(1), arg1) < 0) + return NULL; + } + + x2 = _cffi_to_c_UNSIGNED(arg2, unsigned long long); + if (x2 == (unsigned long long)-1 && PyErr_Occurred()) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg3, (char **)&x3); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x3 = alloca(datasize); + memset((void *)x3, 0, datasize); + if (_cffi_convert_array_from_object((char *)x3, _cffi_type(1), arg3) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg4, (char **)&x4); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x4 = alloca(datasize); + memset((void *)x4, 0, datasize); + if (_cffi_convert_array_from_object((char *)x4, _cffi_type(1), arg4) < 0) + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + _cffi_restore_errno(); + { result = crypto_box_afternm(x0, x1, x2, x3, x4); } + _cffi_save_errno(); + Py_END_ALLOW_THREADS + + return _cffi_from_c_SIGNED(result, int); +} + +static PyObject * +_cffi_f_crypto_box_beforenm(PyObject *self, PyObject *args) +{ + unsigned char * x0; + unsigned char const * x1; + unsigned char const * x2; + Py_ssize_t datasize; + int result; + PyObject *arg0; + PyObject *arg1; + PyObject *arg2; + + if (!PyArg_ParseTuple(args, "OOO:crypto_box_beforenm", &arg0, &arg1, &arg2)) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(0), arg0, (char **)&x0); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x0 = alloca(datasize); + memset((void *)x0, 0, datasize); + if (_cffi_convert_array_from_object((char *)x0, _cffi_type(0), arg0) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg1, (char **)&x1); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x1 = alloca(datasize); + memset((void *)x1, 0, datasize); + if (_cffi_convert_array_from_object((char *)x1, _cffi_type(1), arg1) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg2, (char **)&x2); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x2 = alloca(datasize); + memset((void *)x2, 0, datasize); + if (_cffi_convert_array_from_object((char *)x2, _cffi_type(1), arg2) < 0) + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + _cffi_restore_errno(); + { result = crypto_box_beforenm(x0, x1, x2); } + _cffi_save_errno(); + Py_END_ALLOW_THREADS + + return _cffi_from_c_SIGNED(result, int); +} + +static PyObject * +_cffi_f_crypto_box_keypair(PyObject *self, PyObject *args) +{ + unsigned char * x0; + unsigned char * x1; + Py_ssize_t datasize; + int result; + PyObject *arg0; + PyObject *arg1; + + if (!PyArg_ParseTuple(args, "OO:crypto_box_keypair", &arg0, &arg1)) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(0), arg0, (char **)&x0); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x0 = alloca(datasize); + memset((void *)x0, 0, datasize); + if (_cffi_convert_array_from_object((char *)x0, _cffi_type(0), arg0) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(0), arg1, (char **)&x1); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x1 = alloca(datasize); + memset((void *)x1, 0, datasize); + if (_cffi_convert_array_from_object((char *)x1, _cffi_type(0), arg1) < 0) + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + _cffi_restore_errno(); + { result = crypto_box_keypair(x0, x1); } + _cffi_save_errno(); + Py_END_ALLOW_THREADS + + return _cffi_from_c_SIGNED(result, int); +} + +static PyObject * +_cffi_f_crypto_box_open(PyObject *self, PyObject *args) +{ + unsigned char * x0; + unsigned char const * x1; + unsigned long long x2; + unsigned char const * x3; + unsigned char const * x4; + unsigned char const * x5; + Py_ssize_t datasize; + int result; + PyObject *arg0; + PyObject *arg1; + PyObject *arg2; + PyObject *arg3; + PyObject *arg4; + PyObject *arg5; + + if (!PyArg_ParseTuple(args, "OOOOOO:crypto_box_open", &arg0, &arg1, &arg2, &arg3, &arg4, &arg5)) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(0), arg0, (char **)&x0); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x0 = alloca(datasize); + memset((void *)x0, 0, datasize); + if (_cffi_convert_array_from_object((char *)x0, _cffi_type(0), arg0) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg1, (char **)&x1); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x1 = alloca(datasize); + memset((void *)x1, 0, datasize); + if (_cffi_convert_array_from_object((char *)x1, _cffi_type(1), arg1) < 0) + return NULL; + } + + x2 = _cffi_to_c_UNSIGNED(arg2, unsigned long long); + if (x2 == (unsigned long long)-1 && PyErr_Occurred()) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg3, (char **)&x3); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x3 = alloca(datasize); + memset((void *)x3, 0, datasize); + if (_cffi_convert_array_from_object((char *)x3, _cffi_type(1), arg3) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg4, (char **)&x4); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x4 = alloca(datasize); + memset((void *)x4, 0, datasize); + if (_cffi_convert_array_from_object((char *)x4, _cffi_type(1), arg4) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg5, (char **)&x5); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x5 = alloca(datasize); + memset((void *)x5, 0, datasize); + if (_cffi_convert_array_from_object((char *)x5, _cffi_type(1), arg5) < 0) + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + _cffi_restore_errno(); + { result = crypto_box_open(x0, x1, x2, x3, x4, x5); } + _cffi_save_errno(); + Py_END_ALLOW_THREADS + + return _cffi_from_c_SIGNED(result, int); +} + +static PyObject * +_cffi_f_crypto_box_open_afternm(PyObject *self, PyObject *args) +{ + unsigned char * x0; + unsigned char const * x1; + unsigned long long x2; + unsigned char const * x3; + unsigned char const * x4; + Py_ssize_t datasize; + int result; + PyObject *arg0; + PyObject *arg1; + PyObject *arg2; + PyObject *arg3; + PyObject *arg4; + + if (!PyArg_ParseTuple(args, "OOOOO:crypto_box_open_afternm", &arg0, &arg1, &arg2, &arg3, &arg4)) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(0), arg0, (char **)&x0); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x0 = alloca(datasize); + memset((void *)x0, 0, datasize); + if (_cffi_convert_array_from_object((char *)x0, _cffi_type(0), arg0) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg1, (char **)&x1); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x1 = alloca(datasize); + memset((void *)x1, 0, datasize); + if (_cffi_convert_array_from_object((char *)x1, _cffi_type(1), arg1) < 0) + return NULL; + } + + x2 = _cffi_to_c_UNSIGNED(arg2, unsigned long long); + if (x2 == (unsigned long long)-1 && PyErr_Occurred()) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg3, (char **)&x3); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x3 = alloca(datasize); + memset((void *)x3, 0, datasize); + if (_cffi_convert_array_from_object((char *)x3, _cffi_type(1), arg3) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg4, (char **)&x4); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x4 = alloca(datasize); + memset((void *)x4, 0, datasize); + if (_cffi_convert_array_from_object((char *)x4, _cffi_type(1), arg4) < 0) + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + _cffi_restore_errno(); + { result = crypto_box_open_afternm(x0, x1, x2, x3, x4); } + _cffi_save_errno(); + Py_END_ALLOW_THREADS + + return _cffi_from_c_SIGNED(result, int); +} + +static PyObject * +_cffi_f_crypto_generichash(PyObject *self, PyObject *args) +{ + unsigned char * x0; + size_t x1; + unsigned char const * x2; + unsigned long long x3; + unsigned char const * x4; + size_t x5; + Py_ssize_t datasize; + int result; + PyObject *arg0; + PyObject *arg1; + PyObject *arg2; + PyObject *arg3; + PyObject *arg4; + PyObject *arg5; + + if (!PyArg_ParseTuple(args, "OOOOOO:crypto_generichash", &arg0, &arg1, &arg2, &arg3, &arg4, &arg5)) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(0), arg0, (char **)&x0); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x0 = alloca(datasize); + memset((void *)x0, 0, datasize); + if (_cffi_convert_array_from_object((char *)x0, _cffi_type(0), arg0) < 0) + return NULL; + } + + x1 = _cffi_to_c_UNSIGNED(arg1, size_t); + if (x1 == (size_t)-1 && PyErr_Occurred()) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg2, (char **)&x2); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x2 = alloca(datasize); + memset((void *)x2, 0, datasize); + if (_cffi_convert_array_from_object((char *)x2, _cffi_type(1), arg2) < 0) + return NULL; + } + + x3 = _cffi_to_c_UNSIGNED(arg3, unsigned long long); + if (x3 == (unsigned long long)-1 && PyErr_Occurred()) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg4, (char **)&x4); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x4 = alloca(datasize); + memset((void *)x4, 0, datasize); + if (_cffi_convert_array_from_object((char *)x4, _cffi_type(1), arg4) < 0) + return NULL; + } + + x5 = _cffi_to_c_UNSIGNED(arg5, size_t); + if (x5 == (size_t)-1 && PyErr_Occurred()) + return NULL; + + Py_BEGIN_ALLOW_THREADS + _cffi_restore_errno(); + { result = crypto_generichash(x0, x1, x2, x3, x4, x5); } + _cffi_save_errno(); + Py_END_ALLOW_THREADS + + return _cffi_from_c_SIGNED(result, int); +} + +static PyObject * +_cffi_f_crypto_generichash_final(PyObject *self, PyObject *args) +{ + crypto_generichash_state * x0; + unsigned char * x1; + size_t x2; + Py_ssize_t datasize; + int result; + PyObject *arg0; + PyObject *arg1; + PyObject *arg2; + + if (!PyArg_ParseTuple(args, "OOO:crypto_generichash_final", &arg0, &arg1, &arg2)) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(2), arg0, (char **)&x0); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x0 = alloca(datasize); + memset((void *)x0, 0, datasize); + if (_cffi_convert_array_from_object((char *)x0, _cffi_type(2), arg0) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(0), arg1, (char **)&x1); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x1 = alloca(datasize); + memset((void *)x1, 0, datasize); + if (_cffi_convert_array_from_object((char *)x1, _cffi_type(0), arg1) < 0) + return NULL; + } + + x2 = _cffi_to_c_UNSIGNED(arg2, size_t); + if (x2 == (size_t)-1 && PyErr_Occurred()) + return NULL; + + Py_BEGIN_ALLOW_THREADS + _cffi_restore_errno(); + { result = crypto_generichash_final(x0, x1, x2); } + _cffi_save_errno(); + Py_END_ALLOW_THREADS + + return _cffi_from_c_SIGNED(result, int); +} + +static PyObject * +_cffi_f_crypto_generichash_init(PyObject *self, PyObject *args) +{ + crypto_generichash_state * x0; + unsigned char const * x1; + size_t x2; + size_t x3; + Py_ssize_t datasize; + int result; + PyObject *arg0; + PyObject *arg1; + PyObject *arg2; + PyObject *arg3; + + if (!PyArg_ParseTuple(args, "OOOO:crypto_generichash_init", &arg0, &arg1, &arg2, &arg3)) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(2), arg0, (char **)&x0); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x0 = alloca(datasize); + memset((void *)x0, 0, datasize); + if (_cffi_convert_array_from_object((char *)x0, _cffi_type(2), arg0) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg1, (char **)&x1); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x1 = alloca(datasize); + memset((void *)x1, 0, datasize); + if (_cffi_convert_array_from_object((char *)x1, _cffi_type(1), arg1) < 0) + return NULL; + } + + x2 = _cffi_to_c_UNSIGNED(arg2, size_t); + if (x2 == (size_t)-1 && PyErr_Occurred()) + return NULL; + + x3 = _cffi_to_c_UNSIGNED(arg3, size_t); + if (x3 == (size_t)-1 && PyErr_Occurred()) + return NULL; + + Py_BEGIN_ALLOW_THREADS + _cffi_restore_errno(); + { result = crypto_generichash_init(x0, x1, x2, x3); } + _cffi_save_errno(); + Py_END_ALLOW_THREADS + + return _cffi_from_c_SIGNED(result, int); +} + +static PyObject * +_cffi_f_crypto_generichash_update(PyObject *self, PyObject *args) +{ + crypto_generichash_state * x0; + unsigned char const * x1; + unsigned long long x2; + Py_ssize_t datasize; + int result; + PyObject *arg0; + PyObject *arg1; + PyObject *arg2; + + if (!PyArg_ParseTuple(args, "OOO:crypto_generichash_update", &arg0, &arg1, &arg2)) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(2), arg0, (char **)&x0); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x0 = alloca(datasize); + memset((void *)x0, 0, datasize); + if (_cffi_convert_array_from_object((char *)x0, _cffi_type(2), arg0) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg1, (char **)&x1); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x1 = alloca(datasize); + memset((void *)x1, 0, datasize); + if (_cffi_convert_array_from_object((char *)x1, _cffi_type(1), arg1) < 0) + return NULL; + } + + x2 = _cffi_to_c_UNSIGNED(arg2, unsigned long long); + if (x2 == (unsigned long long)-1 && PyErr_Occurred()) + return NULL; + + Py_BEGIN_ALLOW_THREADS + _cffi_restore_errno(); + { result = crypto_generichash_update(x0, x1, x2); } + _cffi_save_errno(); + Py_END_ALLOW_THREADS + + return _cffi_from_c_SIGNED(result, int); +} + +static PyObject * +_cffi_f_crypto_scalarmult_curve25519(PyObject *self, PyObject *args) +{ + unsigned char * x0; + unsigned char const * x1; + unsigned char * x2; + Py_ssize_t datasize; + int result; + PyObject *arg0; + PyObject *arg1; + PyObject *arg2; + + if (!PyArg_ParseTuple(args, "OOO:crypto_scalarmult_curve25519", &arg0, &arg1, &arg2)) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(0), arg0, (char **)&x0); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x0 = alloca(datasize); + memset((void *)x0, 0, datasize); + if (_cffi_convert_array_from_object((char *)x0, _cffi_type(0), arg0) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg1, (char **)&x1); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x1 = alloca(datasize); + memset((void *)x1, 0, datasize); + if (_cffi_convert_array_from_object((char *)x1, _cffi_type(1), arg1) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(0), arg2, (char **)&x2); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x2 = alloca(datasize); + memset((void *)x2, 0, datasize); + if (_cffi_convert_array_from_object((char *)x2, _cffi_type(0), arg2) < 0) + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + _cffi_restore_errno(); + { result = crypto_scalarmult_curve25519(x0, x1, x2); } + _cffi_save_errno(); + Py_END_ALLOW_THREADS + + return _cffi_from_c_SIGNED(result, int); +} + +static PyObject * +_cffi_f_crypto_scalarmult_curve25519_base(PyObject *self, PyObject *args) +{ + unsigned char * x0; + unsigned char const * x1; + Py_ssize_t datasize; + int result; + PyObject *arg0; + PyObject *arg1; + + if (!PyArg_ParseTuple(args, "OO:crypto_scalarmult_curve25519_base", &arg0, &arg1)) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(0), arg0, (char **)&x0); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x0 = alloca(datasize); + memset((void *)x0, 0, datasize); + if (_cffi_convert_array_from_object((char *)x0, _cffi_type(0), arg0) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg1, (char **)&x1); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x1 = alloca(datasize); + memset((void *)x1, 0, datasize); + if (_cffi_convert_array_from_object((char *)x1, _cffi_type(1), arg1) < 0) + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + _cffi_restore_errno(); + { result = crypto_scalarmult_curve25519_base(x0, x1); } + _cffi_save_errno(); + Py_END_ALLOW_THREADS + + return _cffi_from_c_SIGNED(result, int); +} + +static PyObject * +_cffi_f_crypto_secretbox(PyObject *self, PyObject *args) +{ + unsigned char * x0; + unsigned char const * x1; + unsigned long long x2; + unsigned char const * x3; + unsigned char const * x4; + Py_ssize_t datasize; + int result; + PyObject *arg0; + PyObject *arg1; + PyObject *arg2; + PyObject *arg3; + PyObject *arg4; + + if (!PyArg_ParseTuple(args, "OOOOO:crypto_secretbox", &arg0, &arg1, &arg2, &arg3, &arg4)) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(0), arg0, (char **)&x0); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x0 = alloca(datasize); + memset((void *)x0, 0, datasize); + if (_cffi_convert_array_from_object((char *)x0, _cffi_type(0), arg0) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg1, (char **)&x1); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x1 = alloca(datasize); + memset((void *)x1, 0, datasize); + if (_cffi_convert_array_from_object((char *)x1, _cffi_type(1), arg1) < 0) + return NULL; + } + + x2 = _cffi_to_c_UNSIGNED(arg2, unsigned long long); + if (x2 == (unsigned long long)-1 && PyErr_Occurred()) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg3, (char **)&x3); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x3 = alloca(datasize); + memset((void *)x3, 0, datasize); + if (_cffi_convert_array_from_object((char *)x3, _cffi_type(1), arg3) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg4, (char **)&x4); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x4 = alloca(datasize); + memset((void *)x4, 0, datasize); + if (_cffi_convert_array_from_object((char *)x4, _cffi_type(1), arg4) < 0) + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + _cffi_restore_errno(); + { result = crypto_secretbox(x0, x1, x2, x3, x4); } + _cffi_save_errno(); + Py_END_ALLOW_THREADS + + return _cffi_from_c_SIGNED(result, int); +} + +static PyObject * +_cffi_f_crypto_secretbox_open(PyObject *self, PyObject *args) +{ + unsigned char * x0; + unsigned char const * x1; + unsigned long long x2; + unsigned char const * x3; + unsigned char const * x4; + Py_ssize_t datasize; + int result; + PyObject *arg0; + PyObject *arg1; + PyObject *arg2; + PyObject *arg3; + PyObject *arg4; + + if (!PyArg_ParseTuple(args, "OOOOO:crypto_secretbox_open", &arg0, &arg1, &arg2, &arg3, &arg4)) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(0), arg0, (char **)&x0); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x0 = alloca(datasize); + memset((void *)x0, 0, datasize); + if (_cffi_convert_array_from_object((char *)x0, _cffi_type(0), arg0) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg1, (char **)&x1); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x1 = alloca(datasize); + memset((void *)x1, 0, datasize); + if (_cffi_convert_array_from_object((char *)x1, _cffi_type(1), arg1) < 0) + return NULL; + } + + x2 = _cffi_to_c_UNSIGNED(arg2, unsigned long long); + if (x2 == (unsigned long long)-1 && PyErr_Occurred()) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg3, (char **)&x3); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x3 = alloca(datasize); + memset((void *)x3, 0, datasize); + if (_cffi_convert_array_from_object((char *)x3, _cffi_type(1), arg3) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg4, (char **)&x4); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x4 = alloca(datasize); + memset((void *)x4, 0, datasize); + if (_cffi_convert_array_from_object((char *)x4, _cffi_type(1), arg4) < 0) + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + _cffi_restore_errno(); + { result = crypto_secretbox_open(x0, x1, x2, x3, x4); } + _cffi_save_errno(); + Py_END_ALLOW_THREADS + + return _cffi_from_c_SIGNED(result, int); +} + +static PyObject * +_cffi_f_crypto_sign(PyObject *self, PyObject *args) +{ + unsigned char * x0; + unsigned long long * x1; + unsigned char const * x2; + unsigned long long x3; + unsigned char const * x4; + Py_ssize_t datasize; + int result; + PyObject *arg0; + PyObject *arg1; + PyObject *arg2; + PyObject *arg3; + PyObject *arg4; + + if (!PyArg_ParseTuple(args, "OOOOO:crypto_sign", &arg0, &arg1, &arg2, &arg3, &arg4)) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(0), arg0, (char **)&x0); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x0 = alloca(datasize); + memset((void *)x0, 0, datasize); + if (_cffi_convert_array_from_object((char *)x0, _cffi_type(0), arg0) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(3), arg1, (char **)&x1); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x1 = alloca(datasize); + memset((void *)x1, 0, datasize); + if (_cffi_convert_array_from_object((char *)x1, _cffi_type(3), arg1) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg2, (char **)&x2); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x2 = alloca(datasize); + memset((void *)x2, 0, datasize); + if (_cffi_convert_array_from_object((char *)x2, _cffi_type(1), arg2) < 0) + return NULL; + } + + x3 = _cffi_to_c_UNSIGNED(arg3, unsigned long long); + if (x3 == (unsigned long long)-1 && PyErr_Occurred()) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg4, (char **)&x4); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x4 = alloca(datasize); + memset((void *)x4, 0, datasize); + if (_cffi_convert_array_from_object((char *)x4, _cffi_type(1), arg4) < 0) + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + _cffi_restore_errno(); + { result = crypto_sign(x0, x1, x2, x3, x4); } + _cffi_save_errno(); + Py_END_ALLOW_THREADS + + return _cffi_from_c_SIGNED(result, int); +} + +static PyObject * +_cffi_f_crypto_sign_keypair(PyObject *self, PyObject *args) +{ + unsigned char * x0; + unsigned char * x1; + Py_ssize_t datasize; + int result; + PyObject *arg0; + PyObject *arg1; + + if (!PyArg_ParseTuple(args, "OO:crypto_sign_keypair", &arg0, &arg1)) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(0), arg0, (char **)&x0); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x0 = alloca(datasize); + memset((void *)x0, 0, datasize); + if (_cffi_convert_array_from_object((char *)x0, _cffi_type(0), arg0) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(0), arg1, (char **)&x1); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x1 = alloca(datasize); + memset((void *)x1, 0, datasize); + if (_cffi_convert_array_from_object((char *)x1, _cffi_type(0), arg1) < 0) + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + _cffi_restore_errno(); + { result = crypto_sign_keypair(x0, x1); } + _cffi_save_errno(); + Py_END_ALLOW_THREADS + + return _cffi_from_c_SIGNED(result, int); +} + +static PyObject * +_cffi_f_crypto_sign_open(PyObject *self, PyObject *args) +{ + unsigned char * x0; + unsigned long long * x1; + unsigned char const * x2; + unsigned long long x3; + unsigned char const * x4; + Py_ssize_t datasize; + int result; + PyObject *arg0; + PyObject *arg1; + PyObject *arg2; + PyObject *arg3; + PyObject *arg4; + + if (!PyArg_ParseTuple(args, "OOOOO:crypto_sign_open", &arg0, &arg1, &arg2, &arg3, &arg4)) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(0), arg0, (char **)&x0); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x0 = alloca(datasize); + memset((void *)x0, 0, datasize); + if (_cffi_convert_array_from_object((char *)x0, _cffi_type(0), arg0) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(3), arg1, (char **)&x1); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x1 = alloca(datasize); + memset((void *)x1, 0, datasize); + if (_cffi_convert_array_from_object((char *)x1, _cffi_type(3), arg1) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg2, (char **)&x2); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x2 = alloca(datasize); + memset((void *)x2, 0, datasize); + if (_cffi_convert_array_from_object((char *)x2, _cffi_type(1), arg2) < 0) + return NULL; + } + + x3 = _cffi_to_c_UNSIGNED(arg3, unsigned long long); + if (x3 == (unsigned long long)-1 && PyErr_Occurred()) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg4, (char **)&x4); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x4 = alloca(datasize); + memset((void *)x4, 0, datasize); + if (_cffi_convert_array_from_object((char *)x4, _cffi_type(1), arg4) < 0) + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + _cffi_restore_errno(); + { result = crypto_sign_open(x0, x1, x2, x3, x4); } + _cffi_save_errno(); + Py_END_ALLOW_THREADS + + return _cffi_from_c_SIGNED(result, int); +} + +static PyObject * +_cffi_f_crypto_sign_seed_keypair(PyObject *self, PyObject *args) +{ + unsigned char * x0; + unsigned char * x1; + unsigned char * x2; + Py_ssize_t datasize; + int result; + PyObject *arg0; + PyObject *arg1; + PyObject *arg2; + + if (!PyArg_ParseTuple(args, "OOO:crypto_sign_seed_keypair", &arg0, &arg1, &arg2)) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(0), arg0, (char **)&x0); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x0 = alloca(datasize); + memset((void *)x0, 0, datasize); + if (_cffi_convert_array_from_object((char *)x0, _cffi_type(0), arg0) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(0), arg1, (char **)&x1); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x1 = alloca(datasize); + memset((void *)x1, 0, datasize); + if (_cffi_convert_array_from_object((char *)x1, _cffi_type(0), arg1) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(0), arg2, (char **)&x2); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x2 = alloca(datasize); + memset((void *)x2, 0, datasize); + if (_cffi_convert_array_from_object((char *)x2, _cffi_type(0), arg2) < 0) + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + _cffi_restore_errno(); + { result = crypto_sign_seed_keypair(x0, x1, x2); } + _cffi_save_errno(); + Py_END_ALLOW_THREADS + + return _cffi_from_c_SIGNED(result, int); +} + +static PyObject * +_cffi_f_crypto_stream(PyObject *self, PyObject *args) +{ + unsigned char * x0; + unsigned long long x1; + unsigned char const * x2; + unsigned char const * x3; + Py_ssize_t datasize; + int result; + PyObject *arg0; + PyObject *arg1; + PyObject *arg2; + PyObject *arg3; + + if (!PyArg_ParseTuple(args, "OOOO:crypto_stream", &arg0, &arg1, &arg2, &arg3)) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(0), arg0, (char **)&x0); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x0 = alloca(datasize); + memset((void *)x0, 0, datasize); + if (_cffi_convert_array_from_object((char *)x0, _cffi_type(0), arg0) < 0) + return NULL; + } + + x1 = _cffi_to_c_UNSIGNED(arg1, unsigned long long); + if (x1 == (unsigned long long)-1 && PyErr_Occurred()) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg2, (char **)&x2); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x2 = alloca(datasize); + memset((void *)x2, 0, datasize); + if (_cffi_convert_array_from_object((char *)x2, _cffi_type(1), arg2) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg3, (char **)&x3); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x3 = alloca(datasize); + memset((void *)x3, 0, datasize); + if (_cffi_convert_array_from_object((char *)x3, _cffi_type(1), arg3) < 0) + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + _cffi_restore_errno(); + { result = crypto_stream(x0, x1, x2, x3); } + _cffi_save_errno(); + Py_END_ALLOW_THREADS + + return _cffi_from_c_SIGNED(result, int); +} + +static PyObject * +_cffi_f_crypto_stream_xor(PyObject *self, PyObject *args) +{ + unsigned char * x0; + unsigned char * x1; + unsigned long long x2; + unsigned char const * x3; + unsigned char const * x4; + Py_ssize_t datasize; + int result; + PyObject *arg0; + PyObject *arg1; + PyObject *arg2; + PyObject *arg3; + PyObject *arg4; + + if (!PyArg_ParseTuple(args, "OOOOO:crypto_stream_xor", &arg0, &arg1, &arg2, &arg3, &arg4)) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(0), arg0, (char **)&x0); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x0 = alloca(datasize); + memset((void *)x0, 0, datasize); + if (_cffi_convert_array_from_object((char *)x0, _cffi_type(0), arg0) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(0), arg1, (char **)&x1); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x1 = alloca(datasize); + memset((void *)x1, 0, datasize); + if (_cffi_convert_array_from_object((char *)x1, _cffi_type(0), arg1) < 0) + return NULL; + } + + x2 = _cffi_to_c_UNSIGNED(arg2, unsigned long long); + if (x2 == (unsigned long long)-1 && PyErr_Occurred()) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg3, (char **)&x3); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x3 = alloca(datasize); + memset((void *)x3, 0, datasize); + if (_cffi_convert_array_from_object((char *)x3, _cffi_type(1), arg3) < 0) + return NULL; + } + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(1), arg4, (char **)&x4); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x4 = alloca(datasize); + memset((void *)x4, 0, datasize); + if (_cffi_convert_array_from_object((char *)x4, _cffi_type(1), arg4) < 0) + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + _cffi_restore_errno(); + { result = crypto_stream_xor(x0, x1, x2, x3, x4); } + _cffi_save_errno(); + Py_END_ALLOW_THREADS + + return _cffi_from_c_SIGNED(result, int); +} + +static PyObject * +_cffi_f_randombytes(PyObject *self, PyObject *args) +{ + unsigned char * x0; + unsigned long long x1; + Py_ssize_t datasize; + PyObject *arg0; + PyObject *arg1; + + if (!PyArg_ParseTuple(args, "OO:randombytes", &arg0, &arg1)) + return NULL; + + datasize = _cffi_prepare_pointer_call_argument( + _cffi_type(0), arg0, (char **)&x0); + if (datasize != 0) { + if (datasize < 0) + return NULL; + x0 = alloca(datasize); + memset((void *)x0, 0, datasize); + if (_cffi_convert_array_from_object((char *)x0, _cffi_type(0), arg0) < 0) + return NULL; + } + + x1 = _cffi_to_c_UNSIGNED(arg1, unsigned long long); + if (x1 == (unsigned long long)-1 && PyErr_Occurred()) + return NULL; + + Py_BEGIN_ALLOW_THREADS + _cffi_restore_errno(); + { randombytes(x0, x1); } + _cffi_save_errno(); + Py_END_ALLOW_THREADS + + Py_INCREF(Py_None); + return Py_None; +} + +static void _cffi_check_struct_crypto_generichash_blake2b_state(struct crypto_generichash_blake2b_state *p) +{ + /* only to generate compile-time warnings or errors */ + { uint64_t(*tmp)[8] = &p->h; (void)tmp; } + { uint64_t(*tmp)[2] = &p->t; (void)tmp; } + { uint64_t(*tmp)[2] = &p->f; (void)tmp; } + { uint8_t(*tmp)[256] = &p->buf; (void)tmp; } + (void)((p->buflen) << 1); + (void)((p->last_node) << 1); +} +static PyObject * +_cffi_layout_struct_crypto_generichash_blake2b_state(PyObject *self, PyObject *noarg) +{ + struct _cffi_aligncheck { char x; struct crypto_generichash_blake2b_state y; }; + static Py_ssize_t nums[] = { + sizeof(struct crypto_generichash_blake2b_state), + offsetof(struct _cffi_aligncheck, y), + offsetof(struct crypto_generichash_blake2b_state, h), + sizeof(((struct crypto_generichash_blake2b_state *)0)->h), + offsetof(struct crypto_generichash_blake2b_state, t), + sizeof(((struct crypto_generichash_blake2b_state *)0)->t), + offsetof(struct crypto_generichash_blake2b_state, f), + sizeof(((struct crypto_generichash_blake2b_state *)0)->f), + offsetof(struct crypto_generichash_blake2b_state, buf), + sizeof(((struct crypto_generichash_blake2b_state *)0)->buf), + offsetof(struct crypto_generichash_blake2b_state, buflen), + sizeof(((struct crypto_generichash_blake2b_state *)0)->buflen), + offsetof(struct crypto_generichash_blake2b_state, last_node), + sizeof(((struct crypto_generichash_blake2b_state *)0)->last_node), + -1 + }; + return _cffi_get_struct_layout(nums); + /* the next line is not executed, but compiled */ + _cffi_check_struct_crypto_generichash_blake2b_state(0); +} + +static int _cffi_setup_custom(PyObject *lib) +{ + return _cffi_const_crypto_stream_NONCEBYTES(lib); +} + +static PyMethodDef _cffi_methods[] = { + {"crypto_box", _cffi_f_crypto_box, METH_VARARGS}, + {"crypto_box_afternm", _cffi_f_crypto_box_afternm, METH_VARARGS}, + {"crypto_box_beforenm", _cffi_f_crypto_box_beforenm, METH_VARARGS}, + {"crypto_box_keypair", _cffi_f_crypto_box_keypair, METH_VARARGS}, + {"crypto_box_open", _cffi_f_crypto_box_open, METH_VARARGS}, + {"crypto_box_open_afternm", _cffi_f_crypto_box_open_afternm, METH_VARARGS}, + {"crypto_generichash", _cffi_f_crypto_generichash, METH_VARARGS}, + {"crypto_generichash_final", _cffi_f_crypto_generichash_final, METH_VARARGS}, + {"crypto_generichash_init", _cffi_f_crypto_generichash_init, METH_VARARGS}, + {"crypto_generichash_update", _cffi_f_crypto_generichash_update, METH_VARARGS}, + {"crypto_scalarmult_curve25519", _cffi_f_crypto_scalarmult_curve25519, METH_VARARGS}, + {"crypto_scalarmult_curve25519_base", _cffi_f_crypto_scalarmult_curve25519_base, METH_VARARGS}, + {"crypto_secretbox", _cffi_f_crypto_secretbox, METH_VARARGS}, + {"crypto_secretbox_open", _cffi_f_crypto_secretbox_open, METH_VARARGS}, + {"crypto_sign", _cffi_f_crypto_sign, METH_VARARGS}, + {"crypto_sign_keypair", _cffi_f_crypto_sign_keypair, METH_VARARGS}, + {"crypto_sign_open", _cffi_f_crypto_sign_open, METH_VARARGS}, + {"crypto_sign_seed_keypair", _cffi_f_crypto_sign_seed_keypair, METH_VARARGS}, + {"crypto_stream", _cffi_f_crypto_stream, METH_VARARGS}, + {"crypto_stream_xor", _cffi_f_crypto_stream_xor, METH_VARARGS}, + {"randombytes", _cffi_f_randombytes, METH_VARARGS}, + {"_cffi_layout_struct_crypto_generichash_blake2b_state", _cffi_layout_struct_crypto_generichash_blake2b_state, METH_NOARGS}, + {"_cffi_setup", _cffi_setup, METH_VARARGS}, + {NULL, NULL} /* Sentinel */ +}; + +PyMODINIT_FUNC +init_cffi__x6f20fc6x6947e85f(void) +{ + PyObject *lib; + lib = Py_InitModule("_cffi__x6f20fc6x6947e85f", _cffi_methods); + if (lib == NULL || 0 < 0) + return; + _cffi_init(); + return; +} diff --git a/tests/env/share/build/bdist.freebsd-9.0-RELEASE-p3-amd64/egg/pysodium/__pycache__/_cffi__x6f20fc6x6947e85f.so b/tests/env/share/build/bdist.freebsd-9.0-RELEASE-p3-amd64/egg/pysodium/__pycache__/_cffi__x6f20fc6x6947e85f.so new file mode 100755 index 0000000..cf908c7 Binary files /dev/null and b/tests/env/share/build/bdist.freebsd-9.0-RELEASE-p3-amd64/egg/pysodium/__pycache__/_cffi__x6f20fc6x6947e85f.so differ diff --git a/tests/env/share/build/bdist.freebsd-9.0-RELEASE-p3-amd64/egg/pysodium/__pycache__/build/bdist.freebsd-9.0-RELEASE-p3-amd64/egg/pysodium/__pycache__/_cffi__x6f20fc6x6947e85f.o b/tests/env/share/build/bdist.freebsd-9.0-RELEASE-p3-amd64/egg/pysodium/__pycache__/build/bdist.freebsd-9.0-RELEASE-p3-amd64/egg/pysodium/__pycache__/_cffi__x6f20fc6x6947e85f.o new file mode 100644 index 0000000..6e36823 Binary files /dev/null and b/tests/env/share/build/bdist.freebsd-9.0-RELEASE-p3-amd64/egg/pysodium/__pycache__/build/bdist.freebsd-9.0-RELEASE-p3-amd64/egg/pysodium/__pycache__/_cffi__x6f20fc6x6947e85f.o differ diff --git a/tests/env/share/encrypted b/tests/env/share/encrypted new file mode 100644 index 0000000..bb532ff Binary files /dev/null and b/tests/env/share/encrypted differ diff --git a/tests/env/share/msg b/tests/env/share/msg new file mode 100644 index 0000000..6766b23 --- /dev/null +++ b/tests/env/share/msg @@ -0,0 +1 @@ +HALLO ALICE, KNUTSCHI diff --git a/tests/gentestkeys.sh b/tests/gentestkeys.sh index 6a29c19..923ec1c 100755 --- a/tests/gentestkeys.sh +++ b/tests/gentestkeys.sh @@ -44,7 +44,7 @@ ser=`grep Serial bart.pub | awk '{print $3}'` gen Niemand niemand@local n y unknown1 unknown2 $pcp1 -V unknown3 -l -echo hallo | $pcp -e -x a | egrep -v "^ " | egrep -v -- "----" | grep . > unknown4 +echo hallo | $pcp -e -x a -z | egrep -v "^ " | egrep -v -- "----" | grep . > unknown4 echo blah | $pcp -g -x a | egrep -v "^ " | egrep -v -- "----" | grep . > unknown5 echo "bartid = $ids diff --git a/tests/key-alicia-pub b/tests/key-alicia-pub index 2aa75b8..e49c953 100644 --- a/tests/key-alicia-pub +++ b/tests/key-alicia-pub @@ -1,35 +1,35 @@ ----- BEGIN PCP PUBLIC KEY ----- - Generated by: Pretty Curved Privacy Version 0.1.5 + Generated by: Pretty Curved Privacy Version 0.2.1 Cipher: CURVE25519-ED25519-SALSA20-POLY1305 Owner: Alicia Mail: alicia@local - Key-ID: 0x7A96E7F11E3A92FC - Public-Key: 1n[zBNEfpry!7cdZ.k&Pv6[iPY=n94&{yiWjsb8Vg5}pO - Creation Time: 2014-01-19T19:23:31 - Checksum: AD:C5:D4:D0:ED:4A:74:B3:C5:0D:3F:A3:F1:7F:41:38 - 07:FE:91:41:D0:43:29:89:E6:23:42:9D:FD:3F:E0:0B - Serial Number: 0xCCFEA718 + Key-ID: 0x82BE660E56313C52 + Public-Key: q0W]YxirTdE=?ii@{0![FQdK%A+>?P+iClzgO -<.SQvl%)J?Q2e1re#c}=S$5d+fWWaSH=q{6GZ1RO}4Hctjh1!2FCHPJ<&C/K5{OUI6q6mFf -0EGB:2Ga5fG[y^]7+!cTG9SX:AWy326yHW>Dn?U0(C:y$VPS8Da=&mMR?g#009J7GM/D*3M -O>zfA2hXl1E-40VfMaKi@Z{x[@?Yjd)e[GEfWH{L!G.9YNmLi=Gxrpf@DqWT(@72t?EH+A1 -xL354SJYBI255Srl.e@r*6[2v]4)p:7NQNyd&Ne/#l>O -pWn5D0HM&LLtadF#m2ohYM4QvHu/3oKBRPbv/W>Pc@7uiqgtV&vry9yj!O(V=r(>02Hb7 -0m=jGmNwwn]8H.V+LOqg.SJNHxy4tJuP>I^u0]q:m +@[2LIusbbJ?gf7@AQ2mw{#Gkds1j^ZO8y07BNsW:Zp#E4?Uj{xUBkj5y(j*e]v&BazdPD-c +FC!R?QG(%[7jCVV*6UWCyqqE?WY>CJcsZ0jc5Bmgoy?.JWC>HEn.o[>ypFA5uxl>tKSOpO* +uCi/rSty?Wx[vl!TEv{%fNcjpS#us)?2V +A!0dE$/PJ6St)QRnr34OI-+7XBAb&eTc^L01Gmh12*z(=}:94Kd!M}Sx#j&cfm6:lnABwXx +Znf3*9#}0ISXRF3%Sj]=t9xh-J2[U[Ez2]#uz5y@^h0@A!&R3&yD?{tfL=zhMdXXau +RgJ{NC(LY^GSX&6&kY)k%vuTb2*]nHnm?]3WFGf0}obKOY}Vdn#Y(wZjK^A93qX#n) +NV]x+g@?NhlpA^l)wiv -yjfR#pMyTD>k+T:j>J4xnmv]OLCX+7Yyz6qs^3mOnOcC83p#Ku+R(JuN?P!poAGy1sfhser2olC!Oz]}VRz9 -zWroSz-IE!wxavQ*^b:q0W]YxirTdE=?ii@{0![FQdK%A+>?P+ -iClzgO<.SQvl%)J?Q2e1re#c}=S$5d+fWWaSH=q{6GZ1RO}4Hctjh1!2FCHPJ<&C/K5{OUI -6q6mFf0EGB:2Ga5fG[y^]7+!cTG9SX:AWy326yHW>Dn?U0(C:y$VPS8Da=&mMR?g#009J7G -M/D*3MO>zfA2hXl1E-40VfMaKi@Z{x[@?Yjd)e[GEfWH{L!G.9YNmLi=Gxrpf@DqWT(@72t -?EH+A1xL354SJYBI255Srl.e@r*6[2v]4)p:7NQNyd&Ne/#l>OpWn5D0HM&LLtadF#m2ohYM4QvHu/3oKBRPbv/W>Pc@7uiqgtV&vry9yj!O(V=r( ->02Hb70m=jGmNwwn]8H.V+LOqg.SJNHxy4tJuP>I^37lqW?#go{?3 +Ji4f/YwyTk-q*njE<>JPOM7?1e2&LCFWJyi8nBnGPpC({6#{21RwSPOj8O3lP973 +u0]q:m@[2LIusbbJ?gf7@AQ2mw{#Gkds1j^ZO8y07BNsW:Zp#E4?Uj{xUBkj5y(j*e]v&Ba +zdPD-cFC!R?QG(%[7jCVV*6UWCyqqE?WY>CJcsZ0jc5Bmgoy?.JWC>HEn.o[>ypFA5uxl>t +KSOpO*uCi/rSty?Wx[vl!TEv{%fNcjpS# +us)?2VA!0dE$/PJ6St)QRnr34OI-+7XBAb&eTc^L01Gmh12*z(=}:94Kd!M}Sx#j&cfm6:l +nABwXxZnf3*9#}0ISXRF3%Sj]=t9xh-J2[U[Ez2]#uz5y@^h0@A!&R3&yD?{tfL=zh +MdXXauRgJ{NC(LY^GSX&6&kY)k%vuTb2*]nHnm?]3WFGf0}obKOY}Vdn#Y(wZjK^A9 +3qX#n)NV]x+g@?NhlpA^a4nW:2}m/2#.BaEGfuF - Creation Time: 2014-01-19T19:23:32 - Checksum: 0C:49:17:C1:B7:E5:85:C0:17:C5:00:93:8F:8F:62:D9 - DF:3A:25:00:3D:75:53:30:F7:61:77:D8:04:75:95:79 - Serial Number: 0xE7096F3B + Key-ID: 0xFFA4A7BBD49C6181 + Public-Key: u=&@%IOV2$8cB&YWh<806wSwA1g$3f2R+M:trx4[ + Creation Time: 2014-02-08T20:17:54 + Checksum: 24:02:E3:F4:37:4A:C2:EC:C7:29:9D:3B:3F:BC:34:EC + 52:14:53:7A:64:94:F8:AF:44:FB:17:3C:65:81:48:E3 + Serial Number: 0xCD42437A Key Version: 0x00000005 Random Art ID: +----------------+ + | .. . | + | o . .o . . | + | o . .. o . | + | . o | + | . . . | + | o + | + | + | | | - | | - | | - | . | - |. o . | - |=+ . . | - |=... . . | - |+oo... | +----------------+ -1ba4nW:2}m/2#.BaEXyru9j:4^XIqQxg=Tm&LeTZ(51V}oDChh8:)f3u=mfllncCgQVts^T51hI^npVwG2}7<6=wvSbZ+C%Dg:v{%fNmL[ll:HHLoy -6A1]YW7%}EOh30uA/cj>>B!@sJJQAvfLr&FS)5oP6^Y7-m1Bb.&y>([?Hjnj9wR7{5<-TN< -[L{&wnaea#]IvQH=jlAbwqgDDo(W3Z{w/Rp:F3e?/IJ5fAqrtBPxnD%nt<]ciz1QxqVyE}G -}Dde)ZodMjXJm8SDdf^Pbl=HEtlWvjRbSUv%w=&wD1xwMZOZO0[jcOL!FQS94:YV4bDp+h{ -iy[iM)e4pz44wWZbma:{HVATQNFX9cJp3)%xs2HQ{kvk6H!mGbO4sU@T>a +g(gWYob{dqYIPti^ITAC3>/Ijr7x<8WQPJ0hZ4Qf3P9vK-:6v]e4c*oh3gtSsla.h?kwACO?h%29Y74z2-jxZaD[N+yn]@QjbTH0M.iC0@tAgVKq}%5h6pEh*ph1@78e^ +6orCqP/969Ox0{A+sLj@/mfDiu!!B*7e-]}kIA+NE.vVpd=..[K/4mkppjf[1i*$-bQWTP/ +yBE(SyBpV$iv3J9hCnu$gAnKbiW!HEx:CR&Bm:tVq!9yFz^)g3kX$vGvqC{aQq8yIp1^U8I +13h^uM9y[>q}9dN]xTfI07>*m=Q4l.bR7K5)h=U!-M:gv.QeR7.d9}?I]7{sLr8>42]IOrX +56+z1&:L@%g%KoLF^bG&.cFcwD]Tds846!K}7xV1<$JB7m]{jB}z-DH4/tEFA-ho(fipKGx +DW^KQxzLM%Q%ld7rYOgBDmkvYWd$4#8=q44OS8[<oZpc3@ +D1vDW(eLl5k@p>^lpa6%iytXVi57yn00000qUC.400005+%B^z ------ END PCP PUBLICKEY ------ diff --git a/tests/key-bobby-sec b/tests/key-bobby-sec index cf97979..37e524b 100644 --- a/tests/key-bobby-sec +++ b/tests/key-bobby-sec @@ -1,24 +1,24 @@ ----- BEGIN PCP SECRET KEY ----- - Generated by: Pretty Curved Privacy Version 0.1.5 + Generated by: Pretty Curved Privacy Version 0.2.1 Cipher: CURVE25519-ED25519-SALSA20-POLY1305 - Key-ID: 0x78FBD073AC12DDDC - Creation Time: 2014-01-19T19:23:32 - Serial Number: 0xE7096F3B + Key-ID: 0xFFA4A7BBD49C6181 + Creation Time: 2014-02-08T20:17:54 + Serial Number: 0xCD42437A Key Version: 0x00000005 -1ba4nW:2}m/2#.BaEGl0DiD2X?@5RUgq-[h9CpS]OkY15{- -5#NM>dr-nYl0ARaDKhcHl(Uq&=.p]3Epnib6 -/Y8qz[2B{)W>MoDChh8:)f3u=mfllncCgQVts^T51hI^npVwG2}7<6=wvSbZ+C%Dg:v{%fNmL[ll -:HHLoy6A1]YW7%}EOh30uA/cj>>B!@sJJQAvfLr&FS)5oP6^Y7-m1Bb.&y>([?Hjnj9wR7{ -5<-TN<[L{&wnaea#]IvQH=jlAbwqgDDo(W3Z{w/Rp:F3e?/IJ5fAqrtBPxnD%nt<]ciz1Qx -qVyE}G}Dde)ZodMjXJm8SDdf^Pbl=HEtlWvjRbSUv%w=&wD1xwMZOZO0[jcOL!FQS94:YV4 -bDp+h{iy[iM)e4pz44wWZbma:{HVATQ+AfR +&<8mUU)w36J4Tm}L}ue2<.%.N6pW?0hf6]!)}fZToQDt2/X)j06RlT=7lJ+d!MbjTjJoyMr +@^g2G3mGazm@yR4QYs^Q0((vqtXA^LK}Cde{M*Aq(lh-MClt!eCoQ0osuw5pdxhqdPeQb=F +SsceD-NcS<7rRCkFdPQ9*T>JE-#u=ZP0/FT1dfqgb{g^Gq^np7o:BWSP1Qqof3d=$8/A&4& +S)4Bx%rALsLUl7xohwmM+(WBN{]:)REEIexkkZ^(w+a(eV+!9F[HN8=NFX9cJp3)%xs2HQ{kvk6H!mGbO4 +sU@T>ag(gWYob{dqYIPti^ITAC3>/Ijr7x<8WQPJ0hZ4Qf3P9vK-:6v]e4c*oh3gtSsla.h +?kwACO?h%29Y74z2-jxZaD[N+yn]@QjbTH0M.iC0@tAgVKq}%5h6pEh*ph +1@78e^6orCqP/969Ox0{A+sLj@/mfDiu!!B*7e-]}kIA+NE.vVpd=..[K/4mkppjf[1i*$- +bQWTP/yBE(SyBpV$iv3J9hCnu$gAnKbiW!HEx:CR&Bm:tVq!9yFz^)g3kX$vGvqC{aQq8yI +p1^U8I13h^uM9y[>q}9dN]xTfI07>*m=Q4l.bR7K5)h=U!-M:gv.QeR7.d9}?I]7{sLr8>4 +2]IOrX56+z1&:L@%g%KoLF^bG&.cFcwD]Tds846!K}7xV1<$JB7m]{jB}z-DH4/tEFA-ho( +fipKGxDW^KQxzLM%Q%ld7rYOgBDmkvYWd$4#8=q44OS8[< +oZpc3@D1vDW(eLl5k@p>^lpa6%iytXVi57ym00000qUC.400005+%B^z ------ END PCP SECRET KEY ------ diff --git a/tests/keys.cfg b/tests/keys.cfg index 3ad7118..c2c95ec 100644 --- a/tests/keys.cfg +++ b/tests/keys.cfg @@ -1,6 +1,6 @@ -bartid = 0x45AE802C2C338179 -bartserial = 0x7F7EF76B -idbobby = 0x78FBD073AC12DDDC -idalicia = 0x7A96E7F11E3A92FC +bartid = 0x1AAAC77510D883C9 +bartserial = 0xD716902C +idbobby = 0xFFA4A7BBD49C6181 +idalicia = 0x82BE660E56313C52 mailbobby = bobby@local mailalicia = alicia@local diff --git a/tests/static.h b/tests/static.h index a3b20b2..f8edb9f 100644 --- a/tests/static.h +++ b/tests/static.h @@ -1,33 +1,33 @@ size_t secret_a_len = 32; unsigned char secret_a[32] = { -0x28, 0xad, 0x6c, 0x7d, 0x37, 0x6b, 0xf9, 0x83, -0x9f, 0x0b, 0x95, 0xff, 0xd5, 0xbc, 0x56, 0x7e, -0x81, 0xa3, 0x11, 0x75, 0x3f, 0x94, 0x31, 0xb9, -0x98, 0x04, 0x81, 0xe3, 0xa4, 0xfd, 0xdb, 0x55 +0x18, 0x6e, 0xa4, 0xc4, 0x57, 0x0b, 0xdf, 0x21, +0x46, 0xcf, 0x75, 0xd1, 0xad, 0x44, 0xe9, 0xa2, +0x98, 0x06, 0xa3, 0xe5, 0xfe, 0x51, 0x02, 0xcd, +0xe6, 0x8f, 0x08, 0xa0, 0xb3, 0x25, 0xb7, 0x65 }; size_t public_a_len = 32; unsigned char public_a[32] = { -0x0c, 0x32, 0x80, 0xd9, 0xc5, 0x72, 0xd5, 0x3d, -0x22, 0x25, 0x92, 0x8a, 0x46, 0xab, 0xe3, 0x88, -0x71, 0x30, 0x48, 0x1a, 0xa1, 0x47, 0x36, 0xe9, -0xba, 0x7f, 0x58, 0x97, 0x7c, 0x69, 0xe3, 0x72 +0x7c, 0xad, 0x50, 0xbc, 0x22, 0x47, 0x13, 0x40, +0xb9, 0xb0, 0xf4, 0x95, 0xad, 0xa4, 0x5c, 0x5f, +0xb9, 0x94, 0x4f, 0x93, 0xae, 0xf0, 0x08, 0x5e, +0xda, 0x9f, 0x32, 0x4e, 0xed, 0x11, 0x67, 0x5e }; size_t secret_b_len = 32; unsigned char secret_b[32] = { -0x50, 0xf3, 0xa8, 0xb4, 0x3b, 0xbb, 0x83, 0x75, -0x81, 0x50, 0xb2, 0x51, 0x2b, 0xcd, 0xce, 0x63, -0x96, 0x6e, 0xbe, 0x6a, 0x91, 0x39, 0xf2, 0x3f, -0x70, 0xe1, 0x72, 0xdf, 0xac, 0xf4, 0xe7, 0x61 +0x78, 0x6a, 0xe1, 0xea, 0x51, 0x9f, 0xfc, 0xfb, +0xaa, 0xaf, 0xca, 0x46, 0xc2, 0x5d, 0x78, 0x8e, +0x8b, 0x1a, 0x6e, 0xd5, 0xe4, 0xdf, 0x5f, 0xba, +0x13, 0xc4, 0xc4, 0xc4, 0x3d, 0xb5, 0xb7, 0x66 }; size_t public_b_len = 32; unsigned char public_b[32] = { -0x4e, 0x47, 0x89, 0x91, 0x2f, 0x69, 0x30, 0x6c, -0x0f, 0x0d, 0xf3, 0xb6, 0xa5, 0x52, 0xe1, 0xff, -0x55, 0x8d, 0x2e, 0x52, 0x88, 0x58, 0x60, 0x6a, -0x0f, 0x19, 0x40, 0xf1, 0x0d, 0xa1, 0xe9, 0x30 +0x2d, 0xf3, 0xfc, 0x59, 0x65, 0xf8, 0xd9, 0xc4, +0x50, 0x65, 0x68, 0x24, 0x5e, 0x64, 0x4d, 0xa5, +0x3b, 0x23, 0x77, 0x3e, 0x00, 0xde, 0xe6, 0x7a, +0x27, 0x53, 0x28, 0x7e, 0x96, 0x31, 0xe4, 0x3c }; size_t message_len = 12; @@ -38,16 +38,16 @@ unsigned char message[12] = { size_t nonce_len = 24; unsigned char nonce[24] = { -0xc6, 0x26, 0x8c, 0xa8, 0x17, 0xb3, 0xb4, 0x99, -0x14, 0x12, 0x30, 0xd1, 0x11, 0x93, 0x36, 0x09, -0xe0, 0xb7, 0x3f, 0x16, 0xe0, 0xd1, 0x0c, 0x0d +0xc4, 0x20, 0x58, 0x86, 0x7d, 0x01, 0x26, 0xc4, +0x8e, 0xe5, 0xfe, 0xdb, 0x4a, 0xcc, 0x86, 0x27, +0x8b, 0xf9, 0x32, 0x7e, 0x2d, 0x4d, 0xbb, 0x52 }; size_t cipher_len = 28; unsigned char cipher[28] = { -0x90, 0x9d, 0x75, 0xfb, 0xb2, 0xb1, 0x8b, 0x3e, -0x39, 0x56, 0xd3, 0x4a, 0x69, 0x52, 0xf8, 0x2f, -0x12, 0xb2, 0x4e, 0x32, 0x3f, 0x4e, 0xa4, 0x45, -0xb6, 0x5d, 0x16, 0x80 +0xc9, 0x4f, 0x63, 0xb0, 0x1b, 0xbe, 0x94, 0x71, +0xda, 0x35, 0x4e, 0xd7, 0x0d, 0xd7, 0x83, 0x8a, +0x07, 0x92, 0xb0, 0x8f, 0x9b, 0xa6, 0x69, 0x94, +0xeb, 0xd9, 0x4e, 0x0a }; diff --git a/tests/unittests.cfg b/tests/unittests.cfg index 1112fc8..c48d35b 100644 --- a/tests/unittests.cfg +++ b/tests/unittests.cfg @@ -123,12 +123,13 @@ dxmorg@florida.cops.gov cmd = $pcp -t -I unknown3 expect = /empty/ - +/* +temporarily disabled cmd = $pcp -t -I unknown4 expect = /encrypted/ - +*/ # # encryption tests @@ -399,12 +400,6 @@ dxmorg@florida.cops.gov expect = /secret key contained in key seems to be empty/ - - cmd = $pcp -V $vault -S -I testkey-wrong-serial - # sometimes the created key is invalid in another way - expect = /(invalid serial number|could not decode input)/ - - cmd = $pcp -V $vault -S -I testkey-wrong-type expect = /key type is not SECRET/ @@ -423,11 +418,6 @@ dxmorg@florida.cops.gov expect = /(invalid key id|could not decode input)/ - - cmd = $pcp -V $vault -P -I testpubkey-wrong-serial - expect = /invalid serial number/ - - cmd = $pcp -V $vault -P -I testpubkey-wrong-type expect = /key type is not PUBLIC/ diff --git a/tests/unknown1 b/tests/unknown1 index d99fd4a..82201f2 100644 --- a/tests/unknown1 +++ b/tests/unknown1 @@ -1,11 +1,11 @@ -1fqYjUMAgr%2@iuii(D6ORTB?v(#o}0-]/?noP(Cu>@:wrG!(hj%NXd(>&p{kTvPy:Fh%J[ -4Qog7Dc3!/Ilc(zddr)0l]IzRC9e9N-I-cH2Pvg5=xGaV%0x0Jm=?KlJ/IxMB/fJxxlCJ}* -E@rCfTDUlX0SE:-97Lcp2dWcQ5@U?0c -9@rbY)(/I.=TH5d178sKFH7UvFpIhwP8w?UHM21-uxbJ}I45(zIN=kdftEhh#lzq@!#X/YQ -LJyRVsb8Zg7oTfPe0e1cEX?cPLOo:Kb}NtGC0ZYypu:[=ft37EcvY1FiOJW3wKzefr6QtC3 -.rpBO?&I!F+z10[hcITb9i]DgWegaluND+y1ZOwbuK^^C@pgqBu+>o5un3/]FT/+O:p&xz} -5}{ooTKsQFh9)K +]r0nw:E[VrJKGwnS6XTra+f){ir[CfTrKgma8H{M1J*fhkN+Cty{DW=FY#=!ACNCfBrLZgr +so5c0Z0iqphaoRvqYPQ&>B?$q(var)qVr#8>cltT=SjfPWnUhD}QHrlxixo/4Mf&>qI<&i} +Y3{ZCT58*A#>awHW=xML+.LL.cI3xlrY^q}wH]^!b$Qx5CI[W$Z9CJNH)mzjorqWh>ALBY= +n*hzp6/GYDKkAw%Wu[9=s}GQPhHUs[G:!Lx%P&LCAdM?S +5%aT@e8n4>)tKuyyhM$R1!c9F:epakrajl24d@LRPKSorJvs9yQeo[Nmxm{%ewpx!ztc0Md +BDbfCCF{XSHDlAa/8LL??G(i=KVMa=[X:#E!@z^hru/p$x>qc&zE=1Gz!0i(022l^AUSQ6e +3pgk*PXzUi[k/(1Uve1:p=o*Gqqz4YM*U?8:)wRi4y/!i1O9.7n&zb2KEAP!#w##Av9$uVn +^#&JEG{Dt5)vV2SH+R1u2BL?FhH{E#SQqX +>qF+E4O?EA0Azz9l^LXUX7VFu/Et?COC:cgTasgD1kmkE1Im2jWe8uy{Rg42C}j^>{99-5rVh}dXeup00k}9BWeauL#Z +p[NL1[HN9/iw@VEg^:nWmk)K(iwyHo00000qUC.600005m0(L5 diff --git a/tests/unknown2 b/tests/unknown2 index 090a92f..24c4e15 100644 --- a/tests/unknown2 +++ b/tests/unknown2 @@ -1,15 +1,15 @@ -1fqYjUMAgr%2@iuii(D6ORTB?v(#o}0-]/?noP(Cu&XQ9^]ZWVx6Hboz[dH2uO)*O]&N5cU -FTgW})(0pJ$}.{rG!(hj%NXd(>&p{kTvPy:Fh%J[4Qog7Dc3!/z{/w2TCh)S[He(iY/Nfh% -S{()cl$-Ow[Z[3-+em.6>}}q>NhMgSL}3keiBukDeZrvN^1lw#:/mef/*U -70xuz:pg%TxfGJ9O>:0hzddr)0l]IzRC9e9N-I-cH2Pvg5=xGaV%0x0Jm=?KlJ/IxMB/fJx -xlCJ}*E@rCfTDUlX0SE:-97Lcp2dWcQ5@U?0c9@rbY)(/I.=TH5d178sKFH7UvFpIhwP8w?UHM21-uxbJ}I45(zIN=kdftEhh#lzq@ -!#X/YQLJyRVsb8Zg7oTfPe0e1cEX?cPLOo:Kb}NtGC0ZYypu:[=ft37EcvY1FiOJW3wKzef -r6QtC3.rpBO?&I!F+z10[hcITb9i]DgWegaluND+y1ZOwbuK^^C@pgqBu+>o5un3/]FT/+O -:p&xz}5}{ooTKsQFh9)K +]r0nw:E[VrJKGwnS6XTra+f){ir[CfTrKgma8H{M07G-kT$@6UJwkMRaVd!AFbB>3Dto#po +T-lg*3BPA1J*fhkN+Cty{DW=FY#=!ACNCfBrLZgrso5c0Z0iq0a{H#Gn0!$vv>@QeHT6dvC +nGRBLJ<%HQo6U4]zzwskJ-/i?+y4w$:{(v}*Hh]CP0]7Gn/qxuuy%jOEu +1Ecn+B-ep5G1e:O<*P>s6dBhJ6!YAz+D>vFJ}{.NDf +:?ha2cTo)#Sjo(v7b6U)JThbfsF:9ffdlwI@]AqQ!*>vHSklkiR15>N3^DEO(N).wis1?!D +/dLF+mpY%yu+^iqphaoRvqYPQ&>B?$q(var)qVr#8>cltT=SjfPWnUhD}QHrlxixo/4Mf&> +qI<&i}Y3{ZCT58*A#>awHW=xML+.LL.cI3xlrY^q}wH]^!b$Qx5CI[W$Z9CJNH)mzjorqWh +>ALBY=n*hzp6/GYDKkAw%Wu[9=s}GQPhHUs[G:!Lx%P&L +CAdM?S5%aT@e8n4>)tKuyyhM$R1!c9F:epakrajl24d@LRPKSorJvs9yQeo[Nmxm{%ewpx! +ztc0MdBDbfCCF{XSHDlAa/8LL??G(i=KVMa=[X:#E!@z^hru/p$x>qc&zE=1Gz!0i(022l^ +AUSQ6e3pgk*PXzUi[k/(1Uve1:p=o*Gqqz4YM*U?8:)wRi4y/!i1O9.7n&zb2KEAP!#w##A +v9$uVn^#&JEG{Dt5)vV2SH+R1u2BL?FhH{ +E#SQqX>qF+E4O?EA0Azz9l^LXUX7VFu/Et?COC:cgTasgD1kmkE1Im2jWe8uy{Rg42C}j^> +{99-5rVh}dXeup00k}9BW +eauL#Zp[NL1[HN9/iw@VEg^:nWmk)K(iwyHn00000qUC.600005m0(L5 diff --git a/tests/unknown4 b/tests/unknown4 index 7eafbc5..795485b 100644 --- a/tests/unknown4 +++ b/tests/unknown4 @@ -1,2 +1,2 @@ -0Ji3}dGK/Q*@=EAXCkzw)M9pdfSm9+xZZX]Bt9K$%cTFQ8EUj3pK(}T6aYdesz#XiCvFwdj -M0N)yB]@2g)T-EmJZ10wjEkV>u&/v +ޮ>Đڵ^ +l,t>aHf\|TMO܋ diff --git a/tests/unknown5 b/tests/unknown5 index ef2a137..2e08434 100644 --- a/tests/unknown5 +++ b/tests/unknown5 @@ -1,2 +1,2 @@ -15H8sSn+vmg.g0JlKFtJg%P3OYMOCt7NAgDR%zP]xY33$zKh$mqrCsdce)7NO[+60NK:^OW -$G-:j&Cwk3o7mhhBPL]f!(9Mk@*X&lJv8^000000000008?O?c&:kE0SSi200000 +blah +nacl-+fE6˲GӚ4G&ig/_׏el$CB `r 0~:'n(hgknnjjDFx+`4>QPA%` ]WPKX