Mistake on this page?
Report an issue in GitHub or email us
crys_ecpki_ecdsa.h
Go to the documentation of this file.
1 /**************************************************************************************
2 * Copyright (c) 2016-2017, ARM Limited or its affiliates. All rights reserved *
3 * *
4 * This file and the related binary are licensed under the following license: *
5 * *
6 * ARM Object Code and Header Files License, v1.0 Redistribution. *
7 * *
8 * Redistribution and use of object code, header files, and documentation, without *
9 * modification, are permitted provided that the following conditions are met: *
10 * *
11 * 1) Redistributions must reproduce the above copyright notice and the *
12 * following disclaimer in the documentation and/or other materials *
13 * provided with the distribution. *
14 * *
15 * 2) Unless to the extent explicitly permitted by law, no reverse *
16 * engineering, decompilation, or disassembly of is permitted. *
17 * *
18 * 3) Redistribution and use is permitted solely for the purpose of *
19 * developing or executing applications that are targeted for use *
20 * on an ARM-based product. *
21 * *
22 * DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
23 * CONTRIBUTORS "AS IS." ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT *
24 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT, *
25 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
26 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED *
28 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
29 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
30 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
31 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
33 **************************************************************************************/
34 
35 
36 
37 #ifndef CRYS_ECPKI_ECDSA_H
38 #define CRYS_ECPKI_ECDSA_H
39 
40 /*!
41 @file
42 @brief Defines the APIs that support the ECDSA functions.
43 @defgroup crys_ecpki_ecdsa CryptoCell ECDSA APIs
44 @{
45 @ingroup cryptocell_ecpki
46 */
47 
48 #include "crys_error.h"
49 #include "crys_ecpki_types.h"
50 #include "crys_hash.h"
51 #include "crys_rnd.h"
52 
53 #ifdef __cplusplus
54 extern "C"
55 {
56 #endif
57 
58 
59 
60 /**************************************************************************
61  * CRYS_ECDSA_Sign - integrated function
62  **************************************************************************/
63 /*!
64 @brief This function performs an ECDSA sign operation in integrated form.
65 
66 \note
67 Using of HASH functions with HASH size greater than EC modulus size, is not recommended!.
68 Algorithm according [ANS X9.62] standard.
69 
70 The message data may be either a non-hashed data or a digest of a hash function.
71 For a non-hashed data, the message data will be hashed using the hash function indicated by ::CRYS_ECPKI_HASH_OpMode_t.
72 For a digest, ::CRYS_ECPKI_HASH_OpMode_t should indicate the hash function that the message data was created by, and it will not be hashed.
73 
74 @return CRYS_OK on success.
75 @return A non-zero value on failure as defined crys_ecpki_error.h, crys_hash_error.h or crys_rnd_error.h.
76 **/
78  void *rndState_ptr, /*!< [in/out] Pointer to the RND state structure. */
79  SaSiRndGenerateVectWorkFunc_t rndGenerateVectFunc, /*!< [in] Pointer to the random vector generation function. */
80  CRYS_ECDSA_SignUserContext_t *pSignUserContext, /*!< [in/out] Pointer to the user buffer for signing the database. */
81  CRYS_ECPKI_UserPrivKey_t *pSignerPrivKey, /*!< [in] A pointer to a user private key structure. */
82  CRYS_ECPKI_HASH_OpMode_t hashMode, /*!< [in] One of the supported SHA-x HASH modes, as defined in
83  ::CRYS_ECPKI_HASH_OpMode_t.
84  \note MD5 is not supported. */
85  uint8_t *pMessageDataIn, /*!< [in] Pointer to the input data to be signed.
86  The size of the scatter/gather list representing the data buffer
87  is limited to 128 entries, and the size of each entry is limited
88  to 64KB (fragments larger than 64KB are broken into
89  fragments <= 64KB). */
90  uint32_t messageSizeInBytes, /*!< [in] Size of message data in bytes. */
91  uint8_t *pSignatureOut, /*!< [in] Pointer to a buffer for output of signature. */
92  uint32_t *pSignatureOutSize /*!< [in/out] Pointer to the signature size. Used to pass the size of
93  the SignatureOut buffer (in), which must be >= 2
94  * OrderSizeInBytes. When the API returns,
95  it is replaced with the size of the actual signature (out). */
96  );
97 
98 
99 
100 /**************************************************************************
101  * CRYS_ECDSA_Verify integrated function
102  **************************************************************************/
103 /*!
104 @brief This function performs an ECDSA verify operation in integrated form.
105 Algorithm according [ANS X9.62] standard.
106 
107 The message data may be either a non-hashed data or a digest of a hash function.
108 For a non-hashed data, the message data will be hashed using the hash function indicated by ::CRYS_ECPKI_HASH_OpMode_t.
109 For a digest, ::CRYS_ECPKI_HASH_OpMode_t should indicate the hash function that the message data was created by, and it will not be hashed.
110 
111 @return CRYS_OK on success.
112 @return A non-zero value on failure as defined crys_ecpki_error.h or crys_hash_error.h.
113 */
114 CIMPORT_C CRYSError_t CRYS_ECDSA_Verify (
115  CRYS_ECDSA_VerifyUserContext_t *pVerifyUserContext, /*!< [in] Pointer to the user buffer for signing the database. */
116  CRYS_ECPKI_UserPublKey_t *pUserPublKey, /*!< [in] Pointer to a user public key structure. */
117  CRYS_ECPKI_HASH_OpMode_t hashMode, /*!< [in] One of the supported SHA-x HASH modes, as defined in
118  ::CRYS_ECPKI_HASH_OpMode_t.
119  \note MD5 is not supported. */
120  uint8_t *pSignatureIn, /*!< [in] Pointer to the signature to be verified. */
121  uint32_t SignatureSizeBytes, /*!< [in] Size of the signature (in bytes). */
122  uint8_t *pMessageDataIn, /*!< [in] Pointer to the input data that was signed (same as given to
123  the signing function). The size of the scatter/gather list representing
124  the data buffer is limited to 128 entries, and the size of each entry is
125  limited to 64KB (fragments larger than 64KB are broken into fragments <= 64KB). */
126  uint32_t messageSizeInBytes /*!< [in] Size of the input data (in bytes). */
127  );
128 
129 
130 /**********************************************************************************************************/
131 
132 
133 #ifdef __cplusplus
134 }
135 #endif
136 /**
137 @}
138  */
139 #endif
Contains all of the enums and definitions that are used for the CRYS ECPKI APIs.
CRYSError_t CRYS_ECDSA_Verify(CRYS_ECDSA_VerifyUserContext_t *pVerifyUserContext, CRYS_ECPKI_UserPublKey_t *pUserPublKey, CRYS_ECPKI_HASH_OpMode_t hashMode, uint8_t *pSignatureIn, uint32_t SignatureSizeBytes, uint8_t *pMessageDataIn, uint32_t messageSizeInBytes)
This function performs an ECDSA verify operation in integrated form. Algorithm according [ANS X9...
CRYS_ECPKI_HASH_OpMode_t
This file contains all of the enums and definitions that are used for the CRYS HASH APIs...
This file contains the CRYS APIs used for random number generation. The random-number generation modu...
uint32_t CRYSError_t
Definition: crys_error.h:253
CRYSError_t CRYS_ECDSA_Sign(void *rndState_ptr, SaSiRndGenerateVectWorkFunc_t rndGenerateVectFunc, CRYS_ECDSA_SignUserContext_t *pSignUserContext, CRYS_ECPKI_UserPrivKey_t *pSignerPrivKey, CRYS_ECPKI_HASH_OpMode_t hashMode, uint8_t *pMessageDataIn, uint32_t messageSizeInBytes, uint8_t *pSignatureOut, uint32_t *pSignatureOutSize)
This function performs an ECDSA sign operation in integrated form.
uint32_t(* SaSiRndGenerateVectWorkFunc_t)(void *rndState_ptr, uint16_t outSizeBytes, uint8_t *out_ptr)
Definition: crys_rnd.h:206
This module defines the error return code types and the numbering spaces of the error codes for each ...
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.