Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
cx_ecfp.h
Go to the documentation of this file.
1
2/*******************************************************************************
3 * Ledger Nano S - Secure firmware
4 * (c) 2022 Ledger
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 ********************************************************************************/
18
19#ifndef CX_ECFP_H
20#define CX_ECFP_H
21
22#ifdef HAVE_ECC
23
24#include <stddef.h>
25#include <stdint.h>
26#include "lcx_ecfp.h"
27
28#define CX_REG_ECC_SIZE 80
29
30#if defined(BOLOS_RELEASE) && defined(HAVE_ECC_WITH_NO_RANDOMIZE)
31#error HAVE_ECC_WITH_NO_RANDOMIZE not allowed for release
32#endif // HAVE_ECC_WITH_NO_RANDOMIZE
33
34#define CX_BITLEN2BYTELEN(l) (((uint32_t) (l) + 7) >> 3)
35
36/* Encoding/Decoding */
37
38size_t cx_ecfp_encode_sig_der(uint8_t *sig,
39 size_t sig_len,
40 const uint8_t *r,
41 size_t r_len,
42 const uint8_t *s,
43 size_t s_len);
44int cx_ecfp_decode_sig_der(const uint8_t *sig,
45 size_t sig_len,
46 size_t max_size,
47 const uint8_t **r,
48 size_t *r_len,
49 const uint8_t **s,
50 size_t *s_len);
51
52#endif // HAVE_ECC
53
54#endif // CX_ECFP_H
Key pair generation based on elliptic curves.
unsigned char uint8_t
Definition usbd_conf.h:53