Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
address_book_crypto.h
Go to the documentation of this file.
1/*****************************************************************************
2 * (c) 2026 Ledger SAS.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16#pragma once
17
18#include <stdint.h>
19#include <stddef.h>
20#include <stdbool.h>
21#include "bip32.h"
22#include "lcx_sha256.h"
23#include "address_book.h"
24#include "identity.h"
25#include "os_address_book.h"
26
27#ifdef HAVE_ADDRESS_BOOK
28
29bool address_book_generate_group_handle(const path_bip32_t *bip32_path,
30 uint8_t group_handle[GROUP_HANDLE_SIZE]);
31
32bool address_book_verify_group_handle(const path_bip32_t *bip32_path,
33 const uint8_t group_handle[GROUP_HANDLE_SIZE],
34 uint8_t gid_out[GID_SIZE]);
35
36bool address_book_compute_hmac_proof(const path_bip32_t *bip32_path,
37 const uint8_t gid[GID_SIZE],
38 const char *name,
39 uint8_t hmac_out[CX_SHA256_SIZE]);
40
41bool address_book_verify_hmac_proof(const path_bip32_t *bip32_path,
42 const uint8_t gid[GID_SIZE],
43 const char *name,
44 const uint8_t hmac_expected[CX_SHA256_SIZE]);
45
46bool address_book_compute_hmac_rest(const path_bip32_t *bip32_path,
47 const uint8_t gid[GID_SIZE],
48 const char *scope,
49 const uint8_t *identifier,
50 uint8_t identifier_len,
52 uint64_t chain_id,
53 uint8_t hmac_out[CX_SHA256_SIZE]);
54
55bool address_book_verify_hmac_rest(const path_bip32_t *bip32_path,
56 const uint8_t gid[GID_SIZE],
57 const char *scope,
58 const uint8_t *identifier,
59 uint8_t identifier_len,
61 uint64_t chain_id,
62 const uint8_t hmac_expected[CX_SHA256_SIZE]);
63
64#ifdef HAVE_ADDRESS_BOOK_LEDGER_ACCOUNT
65
66bool address_book_compute_hmac_proof_ledger_account(const path_bip32_t *bip32_path,
67 const char *name,
69 uint64_t chain_id,
70 uint8_t hmac_out[CX_SHA256_SIZE]);
71
72bool address_book_verify_hmac_proof_ledger_account(const path_bip32_t *bip32_path,
73 const char *name,
75 uint64_t chain_id,
76 const uint8_t hmac_expected[CX_SHA256_SIZE]);
77
78#endif // HAVE_ADDRESS_BOOK_LEDGER_ACCOUNT
79
81bool address_book_send_hmac_proof(uint8_t type, const uint8_t hmac_proof[CX_SHA256_SIZE]);
82
84bool address_book_send_register_identity_response(const uint8_t group_handle[GROUP_HANDLE_SIZE],
85 const uint8_t hmac_proof[CX_SHA256_SIZE],
86 const uint8_t hmac_rest[CX_SHA256_SIZE]);
87
88#endif // HAVE_ADDRESS_BOOK
blockchain_family_e
Register / Edit Contact Name / Edit Scope / Edit Identifier.
SHA-2 (Secure Hash Algorithm 2)