From b83342b20ab84c1607dcb2df6ab3589a5f566073 Mon Sep 17 00:00:00 2001 From: "alexey.stratulat" <alexey.stratulat@demlabs.net> Date: Fri, 14 Jan 2022 16:54:12 +0700 Subject: [PATCH] [*] Moved from the features-5386 pkeyHash branch to the Sign class. --- modules/dap-sdk/crypto/include/wrapping_dap_sign.h | 2 ++ modules/dap-sdk/crypto/src/wrapping_dap_sign.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/modules/dap-sdk/crypto/include/wrapping_dap_sign.h b/modules/dap-sdk/crypto/include/wrapping_dap_sign.h index 55fbaa5a..2ba1a48f 100644 --- a/modules/dap-sdk/crypto/include/wrapping_dap_sign.h +++ b/modules/dap-sdk/crypto/include/wrapping_dap_sign.h @@ -86,11 +86,13 @@ typedef struct PyDapSign{ PyObject *wrapping_dap_sign_get_type(PyObject *self, void *closure); PyObject *wrapping_dap_sign_get_pkey(PyObject *self, void *closure); +PyObject *wrapping_dap_sign_get_pkey_hash(PyObject *self, void *closure); PyObject *wrapping_dap_sign_get_size(PyObject *self, void *closure); static PyGetSetDef DapSignObjectGetsSetsDef[] = { {"type", (getter)wrapping_dap_sign_get_type, NULL, NULL, NULL}, {"pkey", (getter)wrapping_dap_sign_get_pkey, NULL, NULL, NULL}, + {"pkeyHash", (getter)wrapping_dap_sign_get_pkey_hash, NULL,NULL, NULL}, {"size", (getter)wrapping_dap_sign_get_size, NULL, NULL, NULL}, {NULL} }; diff --git a/modules/dap-sdk/crypto/src/wrapping_dap_sign.c b/modules/dap-sdk/crypto/src/wrapping_dap_sign.c index 9ac7d275..be175709 100644 --- a/modules/dap-sdk/crypto/src/wrapping_dap_sign.c +++ b/modules/dap-sdk/crypto/src/wrapping_dap_sign.c @@ -18,6 +18,14 @@ PyObject *wrapping_dap_sign_get_pkey(PyObject *self, void *closure){ obj_pkey->pkey = (dap_pkey_t*)((PyDapSignObject*)self)->sign->pkey_n_sign; return (PyObject*)obj_pkey; } +PyObject *wrapping_dap_sign_get_pkey_hash(PyObject *self, void *closure){ + (void)closure; + PyDapHashFastObject *obj_hash = PyObject_New(PyDapHashFastObject, &DapHashFastObject_DapHashFastObjectType); + PyObject_Dir((PyObject*)obj_hash); + obj_hash->hash_fast = DAP_NEW(dap_chain_hash_fast_t); + dap_sign_get_pkey_hash(((PyDapSignObject*)self)->sign, obj_hash->hash_fast); + return (PyObject*)obj_hash; +} PyObject *wrapping_dap_sign_get_size(PyObject *self, void *closure){ (void)closure; return Py_BuildValue("I", ((PyDapSignObject*)self)->sign->header.sign_size); -- GitLab