Contiki-NG
Toggle main menu visibility
Loading...
Searching...
No Matches
ecc-curve.h
Go to the documentation of this file.
1
/*
2
* Original file:
3
* Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
4
* All rights reserved.
5
*
6
* Port to Contiki:
7
* Copyright (c) 2014 Andreas Dröscher <contiki@anticat.ch>
8
*
9
* Redistribution and use in source and binary forms, with or without
10
* modification, are permitted provided that the following conditions
11
* are met:
12
* 1. Redistributions of source code must retain the above copyright
13
* notice, this list of conditions and the following disclaimer.
14
* 2. Redistributions in binary form must reproduce the above copyright
15
* notice, this list of conditions and the following disclaimer in the
16
* documentation and/or other materials provided with the distribution.
17
*
18
* 3. Neither the name of the copyright holder nor the names of its
19
* contributors may be used to endorse or promote products derived
20
* from this software without specific prior written permission.
21
*
22
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
33
* OF THE POSSIBILITY OF SUCH DAMAGE.
34
*/
35
36
/**
37
* \addtogroup crypto
38
* @{
39
*
40
* \file
41
* NIST curves for various key sizes.
42
* \author
43
* Konrad Krentz <konrad.krentz@gmail.com>
44
*/
45
46
#ifndef ECC_CURVE_H_
47
#define ECC_CURVE_H_
48
49
#include <stddef.h>
50
#include <stdint.h>
51
52
/** Parameters of an ECC curve in little-endian word order. */
53
typedef
struct
{
54
/** Name of the curve. */
55
const
char
*
name
;
56
57
/** Size of the curve in 32-bit words. */
58
const
size_t
words
;
59
60
/** Size of the curve in bytes. */
61
const
size_t
bytes
;
62
63
/** The prime that defines the field of the curve. */
64
const
uint32_t *
p
;
65
66
/** Precomputed value of p + 1. */
67
const
uint32_t *
p_plus_one
;
68
69
/** Length of the binary representation of p + 1. */
70
const
size_t
binary_length_of_p_plus_one
;
71
72
/** Order of the curve. */
73
const
uint32_t *
n
;
74
75
/** Length of the binary representation of n. */
76
const
size_t
binary_length_of_n
;
77
78
/** Coefficient a of the equation. */
79
const
uint32_t *
a
;
80
81
/** Coefficient b of the equation. */
82
const
uint32_t *
b
;
83
84
/** x coordinate of the generator point. */
85
const
uint32_t *
x
;
86
87
/** y coordinate of the generator point. */
88
const
uint32_t *
y
;
89
}
ecc_curve_t
;
90
91
/*
92
* NIST P-256, X9.62 prime256v1, secp256r1
93
*/
94
extern
ecc_curve_t
ecc_curve_p_256;
95
#define ECC_CURVE_P_256_SIZE (32)
96
97
/*
98
* NIST P-192, X9.62 prime192v1
99
*/
100
extern
ecc_curve_t
ecc_curve_p_192;
101
#define ECC_CURVE_P_192_SIZE (24)
102
103
#endif
/* ECC_CURVE_H_ */
104
105
/**
106
* @}
107
*/
ecc_curve_t
Parameters of an ECC curve in little-endian word order.
Definition
ecc-curve.h:53
ecc_curve_t::words
const size_t words
Size of the curve in 32-bit words.
Definition
ecc-curve.h:58
ecc_curve_t::b
const uint32_t * b
Coefficient b of the equation.
Definition
ecc-curve.h:82
ecc_curve_t::binary_length_of_p_plus_one
const size_t binary_length_of_p_plus_one
Length of the binary representation of p + 1.
Definition
ecc-curve.h:70
ecc_curve_t::x
const uint32_t * x
x coordinate of the generator point.
Definition
ecc-curve.h:85
ecc_curve_t::p
const uint32_t * p
The prime that defines the field of the curve.
Definition
ecc-curve.h:64
ecc_curve_t::y
const uint32_t * y
y coordinate of the generator point.
Definition
ecc-curve.h:88
ecc_curve_t::binary_length_of_n
const size_t binary_length_of_n
Length of the binary representation of n.
Definition
ecc-curve.h:76
ecc_curve_t::name
const char * name
Name of the curve.
Definition
ecc-curve.h:55
ecc_curve_t::n
const uint32_t * n
Order of the curve.
Definition
ecc-curve.h:73
ecc_curve_t::bytes
const size_t bytes
Size of the curve in bytes.
Definition
ecc-curve.h:61
ecc_curve_t::a
const uint32_t * a
Coefficient a of the equation.
Definition
ecc-curve.h:79
ecc_curve_t::p_plus_one
const uint32_t * p_plus_one
Precomputed value of p + 1.
Definition
ecc-curve.h:67
os
lib
ecc-curve.h
Generated on
for Contiki-NG by
1.17.0