Skip to content
Snippets Groups Projects
Commit bfda622d authored by Dmitriy A. Gerasimov's avatar Dmitriy A. Gerasimov
Browse files

[+] Public key and digital signature format and operations

parent 42395561
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "dap_chain_pkey.h" #include "dap_chain_pkey.h"
#define LOG_TAG "chain_key" #define LOG_TAG "chain_key"
dap_chain_pkey_t m_dap_chain_pkey_null={0}; // For sizeof nothing more
/** /**
......
...@@ -49,4 +49,12 @@ typedef struct dap_chain_pkey{ ...@@ -49,4 +49,12 @@ typedef struct dap_chain_pkey{
uint8_t pkey[]; /// @param pkey @brief raw pkey dat uint8_t pkey[]; /// @param pkey @brief raw pkey dat
} DAP_ALIGN_PACKED dap_chain_pkey_t; } DAP_ALIGN_PACKED dap_chain_pkey_t;
extern dap_chain_pkey_t m_dap_chain_pkey_null; // For sizeof nothing more
dap_chain_pkey_t *dap_chain_pkey_from_enc_key(dap_enc_key_t *a_key); dap_chain_pkey_t *dap_chain_pkey_from_enc_key(dap_enc_key_t *a_key);
inline size_t dap_chain_pkey_from_enc_key_output_calc(dap_enc_key_t *a_key)
{
return sizeof(m_dap_chain_pkey_null.header)+ a_key->pub_key_data_size;
}
int dap_chain_pkey_from_enc_key_output(dap_enc_key_t *a_key, void * a_output);
/*
* Authors:
* Dmitriy A. Gearasimov <gerasimov.dmitriy@demlabs.net>
* DeM Labs Inc. https://demlabs.net https:/gitlab.com/demlabs
* Kelvin Project https://github.com/kelvinblockchain
* Copyright (c) 2017-2018
* All rights reserved.
This file is part of DAP (Deus Applications Prototypes) the open source project
DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
#include "dap_common.h"
#include "dap_chain_sign.h"
#include "dap_enc_bliss.h"
#include "dap_enc_tesla.h"
#include "dap_enc_picnic.h"
#define LOG_TAG "dap_chain_sign"
dap_chain_sign_t * s_sign_null = NULL;
bliss_signature_t s_sign_bliss_null = {0};
size_t dap_chain_sign_cals_size(dap_enc_key_t * a_key)
{
size_t l_sign_size = 0;
switch (a_key->type){
case DAP_ENC_KEY_TYPE_SIG_BLISS: l_sign_size = sizeof(s_sign_bliss_null); break;
case DAP_ENC_KEY_TYPE_SIG_PICNIC: dap_enc_picnic_calc_signature_size(a_key); break;
default : return 0;
}
return sizeof(s_sign_null->header)+ a_key->pub_key_data_size + l_sign_size;
}
int dap_chain_sign_create(dap_enc_key_t *a_key, const void * a_data, const size_t a_data_size, void * a_output )
{
return 0;
}
...@@ -27,13 +27,15 @@ ...@@ -27,13 +27,15 @@
#include <stdint.h> #include <stdint.h>
#include "dap_common.h" #include "dap_common.h"
#include "dap_enc_ca.h" #include "dap_enc_ca.h"
#include "dap_enc_key.h"
typedef union dap_chain_sign_type{ typedef union dap_chain_sign_type{
enum { enum {
SIG_TYPE_PICNIC = 0x0000, SIG_TYPE_BLISS = 0x0000,
SIG_TYPE_DEFO = 0x0001, /// @brief key image for anonymous transaction SIG_TYPE_DEFO = 0x0001, /// @brief key image for anonymous transaction
SIG_TYPE_TESLA = 0x0002, /// @brief
SIG_TYPE_PICNIC = 0x0101, /// @brief
SIG_TYPE_MULTI = 0xffff /// @brief Has inside subset of different signatures and sign composed with all of them SIG_TYPE_MULTI = 0xffff /// @brief Has inside subset of different signatures and sign composed with all of them
} type: 16; } type: 16;
uint16_t raw; uint16_t raw;
} dap_chain_sign_type_t; } dap_chain_sign_type_t;
...@@ -51,4 +53,5 @@ typedef struct dap_chain_sign{ ...@@ -51,4 +53,5 @@ typedef struct dap_chain_sign{
uint8_t pkey_n_sign[]; /// @param sig @brief raw signature data uint8_t pkey_n_sign[]; /// @param sig @brief raw signature data
} DAP_ALIGN_PACKED dap_chain_sign_t; } DAP_ALIGN_PACKED dap_chain_sign_t;
//int dap_chain_sign_data(dap_chain_si, ) size_t dap_chain_sign_cals_size(dap_enc_key_t * a_key);
int dap_chain_sign_create(dap_enc_key_t *a_key, const void * a_data, const size_t a_data_size, void * a_output );
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment