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/curve25519.h"
#include "ecc/curve448.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 | eccImportMpi (volatile uint32_t *dest, uint_t length, const Mpi *a) |
Import multiple-precision integer. More... | |
error_t | eccExportMpi (volatile uint32_t *src, uint_t length, Mpi *r) |
Export multiple-precision integer. More... | |
error_t | ecMult (const EcDomainParameters *params, EcPoint *r, const Mpi *d, const EcPoint *s) |
Scalar multiplication. More... | |
error_t | ecTwinMult (const EcDomainParameters *params, EcPoint *r, const Mpi *d0, const EcPoint *s, const Mpi *d1, const EcPoint *t) |
Twin multiplication. More... | |
void | curve25519Mul (uint32_t *r, const uint32_t *a, const uint32_t *b) |
Modular multiplication. More... | |
void | curve448Mul (uint32_t *r, const uint32_t *a, const uint32_t *b) |
Modular multiplication. More... | |
Detailed Description
M460 public-key hardware accelerator.
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 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
◆ curve25519Mul()
void curve25519Mul | ( | uint32_t * | r, |
const uint32_t * | a, | ||
const uint32_t * | b | ||
) |
Modular multiplication.
- Parameters
-
[out] r Resulting integer R = (A * B) mod p [in] a An integer such as 0 <= A < p [in] b An integer such as 0 <= B < p
Definition at line 643 of file m460_crypto_pkc.c.
◆ curve448Mul()
void curve448Mul | ( | uint32_t * | r, |
const uint32_t * | a, | ||
const uint32_t * | b | ||
) |
Modular multiplication.
- Parameters
-
[out] r Resulting integer R = (A * B) mod p [in] a An integer such as 0 <= A < p [in] b An integer such as 0 <= B < p
Definition at line 721 of file m460_crypto_pkc.c.
◆ eccExportMpi()
Export multiple-precision integer.
- Parameters
-
[in] src Pointer to the operand [in] length Length of the operand, in bits [out] r Pointer to the multiple-precision integer
- Returns
- Error code
Definition at line 462 of file m460_crypto_pkc.c.
◆ eccImportMpi()
Import multiple-precision integer.
- Parameters
-
[in] dest Pointer to the operand [in] length Length of the operand, in bits [in] a Pointer to the multiple-precision integer
Definition at line 429 of file m460_crypto_pkc.c.
◆ ecMult()
error_t ecMult | ( | const EcDomainParameters * | params, |
EcPoint * | r, | ||
const Mpi * | d, | ||
const EcPoint * | s | ||
) |
Scalar multiplication.
- Parameters
-
[in] params EC domain 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 512 of file m460_crypto_pkc.c.
◆ ecTwinMult()
error_t ecTwinMult | ( | const EcDomainParameters * | params, |
EcPoint * | r, | ||
const Mpi * | d0, | ||
const EcPoint * | s, | ||
const Mpi * | d1, | ||
const EcPoint * | t | ||
) |
Twin multiplication.
- Parameters
-
[in] params EC domain 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 600 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 143 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 225 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 312 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 93 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 60 of file m460_crypto_pkc.c.