M460 public-key hardware accelerator. More...
#include "m460.h"
#include "core/crypto.h"
#include "hardware/m460/m460_crypto.h"
#include "hardware/m460/m460_crypto_pkc.h"
#include "pkc/rsa.h"
#include "ecc/ec.h"
#include "ecc/ec_misc.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL CRYPTO_TRACE_LEVEL |
Functions | |
void | rsaImportMpi (uint32_t *dest, uint_t length, const Mpi *a) |
Import multiple-precision integer. More... | |
error_t | rsaExportMpi (uint32_t *src, uint_t length, Mpi *r) |
Export multiple-precision integer. More... | |
error_t | mpiExpModFast (Mpi *r, const Mpi *a, const Mpi *e, const Mpi *p) |
Modular exponentiation (fast calculation) More... | |
error_t | mpiExpModRegular (Mpi *r, const Mpi *a, const Mpi *e, const Mpi *p) |
Modular exponentiation (regular calculation) More... | |
error_t | rsadp (const RsaPrivateKey *key, const Mpi *c, Mpi *m) |
RSA decryption primitive. More... | |
void | eccImportScalar (volatile uint32_t *dest, uint_t length, const uint32_t *src) |
Import scalar. More... | |
void | eccExportScalar (volatile uint32_t *src, uint_t length, uint32_t *dest) |
Export scalar. 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... | |
Detailed Description
M460 public-key hardware accelerator.
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 m460_crypto_pkc.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL CRYPTO_TRACE_LEVEL |
Definition at line 32 of file m460_crypto_pkc.c.
Function Documentation
◆ eccExportScalar()
void eccExportScalar | ( | volatile uint32_t * | src, |
uint_t | length, | ||
uint32_t * | dest | ||
) |
Export scalar.
- Parameters
-
[in] src Pointer to the operand [in] length Length of the operand, in bits [out] dest Pointer to the scalar
Definition at line 450 of file m460_crypto_pkc.c.
◆ eccImportScalar()
void eccImportScalar | ( | volatile uint32_t * | dest, |
uint_t | length, | ||
const uint32_t * | src | ||
) |
Import scalar.
- Parameters
-
[in] dest Pointer to the operand [in] length Length of the operand, in bits [in] src Pointer to the scalar
Definition at line 428 of file m460_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 474 of file m460_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 491 of file m460_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 576 of file m460_crypto_pkc.c.
◆ mpiExpModFast()
Modular exponentiation (fast 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 142 of file m460_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 224 of file m460_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 311 of file m460_crypto_pkc.c.
◆ rsaExportMpi()
Export multiple-precision integer.
- Parameters
-
[in] src Pointer to the operand [in] length Length of the operand, in bytes [out] r Pointer to the multiple-precision integer
- Returns
- Error code
Definition at line 92 of file m460_crypto_pkc.c.
◆ rsaImportMpi()
Import multiple-precision integer.
- Parameters
-
[in] dest Pointer to the operand [in] length Length of the operand, in bytes [in] a Pointer to the multiple-precision integer
Definition at line 59 of file m460_crypto_pkc.c.