Embedded SDK
Embedded SDK
lcx_ecschnorr.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 
27 #ifdef HAVE_ECSCHNORR
28 
29 #include "lcx_wrappers.h"
30 
31 #ifndef LCX_ECSCHNORR_H
32 #define LCX_ECSCHNORR_H
33 
74 WARN_UNUSED_RESULT cx_err_t cx_ecschnorr_sign_no_throw(const cx_ecfp_private_key_t *pvkey,
75  uint32_t mode,
76  cx_md_t hashID,
77  const uint8_t *msg,
78  size_t msg_len,
79  uint8_t *sig,
80  size_t *sig_len);
81 
86 DEPRECATED static inline size_t cx_ecschnorr_sign(const cx_ecfp_private_key_t *pvkey,
87  uint32_t mode,
88  cx_md_t hashID,
89  const unsigned char *msg,
90  unsigned int msg_len,
91  unsigned char *sig,
92  size_t sig_len,
93  unsigned int *info)
94 {
95  UNUSED(info);
96  CX_THROW(cx_ecschnorr_sign_no_throw(pvkey, mode, hashID, msg, msg_len, sig, &sig_len));
97  return sig_len;
98 }
99 
131 WARN_UNUSED_RESULT bool cx_ecschnorr_verify(const cx_ecfp_public_key_t *pukey,
132  uint32_t mode,
133  cx_md_t hashID,
134  const uint8_t *msg,
135  size_t msg_len,
136  const uint8_t *sig,
137  size_t sig_len);
138 
139 #endif
140 
141 #endif // HAVE_ECSHCNORR
#define CX_THROW(call)
Definition: lcx_wrappers.h:15
unsigned char uint8_t
Definition: usbd_conf.h:53