Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libdap-chain-crypto
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
cellframe
libdap-chain-crypto
Commits
bfda622d
Commit
bfda622d
authored
6 years ago
by
Dmitriy A. Gerasimov
Browse files
Options
Downloads
Patches
Plain Diff
[+] Public key and digital signature format and operations
parent
42395561
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
dap_chain_pkey.c
+1
-0
1 addition, 0 deletions
dap_chain_pkey.c
dap_chain_pkey.h
+8
-0
8 additions, 0 deletions
dap_chain_pkey.h
dap_chain_sign.c
+50
-0
50 additions, 0 deletions
dap_chain_sign.c
dap_chain_sign.h
+6
-3
6 additions, 3 deletions
dap_chain_sign.h
with
65 additions
and
3 deletions
dap_chain_pkey.c
+
1
−
0
View file @
bfda622d
...
@@ -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
/**
/**
...
...
This diff is collapsed.
Click to expand it.
dap_chain_pkey.h
+
8
−
0
View file @
bfda622d
...
@@ -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
);
This diff is collapsed.
Click to expand it.
dap_chain_sign.c
+
50
−
0
View file @
bfda622d
/*
* 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
;
}
This diff is collapsed.
Click to expand it.
dap_chain_sign.h
+
6
−
3
View file @
bfda622d
...
@@ -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
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment