NXP MCX N547 public-key hardware accelerator (PKA) More...
#include <mcuxClToolchain.h>
#include <mcuxClEls.h>
#include <mcuxClEcc.h>
#include <mcuxClRsa.h>
#include <internal/mcuxClRsa_Internal_Functions.h>
#include "core/crypto.h"
#include "hardware/mcxn547/mcxn547_crypto.h"
#include "hardware/mcxn547/mcxn547_crypto_pkc.h"
#include "pkc/rsa.h"
#include "ecc/ec.h"
#include "ecc/ec_misc.h"
#include "ecc/ecdsa.h"
#include "ecc/x25519.h"
#include "ecc/x448.h"
#include "ecc/ed25519.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL CRYPTO_TRACE_LEVEL |
Functions | |
error_t | mpiExpModRegular (Mpi *r, const Mpi *a, const Mpi *e, const Mpi *p) |
Modular exponentiation (regular calculation) More... | |
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 | ecMulFast (const EcCurve *curve, EcPoint3 *r, const uint32_t *d, const EcPoint3 *s) |
Scalar multiplication (fast calculation) More... | |
error_t | ecMulRegular (const EcCurve *curve, EcPoint3 *r, const uint32_t *d, const EcPoint3 *s) |
Scalar multiplication (regular calculation) More... | |
error_t | ecTwinMul (const EcCurve *curve, EcPoint3 *r, const uint32_t *d0, const EcPoint3 *s, const uint32_t *d1, const EcPoint3 *t) |
Twin multiplication. More... | |
error_t | ecdsaGenerateSignature (const PrngAlgo *prngAlgo, void *prngContext, const EcPrivateKey *privateKey, const uint8_t *digest, size_t digestLen, EcdsaSignature *signature) |
ECDSA signature generation. More... | |
error_t | ecdsaVerifySignature (const EcPublicKey *publicKey, const uint8_t *digest, size_t digestLen, const EcdsaSignature *signature) |
ECDSA signature verification. More... | |
error_t | x25519 (uint8_t *r, const uint8_t *k, const uint8_t *u) |
X25519 function (scalar multiplication on Curve25519) More... | |
error_t | x448 (uint8_t *r, const uint8_t *k, const uint8_t *u) |
X448 function (scalar multiplication on Curve448) More... | |
error_t | ed25519GenerateSignature (const uint8_t *privateKey, const uint8_t *publicKey, const void *message, size_t messageLen, const void *context, uint8_t contextLen, uint8_t flag, uint8_t *signature) |
EdDSA signature generation. More... | |
error_t | ed25519VerifySignature (const uint8_t *publicKey, const void *message, size_t messageLen, const void *context, uint8_t contextLen, uint8_t flag, const uint8_t *signature) |
EdDSA signature verification. More... | |
Variables | |
ALIGNED ElsRsaArgs | elsRsaArgs |
ALIGNED ElsEccArgs | elsEccArgs |
ALIGNED ElsEcdsaArgs | elsEcdsaArgs |
ALIGNED ElsMontDhArgs | elsMontDhArgs |
ALIGNED ElsEddsaArgs | elsEddsaArgs |
Detailed Description
NXP MCX N547 public-key hardware accelerator (PKA)
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.4
Definition in file mcxn547_crypto_pkc.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL CRYPTO_TRACE_LEVEL |
Definition at line 32 of file mcxn547_crypto_pkc.c.
Function Documentation
◆ ecdsaGenerateSignature()
error_t ecdsaGenerateSignature | ( | const PrngAlgo * | prngAlgo, |
void * | prngContext, | ||
const EcPrivateKey * | privateKey, | ||
const uint8_t * | digest, | ||
size_t | digestLen, | ||
EcdsaSignature * | signature | ||
) |
ECDSA signature generation.
- Parameters
-
[in] prngAlgo PRNG algorithm [in] prngContext Pointer to the PRNG context [in] privateKey Signer's EC private key [in] digest Digest of the message to be signed [in] digestLen Length in octets of the digest [out] signature (R, S) integer pair
- Returns
- Error code
Definition at line 724 of file mcxn547_crypto_pkc.c.
◆ ecdsaVerifySignature()
error_t ecdsaVerifySignature | ( | const EcPublicKey * | publicKey, |
const uint8_t * | digest, | ||
size_t | digestLen, | ||
const EcdsaSignature * | signature | ||
) |
ECDSA signature verification.
- Parameters
-
[in] publicKey Signer's EC public key [in] digest Digest of the message whose signature is to be verified [in] digestLen Length in octets of the digest [in] signature (R, S) integer pair
- Returns
- Error code
Definition at line 852 of file mcxn547_crypto_pkc.c.
◆ ecMulFast()
Scalar multiplication (fast calculation)
- Parameters
-
[in] curve Elliptic curve parameters [out] r Resulting point R = d.S [in] d An integer d such as 0 <= d < p [in] s EC point
- Returns
- Error code
Definition at line 522 of file mcxn547_crypto_pkc.c.
◆ ecMulRegular()
error_t ecMulRegular | ( | const EcCurve * | curve, |
EcPoint3 * | r, | ||
const uint32_t * | d, | ||
const EcPoint3 * | s | ||
) |
Scalar multiplication (regular calculation)
- Parameters
-
[in] curve Elliptic curve parameters [out] r Resulting point R = d.S [in] d An integer d such as 0 <= d < q [in] s EC point
- Returns
- Error code
Definition at line 539 of file mcxn547_crypto_pkc.c.
◆ ecTwinMul()
error_t ecTwinMul | ( | const EcCurve * | curve, |
EcPoint3 * | r, | ||
const uint32_t * | d0, | ||
const EcPoint3 * | s, | ||
const uint32_t * | d1, | ||
const EcPoint3 * | t | ||
) |
Twin multiplication.
- Parameters
-
[in] curve Elliptic curve parameters [out] r Resulting point R = d0.S + d1.T [in] d0 An integer d such as 0 <= d0 < p [in] s EC point [in] d1 An integer d such as 0 <= d1 < p [in] t EC point
- Returns
- Error code
Definition at line 665 of file mcxn547_crypto_pkc.c.
◆ ed25519GenerateSignature()
error_t ed25519GenerateSignature | ( | const uint8_t * | privateKey, |
const uint8_t * | publicKey, | ||
const void * | message, | ||
size_t | messageLen, | ||
const void * | context, | ||
uint8_t | contextLen, | ||
uint8_t | flag, | ||
uint8_t * | signature | ||
) |
EdDSA signature generation.
- Parameters
-
[in] privateKey Signer's EdDSA private key (32 bytes) [in] publicKey Signer's EdDSA public key (32 bytes) [in] message Pointer to the message to be signed [in] messageLen Length of the message, in bytes [in] context Constant string specified by the protocol using it [in] contextLen Length of the context, in bytes [in] flag Prehash flag for Ed25519ph scheme [out] signature EdDSA signature (64 bytes)
- Returns
- Error code
Definition at line 1214 of file mcxn547_crypto_pkc.c.
◆ ed25519VerifySignature()
error_t ed25519VerifySignature | ( | const uint8_t * | publicKey, |
const void * | message, | ||
size_t | messageLen, | ||
const void * | context, | ||
uint8_t | contextLen, | ||
uint8_t | flag, | ||
const uint8_t * | signature | ||
) |
EdDSA signature verification.
- Parameters
-
[in] publicKey Signer's EdDSA public key (32 bytes) [in] message Message whose signature is to be verified [in] messageLen Length of the message, in bytes [in] context Constant string specified by the protocol using it [in] contextLen Length of the context, in bytes [in] flag Prehash flag for Ed25519ph scheme [in] signature EdDSA signature (64 bytes)
- Returns
- Error code
Definition at line 1389 of file mcxn547_crypto_pkc.c.
◆ mpiExpModRegular()
Modular exponentiation (regular calculation)
- Parameters
-
[out] r Resulting integer R = A ^ E mod P [in] a Pointer to a multiple precision integer [in] e Exponent [in] p Modulus
- Returns
- Error code
Definition at line 169 of file mcxn547_crypto_pkc.c.
◆ rsadp()
error_t rsadp | ( | const RsaPrivateKey * | key, |
const Mpi * | c, | ||
Mpi * | m | ||
) |
RSA decryption primitive.
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 369 of file mcxn547_crypto_pkc.c.
◆ rsaep()
error_t rsaep | ( | const RsaPublicKey * | key, |
const Mpi * | m, | ||
Mpi * | c | ||
) |
RSA encryption primitive.
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 268 of file mcxn547_crypto_pkc.c.
◆ x25519()
error_t x25519 | ( | uint8_t * | r, |
const uint8_t * | k, | ||
const uint8_t * | u | ||
) |
X25519 function (scalar multiplication on Curve25519)
- Parameters
-
[out] r Output u-coordinate [in] k Input scalar [in] u Input u-coordinate
- Returns
- Error code
Definition at line 1025 of file mcxn547_crypto_pkc.c.
◆ x448()
error_t x448 | ( | uint8_t * | r, |
const uint8_t * | k, | ||
const uint8_t * | u | ||
) |
X448 function (scalar multiplication on Curve448)
- Parameters
-
[out] r Output u-coordinate [in] k Input scalar [in] u Input u-coordinate
- Returns
- Error code
Definition at line 1117 of file mcxn547_crypto_pkc.c.
Variable Documentation
◆ elsEccArgs
ALIGNED ElsEccArgs elsEccArgs |
Definition at line 57 of file mcxn547_crypto_pkc.c.
◆ elsEcdsaArgs
ALIGNED ElsEcdsaArgs elsEcdsaArgs |
Definition at line 58 of file mcxn547_crypto_pkc.c.
◆ elsEddsaArgs
ALIGNED ElsEddsaArgs elsEddsaArgs |
Definition at line 60 of file mcxn547_crypto_pkc.c.
◆ elsMontDhArgs
ALIGNED ElsMontDhArgs elsMontDhArgs |
Definition at line 59 of file mcxn547_crypto_pkc.c.
◆ elsRsaArgs
ALIGNED ElsRsaArgs elsRsaArgs |
Definition at line 56 of file mcxn547_crypto_pkc.c.