Helper routines for RSA. More...
Go to the source code of this file.
Functions | |
error_t | rsaep (const RsaPublicKey *key, const Mpi *m, Mpi *c) |
RSA encryption primitive. More... | |
error_t | rsadp (const RsaPrivateKey *key, const Mpi *c, Mpi *m) |
RSA decryption primitive. More... | |
error_t | rsasp1 (const RsaPrivateKey *key, const Mpi *m, Mpi *s) |
RSA signature primitive. More... | |
error_t | rsavp1 (const RsaPublicKey *key, const Mpi *s, Mpi *m) |
RSA verification primitive. More... | |
error_t | emePkcs1v15Encode (const PrngAlgo *prngAlgo, void *prngContext, const uint8_t *message, size_t messageLen, uint8_t *em, size_t k) |
EME-PKCS1-v1_5 encoding operation. More... | |
uint32_t | emePkcs1v15Decode (uint8_t *em, size_t k, size_t *messageLen) |
EME-PKCS1-v1_5 decoding operation. More... | |
error_t | emeOaepEncode (const PrngAlgo *prngAlgo, void *prngContext, const HashAlgo *hash, const char_t *label, const uint8_t *message, size_t messageLen, uint8_t *em, size_t k) |
EME-OAEP encoding operation. More... | |
uint32_t | emeOaepDecode (const HashAlgo *hash, const char_t *label, uint8_t *em, size_t k, size_t *messageLen) |
EME-OAEP decoding operation. More... | |
error_t | emsaPkcs1v15Encode (const HashAlgo *hash, const uint8_t *digest, uint8_t *em, size_t emLen) |
EMSA-PKCS1-v1_5 encoding operation. More... | |
error_t | emsaPkcs1v15Verify (const HashAlgo *hash, const uint8_t *digest, const uint8_t *em, size_t emLen) |
EMSA-PKCS1-v1_5 verification operation. More... | |
error_t | emsaPssEncode (const PrngAlgo *prngAlgo, void *prngContext, const HashAlgo *hash, size_t saltLen, const uint8_t *digest, uint8_t *em, uint_t emBits) |
EMSA-PSS encoding operation. More... | |
error_t | emsaPssVerify (const HashAlgo *hash, size_t saltLen, const uint8_t *digest, uint8_t *em, uint_t emBits) |
EMSA-PSS verification operation. More... | |
void | mgf1 (const HashAlgo *hash, HashContext *hashContext, const uint8_t *seed, size_t seedLen, uint8_t *data, size_t dataLen) |
MGF1 mask generation function. More... | |
Detailed Description
Helper routines for RSA.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2025 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.5.0
Definition in file rsa_misc.h.
Function Documentation
◆ emeOaepDecode()
uint32_t emeOaepDecode | ( | const HashAlgo * | hash, |
const char_t * | label, | ||
uint8_t * | em, | ||
size_t | k, | ||
size_t * | messageLen | ||
) |
EME-OAEP decoding operation.
- Parameters
-
[in] hash Underlying hash function [in] label Optional label to be associated with the message [in] em Encoded message [in] k Length of the encoded message [out] messageLen Length of the decrypted message
- Returns
- The function returns 0 on success, 1 on failure
Definition at line 421 of file rsa_misc.c.
◆ emeOaepEncode()
error_t emeOaepEncode | ( | const PrngAlgo * | prngAlgo, |
void * | prngContext, | ||
const HashAlgo * | hash, | ||
const char_t * | label, | ||
const uint8_t * | message, | ||
size_t | messageLen, | ||
uint8_t * | em, | ||
size_t | k | ||
) |
EME-OAEP encoding operation.
- Parameters
-
[in] prngAlgo PRNG algorithm [in] prngContext Pointer to the PRNG context [in] hash Underlying hash function [in] label Optional label to be associated with the message [in] message Message to be encrypted [in] messageLen Length of the message to be encrypted [out] em Encoded message [in] k Length of the encoded message
- Returns
- Error code
Definition at line 331 of file rsa_misc.c.
◆ emePkcs1v15Decode()
uint32_t emePkcs1v15Decode | ( | uint8_t * | em, |
size_t | k, | ||
size_t * | messageLen | ||
) |
EME-PKCS1-v1_5 decoding operation.
- Parameters
-
[in] em Encoded message [in] k Length of the encoded message [out] messageLen Length of the decrypted message
- Returns
- The function returns 0 on success, 1 on failure
Definition at line 277 of file rsa_misc.c.
◆ emePkcs1v15Encode()
error_t emePkcs1v15Encode | ( | const PrngAlgo * | prngAlgo, |
void * | prngContext, | ||
const uint8_t * | message, | ||
size_t | messageLen, | ||
uint8_t * | em, | ||
size_t | k | ||
) |
EME-PKCS1-v1_5 encoding operation.
- Parameters
-
[in] prngAlgo PRNG algorithm [in] prngContext Pointer to the PRNG context [in] message Message to be encrypted [in] messageLen Length of the message to be encrypted [out] em Encoded message [in] k Length of the encoded message
- Returns
- Error code
Definition at line 209 of file rsa_misc.c.
◆ emsaPkcs1v15Encode()
error_t emsaPkcs1v15Encode | ( | const HashAlgo * | hash, |
const uint8_t * | digest, | ||
uint8_t * | em, | ||
size_t | emLen | ||
) |
EMSA-PKCS1-v1_5 encoding operation.
- Parameters
-
[in] hash Hash function used to digest the message [in] digest Digest of the message to be signed [out] em Encoded message [in] emLen Intended length of the encoded message
- Returns
- Error code
Definition at line 519 of file rsa_misc.c.
◆ emsaPkcs1v15Verify()
error_t emsaPkcs1v15Verify | ( | const HashAlgo * | hash, |
const uint8_t * | digest, | ||
const uint8_t * | em, | ||
size_t | emLen | ||
) |
EMSA-PKCS1-v1_5 verification operation.
- Parameters
-
[in] hash Hash function [in] digest Digest value [in] em Encoded message [in] emLen Length of the encoded message
- Returns
- Error code
Definition at line 583 of file rsa_misc.c.
◆ emsaPssEncode()
error_t emsaPssEncode | ( | const PrngAlgo * | prngAlgo, |
void * | prngContext, | ||
const HashAlgo * | hash, | ||
size_t | saltLen, | ||
const uint8_t * | digest, | ||
uint8_t * | em, | ||
uint_t | emBits | ||
) |
EMSA-PSS encoding operation.
- Parameters
-
[in] prngAlgo PRNG algorithm [in] prngContext Pointer to the PRNG context [in] hash Underlying hash function [in] saltLen Length of the salt, in bytes [in] digest Digest of the message to be signed [out] em Encoded message [in] emBits Maximal bit length of the integer OS2IP(EM)
- Returns
- Error code
Definition at line 659 of file rsa_misc.c.
◆ emsaPssVerify()
error_t emsaPssVerify | ( | const HashAlgo * | hash, |
size_t | saltLen, | ||
const uint8_t * | digest, | ||
uint8_t * | em, | ||
uint_t | emBits | ||
) |
EMSA-PSS verification operation.
- Parameters
-
[in] hash Underlying hash function [in] saltLen Length of the salt, in bytes [in] digest Digest of the message to be signed [out] em Encoded message [in] emBits Maximal bit length of the integer OS2IP(EM)
- Returns
- Error code
Definition at line 749 of file rsa_misc.c.
◆ mgf1()
void mgf1 | ( | const HashAlgo * | hash, |
HashContext * | hashContext, | ||
const uint8_t * | seed, | ||
size_t | seedLen, | ||
uint8_t * | data, | ||
size_t | dataLen | ||
) |
MGF1 mask generation function.
- Parameters
-
[in] hash Hash function [in] hashContext Hash function context [in] seed Seed from which the mask is generated [in] seedLen Length of the seed in bytes [in,out] data Data block to be masked [in] dataLen Length of the data block in bytes
Definition at line 855 of file rsa_misc.c.
◆ rsadp()
error_t rsadp | ( | const RsaPrivateKey * | key, |
const Mpi * | c, | ||
Mpi * | m | ||
) |
RSA decryption primitive.
- Parameters
-
[in] key RSA private key [in] c Ciphertext representative [out] m Message representative
- Returns
- Error code
The RSA decryption primitive recovers the message representative from the ciphertext representative under the control of a private key
- Parameters
-
[in] key RSA private key [in] c Ciphertext representative [out] m Message representative
- Returns
- Error code
Definition at line 527 of file gd32f5xx_crypto_pkc.c.
◆ rsaep()
error_t rsaep | ( | const RsaPublicKey * | key, |
const Mpi * | m, | ||
Mpi * | c | ||
) |
RSA encryption primitive.
- Parameters
-
[in] key RSA public key [in] m Message representative [out] c Ciphertext representative
- Returns
- Error code
The RSA encryption primitive produces a ciphertext representative from a message representative under the control of a public key
- Parameters
-
[in] key RSA public key [in] m Message representative [out] c Ciphertext representative
- Returns
- Error code
Definition at line 497 of file gd32f5xx_crypto_pkc.c.
◆ rsasp1()
error_t rsasp1 | ( | const RsaPrivateKey * | key, |
const Mpi * | m, | ||
Mpi * | s | ||
) |
RSA signature primitive.
The RSA signature primitive produces a signature representative from a message representative under the control of a private key
- Parameters
-
[in] key RSA private key [in] m Message representative [out] s Signature representative
- Returns
- Error code
Definition at line 168 of file rsa_misc.c.
◆ rsavp1()
error_t rsavp1 | ( | const RsaPublicKey * | key, |
const Mpi * | s, | ||
Mpi * | m | ||
) |
RSA verification primitive.
The RSA verification primitive recovers the message representative from the signature representative under the control of a public key
- Parameters
-
[in] key RSA public key [in] s Signature representative [out] m Message representative
- Returns
- Error code
Definition at line 189 of file rsa_misc.c.