| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Functions
curve25519.h File Reference
`#include <wireshark.h>`

Go to the source code of this file.

## Functions
WS_DLL_PUBLIC int | crypto_scalarmult_curve25519 (unsigned char *q, const unsigned char *n, const unsigned char *p)
| Perform scalar multiplication on Curve25519 to compute a shared secret.
WS_DLL_PUBLIC int | crypto_scalarmult_curve25519_base (unsigned char *q, const unsigned char *n)
| Compute the Curve25519 public key from a secret scalar.

## Detailed Description

NaCl/Sodium-compatible API for Curve25519 cryptography.

Copyright (c) 2018, Peter Wu peter.nosp@m.@lek.nosp@m.enste.nosp@m.yn.n.nosp@m.l

Wireshark - Network traffic analyzer By Gerald Combs geral.nosp@m.d@wi.nosp@m.resha.nosp@m.rk.o.nosp@m.rg Copyright 1998 Gerald Combs

SPDX-License-Identifier: GPL-2.0-or-later

## Function Documentation

## ◆ crypto_scalarmult_curve25519()

WS_DLL_PUBLIC int crypto_scalarmult_curve25519 | ( | unsigned char * | q,
|  | const unsigned char * | n,
|  | const unsigned char * | p
| ) |  |

Perform scalar multiplication on Curve25519 to compute a shared secret.

Computes the shared secret `Q = X25519(n, P)` using the Curve25519 elliptic curve. Both inputs and the output are 32-byte values.

This function adheres to the X25519 specification and ensures constant-time execution for cryptographic safety. It returns 0 on success and -1 on failure, such as when the input scalar is invalid or the computation fails internally.

Parameters

  q | Output buffer for the computed shared secret (32 bytes).
  n | Input scalar (secret key, 32 bytes).
  p | Input point (public key, 32 bytes).

Returns
  0 on success, -1 on failure.

## ◆ crypto_scalarmult_curve25519_base()

WS_DLL_PUBLIC int crypto_scalarmult_curve25519_base | ( | unsigned char * | q,
|  | const unsigned char * | n
| ) |  |

Compute the Curve25519 public key from a secret scalar.

Calculates the public key `Q = X25519(n, base_point)` using the Curve25519 elliptic curve. This function multiplies the 32-byte secret scalar `n` by the standard base point to produce the corresponding public key `q`.

Parameters

  q | Output buffer for the public key (32 bytes).
  n | Input secret scalar (private key, 32 bytes).

Returns
  0 on success, -1 on failure.