Skip to content

Commit

Permalink
nrf_security: drivers: cracen: fix Ed25519 and Ed448 spelling
Browse files Browse the repository at this point in the history
Capitalize them properly.

Signed-off-by: Tomi Fontanilles <[email protected]>
  • Loading branch information
tomi-font authored and nordicjm committed Jan 15, 2025
1 parent 2029018 commit 8144355
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 55 deletions.
4 changes: 2 additions & 2 deletions subsys/nrf_security/src/drivers/cracen/cracenpsa/src/sign.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ static psa_status_t cracen_signature_ecc_sign(int message, const psa_key_attribu
sign.r = (char *)signature;
sign.s = (char *)signature + *signature_length / 2;

/* ED25519PH requires prehashing and supports sign and verify message
/* Ed25519ph requires prehashing and supports sign and verify message
* the message is therefore hashed here before si_sig_verify is called
*/
if (alg == PSA_ALG_ED25519PH && message) {
Expand Down Expand Up @@ -419,7 +419,7 @@ static psa_status_t cracen_signature_ecc_verify(int message, const psa_key_attri
sign.sz = signature_length;
sign.r = (char *)signature;
sign.s = (char *)signature + signature_length / 2;
/* ED25519PH requires prehashing and supports sign and verify message
/* Ed25519ph requires prehashing and supports sign and verify message
* the message is therefore hashed here before si_sig_verify is called
*/
if (alg == PSA_ALG_ED25519PH && message) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extern "C" {

#include "sig.h"

/** Signature definitions for ED25519PH keys.
/** Signature definitions for Ed25519ph keys.
*
* The following constraints apply when using Ed25519ph keys:
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
/* This is the ASCII string with the
* PHflag 1 and context size 0 appended as defined in:
* https://datatracker.ietf.org/doc/html/rfc8032.html#section-2
* used for domain seperation between ED25519 and ED25519PH
* used for domain seperation between Ed25519 and Ed25519ph
*/
const char dom2[34] = {
0x53, 0x69, 0x67, 0x45, 0x64, 0x32, 0x35,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,23 @@ struct sx_pk_cmd_def;
*
* All operands for this command use a little endian representation.
* Operands should be decoded and clamped as defined in specifications
* for ED25519 or ED448.
* for Ed25519 or Ed448.
*/
extern const struct sx_pk_cmd_def *const SX_PK_CMD_EDDSA_PTMUL;

/** EdDSA 2nd part of signature operation
*
* All operands for this command use a little endian representation.
* Operands should be decoded and clamped as defined in specifications
* for ED25519 or ED448.
* for Ed25519 or Ed448.
*/
extern const struct sx_pk_cmd_def *const SX_PK_CMD_EDDSA_SIGN;

/** EdDSA signature verification operation
*
* All operands for this command use a little endian representation.
* Operands should be decoded and clamped as defined in specifications
* for ED25519 or ED448.
* for Ed25519 or Ed448.
*/
extern const struct sx_pk_cmd_def *const SX_PK_CMD_EDDSA_VER;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ extern "C" {

#include "core.h"

/** Size in bytes of a reduced value in ED25519 operations */
/** Size in bytes of a reduced value in Ed25519 operations */
#define SX_ED25519_SZ 32

/** Size in bytes of an encoded ED25519 point */
/** Size in bytes of an encoded Ed25519 point */
#define SX_ED25519_PT_SZ 32

/** Size in bytes of a digest in ED25519 operations */
/** Size in bytes of a digest in Ed25519 operations */
#define SX_ED25519_DGST_SZ (32 * 2)

/**
Expand All @@ -28,25 +28,25 @@ extern "C" {
* @{
*/

/** An encoded ED25519 point */
/** An encoded Ed25519 point */
struct sx_ed25519_pt {
/** Bytes array representing encoded point for ED25519 **/
/** Bytes array representing encoded point for Ed25519 **/
char encoded[SX_ED25519_PT_SZ];
};

/** A ED25519 scalar value */
/** A Ed25519 scalar value */
struct sx_ed25519_v {
/** Bytes array representing scalar for ED25519 **/
/** Bytes array representing scalar for Ed25519 **/
char bytes[SX_ED25519_SZ];
};

/** A hash digest used in the ED25519 protocol */
/** A hash digest used in the Ed25519 protocol */
struct sx_ed25519_dgst {
/** Bytes array of hash digest **/
char bytes[SX_ED25519_DGST_SZ];
};

/** EdDSA point multiplication (ED25519)
/** EdDSA point multiplication (Ed25519)
*
* Compute R = r * G, where r is a scalar which can be up to twice the
* size of the other operands. G is the generator point for the curve.
Expand Down Expand Up @@ -75,7 +75,7 @@ struct sx_ed25519_dgst {
*/
int sx_ed25519_ptmult(const struct sx_ed25519_dgst *r, struct sx_ed25519_pt *pt);

/** Asynchronous EdDSA point multiplication (ED25519)
/** Asynchronous EdDSA point multiplication (Ed25519)
*
* Start an EdDSA point multiplication on the accelerator
* and return immediately.
Expand All @@ -91,7 +91,7 @@ int sx_ed25519_ptmult(const struct sx_ed25519_dgst *r, struct sx_ed25519_pt *pt)
*/
struct sx_pk_acq_req sx_async_ed25519_ptmult_go(const struct sx_ed25519_dgst *r);

/** Collect the result of asynchronous EdDSA point multiplication (ED25519)
/** Collect the result of asynchronous EdDSA point multiplication (Ed25519)
*
* Get the output operands of the EdDSA point multiplication
* and release the reserved resources.
Expand All @@ -107,7 +107,7 @@ struct sx_pk_acq_req sx_async_ed25519_ptmult_go(const struct sx_ed25519_dgst *r)
*/
void sx_async_ed25519_ptmult_end(sx_pk_req *req, struct sx_ed25519_pt *pt);

/** Compute signature scalar s for pure EdDSA (ED25519).
/** Compute signature scalar s for pure EdDSA (Ed25519).
*
* This represents the second step in computing an EdDSA signature.
*
Expand Down Expand Up @@ -136,9 +136,9 @@ void sx_async_ed25519_ptmult_end(sx_pk_req *req, struct sx_ed25519_pt *pt);
int sx_ed25519_sign(const struct sx_ed25519_dgst *k, const struct sx_ed25519_dgst *r,
const struct sx_ed25519_v *s, struct sx_ed25519_v *sig_s);

/** Asynchronous second part signature generation for pure EdDSA (ED25519).
/** Asynchronous second part signature generation for pure EdDSA (Ed25519).
*
* Start an ED25519 signature generation on the accelerator
* Start an Ed25519 signature generation on the accelerator
* and return immediately.
*
* @remark When the operation finishes on the accelerator,
Expand All @@ -157,23 +157,23 @@ struct sx_pk_acq_req sx_pk_async_ed25519_sign_go(const struct sx_ed25519_dgst *k
const struct sx_ed25519_dgst *r,
const struct sx_ed25519_v *s);

/** Collect the result of asynchronous computation of ED25519 signature scalar
/** Collect the result of asynchronous computation of Ed25519 signature scalar
*
* Get the output operands of the ED25519 signature generation
* Get the output operands of the Ed25519 signature generation
* and release the reserved resources.
*
* @pre The operation on the accelerator must be finished before
* calling this function.
*
* @param[in,out] req The previously acquired acceleration
* request for this operation
* @param[out] sig_s Second part of the ED25519 signature
* @param[out] sig_s Second part of the Ed25519 signature
*
* @see sx_pk_async_ed25519_sign_go() and sx_ed25519_sign()
*/
void sx_async_ed25519_sign_end(sx_pk_req *req, struct sx_ed25519_v *sig_s);

/** Verify an EdDSA signature (ED25519)
/** Verify an EdDSA signature (Ed25519)
*
* It checks if sig_s * G - k * A matches R.
*
Expand Down Expand Up @@ -205,9 +205,9 @@ void sx_async_ed25519_sign_end(sx_pk_req *req, struct sx_ed25519_v *sig_s);
int sx_ed25519_verify(const struct sx_ed25519_dgst *k, const struct sx_ed25519_pt *a,
const struct sx_ed25519_v *sig_s, const struct sx_ed25519_pt *r);

/** Asynchronous (non-blocking) verify an ED25519 signature.
/** Asynchronous (non-blocking) verify an Ed25519 signature.
*
* Start an ED25519 signature generation on the accelerator
* Start an Ed25519 signature generation on the accelerator
* and return immediately.
*
* @remark When the operation finishes on the accelerator,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** Simpler functions for base ED448 operations
/** Simpler functions for base Ed448 operations
*
* @file
*/
Expand All @@ -17,13 +17,13 @@ extern "C" {

#include "core.h"

/** Size in bytes of a reduced value in ED448 operations */
/** Size in bytes of a reduced value in Ed448 operations */
#define SX_ED448_SZ 57

/** Size in bytes of an encoded ED448 point */
/** Size in bytes of an encoded Ed448 point */
#define SX_ED448_PT_SZ 57

/** Size in bytes of a digest in ED448 operations */
/** Size in bytes of a digest in Ed448 operations */
#define SX_ED448_DGST_SZ (57 * 2)

/**
Expand All @@ -32,25 +32,25 @@ extern "C" {
* @{
*/

/** An encoded ED448 point */
/** An encoded Ed448 point */
struct sx_ed448_pt {
/** Bytes array representing encoded point for ED448 **/
/** Bytes array representing encoded point for Ed448 **/
char encoded[SX_ED448_PT_SZ];
};

/** A ED448 scalar value */
/** A Ed448 scalar value */
struct sx_ed448_v {
/** Bytes array representing scalar for ED448 **/
/** Bytes array representing scalar for Ed448 **/
char bytes[SX_ED448_SZ];
};

/** A hash digest used in the ED448 protocol */
/** A hash digest used in the Ed448 protocol */
struct sx_ed448_dgst {
/** Bytes array of hash digest **/
char bytes[SX_ED448_DGST_SZ];
};

/** EdDSA point multiplication (ED448)
/** EdDSA point multiplication (Ed448)
*
* Compute R = r * G, where r is a scalar which can be up to twice the
* size of the other operands. G is the generator point for the curve.
Expand Down Expand Up @@ -79,7 +79,7 @@ struct sx_ed448_dgst {
*/
int sx_ed448_ptmult(const struct sx_ed448_dgst *r, struct sx_ed448_pt *pt);

/** Asynchronous EdDSA point multiplication (ED448)
/** Asynchronous EdDSA point multiplication (Ed448)
*
* Start an EdDSA point multiplication on the accelerator
* and return immediately.
Expand All @@ -95,7 +95,7 @@ int sx_ed448_ptmult(const struct sx_ed448_dgst *r, struct sx_ed448_pt *pt);
*/
struct sx_pk_acq_req sx_async_ed448_ptmult_go(const struct sx_ed448_dgst *r);

/** Collect the result of asynchronous EdDSA point multiplication (ED448)
/** Collect the result of asynchronous EdDSA point multiplication (Ed448)
*
* Get the output operands of the EdDSA point multiplication
* and release the reserved resources.
Expand All @@ -111,7 +111,7 @@ struct sx_pk_acq_req sx_async_ed448_ptmult_go(const struct sx_ed448_dgst *r);
*/
void sx_async_ed448_ptmult_end(sx_pk_req *req, struct sx_ed448_pt *pt);

/** Compute signature scalar s for pure EdDSA (ED448).
/** Compute signature scalar s for pure EdDSA (Ed448).
*
* This represents the second step in computing an EdDSA signature.
*
Expand Down Expand Up @@ -140,9 +140,9 @@ void sx_async_ed448_ptmult_end(sx_pk_req *req, struct sx_ed448_pt *pt);
int sx_ed448_sign(const struct sx_ed448_dgst *k, const struct sx_ed448_dgst *r,
const struct sx_ed448_v *s, struct sx_ed448_v *sig_s);

/** Asynchronous second part signature generation for pure EdDSA (ED448).
/** Asynchronous second part signature generation for pure EdDSA (Ed448).
*
* Start an ED448 signature generation on the accelerator
* Start an Ed448 signature generation on the accelerator
* and return immediately.
*
* @remark When the operation finishes on the accelerator,
Expand All @@ -161,23 +161,23 @@ struct sx_pk_acq_req sx_pk_async_ed448_sign_go(const struct sx_ed448_dgst *k,
const struct sx_ed448_dgst *r,
const struct sx_ed448_v *s);

/** Collect the result of asynchronous computation of ED448 signature scalar
/** Collect the result of asynchronous computation of Ed448 signature scalar
*
* Get the output operands of the ED448 signature generation
* Get the output operands of the Ed448 signature generation
* and release the reserved resources.
*
* @pre The operation on the accelerator must be finished before
* calling this function.
*
* @param[in,out] req The previously acquired acceleration
* request for this operation
* @param[out] sig_s Second part of the ED448 signature
* @param[out] sig_s Second part of the Ed448 signature
*
* @see sx_pk_async_ed448_sign_go() and sx_ed448_sign()
*/
void sx_async_ed448_sign_end(sx_pk_req *req, struct sx_ed448_v *sig_s);

/** Verify an EdDSA signature (ED448)
/** Verify an EdDSA signature (Ed448)
*
* It checks if sig_s * G - k * A matches R.
*
Expand Down Expand Up @@ -209,9 +209,9 @@ void sx_async_ed448_sign_end(sx_pk_req *req, struct sx_ed448_v *sig_s);
int sx_ed448_verify(const struct sx_ed448_dgst *k, const struct sx_ed448_pt *a,
const struct sx_ed448_v *sig_s, const struct sx_ed448_pt *r);

/** Asynchronous (non-blocking) verify an ED448 signature.
/** Asynchronous (non-blocking) verify an Ed448 signature.
*
* Start an ED448 signature generation on the accelerator
* Start an Ed448 signature generation on the accelerator
* and return immediately.
*
* @remark When the operation finishes on the accelerator,
Expand Down
6 changes: 3 additions & 3 deletions subsys/nrf_security/src/drivers/cracen/silexpk/src/ed25519.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
#include <silexpk/cmddefs/edwards.h>
#include <string.h>

/** Write a ED25519 digest into a pair of operand slots.
/** Write a Ed25519 digest into a pair of operand slots.
*
* A ED25519 digest has twice as many bytes as the normal operand size.
* A Ed25519 digest has twice as many bytes as the normal operand size.
*
* \param op The digest bytes to write into the operand slot.
* \param slots The pair of slots to write the operand into.
Expand Down Expand Up @@ -134,7 +134,7 @@ static inline int ed25519_decode_pt_x(const struct sx_ed25519_pt *pt)
return (pt->encoded[SX_ED25519_PT_SZ - 1] >> 7) & 1;
}

/** Write the y affine coordinate of an encoded ED25519 point into memory */
/** Write the y affine coordinate of an encoded Ed25519 point into memory */
static inline void ed25519_pt_write_y(const struct sx_ed25519_pt *pt, char *ay)
{
sx_wrpkmem(ay, pt->encoded, SX_ED25519_PT_SZ);
Expand Down
6 changes: 3 additions & 3 deletions subsys/nrf_security/src/drivers/cracen/silexpk/src/ed448.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
#include <silexpk/iomem.h>
#include <silexpk/cmddefs/edwards.h>

/** Write a ED448 digest into a pair of operand slots.
/** Write a Ed448 digest into a pair of operand slots.
*
* A ED448 digest has twice as many bytes as the normal operand size.
* A Ed448 digest has twice as many bytes as the normal operand size.
*
* \param op The digest bytes to write into the operand slot.
* \param slots The pair of slots to write the operand into.
Expand Down Expand Up @@ -133,7 +133,7 @@ static inline int ed448_decode_pt_x(const struct sx_ed448_pt *pt)
return (pt->encoded[SX_ED448_PT_SZ - 1] >> 7) & 1;
}

/** Write the y affine coordinate of an encoded ED448 point into memory */
/** Write the y affine coordinate of an encoded Ed448 point into memory */
static inline void ed448_pt_write_y(const struct sx_ed448_pt *pt, char *ay)
{
sx_wrpkmem(ay, pt->encoded, SX_ED448_PT_SZ - 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ extern const struct sxhashalg sxhashalg_sha3_384;
/** Hash algorithm SHA-3 512*/
extern const struct sxhashalg sxhashalg_sha3_512;

/** Hash algorithm SHAKE256, with output size fixed to 114 bytes (for ED448). */
/** Hash algorithm SHAKE256, with output size fixed to 114 bytes (for Ed448). */
extern const struct sxhashalg sxhashalg_shake256_114;

/** Creates a SHA3-224 hash operation context
Expand Down

0 comments on commit 8144355

Please sign in to comment.