Welcome to mirror list, hosted at ThFree Co, Russian Federation.

fe25519.h « internals « Common_ed25519_c25519 « Inc « cryptographic « ble « STM32_WPAN « ST « Middlewares - github.com/Flipper-Zero/STM32CubeWB.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 46ad2b1143be6504e719fab8fb6b40cf14610acc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/**
  ******************************************************************************
  * @file    fe25519.h
  * @author  MCD Application Team
  * @brief   fe25519 header file
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; Copyright (c) 2015 STMicroelectronics.
  * All rights reserved.</center></h2>
  *
  * This software component is licensed by ST under Image license SLA0044,
  * the "License"; You may not use this file except in compliance with the
  * License. You may obtain a copy of the License at:
  *                        http://www.st.com/SLA0044
  *
  ******************************************************************************
  */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __FE25519_H__
#define __FE25519_H__

#ifdef __cplusplus
extern "C" {
#endif

/** @addtogroup FE25519 fe25519
* @brief Arithmetic in GF(2^255-19)
* @{
  */

/* Includes ------------------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/

typedef struct
{
  uint32_t v[8]; /*!< uint32_t array representing the number in low endian format */
} fe25519; /*!< Representation of a number in GF(2^255-19) */

/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */

void fe25519_freeze(fe25519 *r);

void fe25519_unpack(fe25519 *r, const uint8_t x[32]);

void fe25519_pack(uint8_t r[32], const fe25519 *x);

int32_t fe25519_iszero(const fe25519 *x);

int32_t fe25519_iseq_vartime(const fe25519 *x, const fe25519 *y);

void fe25519_cmov(fe25519 *r, const fe25519 *x, uint8_t b);

void fe25519_copy(fe25519 *r, const fe25519 *x);

void fe25519_setone(fe25519 *r);

void fe25519_setzero(fe25519 *r);

void fe25519_neg(fe25519 *r, const fe25519 *x);

uint8_t fe25519_getparity(const fe25519 *x);

void fe25519_add(fe25519 *r, const fe25519 *x, const fe25519 *y);

void fe25519_sub(fe25519 *r, const fe25519 *x, const fe25519 *y);

void fe25519_mul(fe25519 *r, const fe25519 *x, const fe25519 *y);

void fe25519_square(fe25519 *r, const fe25519 *x);

void fe25519_invert(fe25519 *r, const fe25519 *x);

void fe25519_pow2523(fe25519 *r, const fe25519 *x);

void fe25519_mult121665(fe25519 *r, const fe25519 *x);

/**
* @} fe25519
*/

#ifdef __cplusplus
}
#endif

#endif /* __FE25519_H__ */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/