SM2 signature algorithm. More...
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL CRYPTO_TRACE_LEVEL |
Functions | |
error_t | sm2GenerateSignature (const PrngAlgo *prngAlgo, void *prngContext, const EcDomainParameters *params, const EcPrivateKey *privateKey, const HashAlgo *hashAlgo, const char_t *id, size_t idLen, const void *message, size_t messageLen, EcdsaSignature *signature) |
SM2 signature generation. More... | |
error_t | sm2VerifySignature (const EcDomainParameters *params, const EcPublicKey *publicKey, const HashAlgo *hashAlgo, const char_t *id, size_t idLen, const void *message, size_t messageLen, const EcdsaSignature *signature) |
SM2 signature verification. More... | |
error_t | sm2ComputeZa (const HashAlgo *hashAlgo, HashContext *hashContext, const EcDomainParameters *params, const EcPublicKey *pa, const char_t *ida, size_t idaLen, uint8_t *za) |
Calculate ZA. More... | |
Variables | |
const uint8_t | SM2_WITH_SM3_OID [8] = {0x2A, 0x81, 0x1C, 0xCF, 0x55, 0x01, 0x83, 0x75} |
Detailed Description
SM2 signature algorithm.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneCRYPTO Open.
This program 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 2 of the License, or (at your option) any later version.
This program 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 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.4.4
Definition in file sm2.c.
Macro Definition Documentation
◆ TRACE_LEVEL
Function Documentation
◆ sm2ComputeZa()
error_t sm2ComputeZa | ( | const HashAlgo * | hashAlgo, |
HashContext * | hashContext, | ||
const EcDomainParameters * | params, | ||
const EcPublicKey * | pa, | ||
const char_t * | ida, | ||
size_t | idaLen, | ||
uint8_t * | za | ||
) |
Calculate ZA.
- Parameters
-
[in] hashAlgo Hash function [in] hashContext Hash function context [in] params EC domain parameters [in] pa Public key of user A [in] ida Distinguishing identifier of user A [in] idaLen Length of the identifier [out] za Hash value of the distinguishing identifier of user A
◆ sm2GenerateSignature()
error_t sm2GenerateSignature | ( | const PrngAlgo * | prngAlgo, |
void * | prngContext, | ||
const EcDomainParameters * | params, | ||
const EcPrivateKey * | privateKey, | ||
const HashAlgo * | hashAlgo, | ||
const char_t * | id, | ||
size_t | idLen, | ||
const void * | message, | ||
size_t | messageLen, | ||
EcdsaSignature * | signature | ||
) |
SM2 signature generation.
- Parameters
-
[in] prngAlgo PRNG algorithm [in] prngContext Pointer to the PRNG context [in] params EC domain parameters [in] privateKey Signer's EC private key [in] hashAlgo Underlying hash function [in] id User's identity [in] idLen Length of the user's identity [in] message Message to be signed [in] messageLen Length of the message, in bytes [out] signature (r, s) integer pair
- Returns
- Error code
◆ sm2VerifySignature()
error_t sm2VerifySignature | ( | const EcDomainParameters * | params, |
const EcPublicKey * | publicKey, | ||
const HashAlgo * | hashAlgo, | ||
const char_t * | id, | ||
size_t | idLen, | ||
const void * | message, | ||
size_t | messageLen, | ||
const EcdsaSignature * | signature | ||
) |
SM2 signature verification.
- Parameters
-
[in] params EC domain parameters [in] publicKey Signer's SM2 public key [in] hashAlgo Underlying hash function [in] id User's identity [in] idLen Length of the user's identity [in] message Message whose signature is to be verified [in] messageLen Length of the message, in bytes [in] signature (r, s) integer pair
- Returns
- Error code