mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-25 01:02:24 +00:00
Add missing consts in elliptic curve setup code.
All those static arrays giving the curves' constants ought to be 'static const' and go in the data segment, of course.
This commit is contained in:
parent
5fc4bbf59d
commit
71cf6454d5
74
sshecc.c
74
sshecc.c
@ -38,10 +38,10 @@
|
||||
*/
|
||||
|
||||
static void initialise_wcurve(struct ec_curve *curve, int bits,
|
||||
unsigned char *p,
|
||||
unsigned char *a, unsigned char *b,
|
||||
unsigned char *n, unsigned char *Gx,
|
||||
unsigned char *Gy)
|
||||
const unsigned char *p,
|
||||
const unsigned char *a, const unsigned char *b,
|
||||
const unsigned char *n, const unsigned char *Gx,
|
||||
const unsigned char *Gy)
|
||||
{
|
||||
int length = bits / 8;
|
||||
if (bits % 8) ++length;
|
||||
@ -64,9 +64,9 @@ static void initialise_wcurve(struct ec_curve *curve, int bits,
|
||||
}
|
||||
|
||||
static void initialise_mcurve(struct ec_curve *curve, int bits,
|
||||
unsigned char *p,
|
||||
unsigned char *a, unsigned char *b,
|
||||
unsigned char *Gx)
|
||||
const unsigned char *p,
|
||||
const unsigned char *a, const unsigned char *b,
|
||||
const unsigned char *Gx)
|
||||
{
|
||||
int length = bits / 8;
|
||||
if (bits % 8) ++length;
|
||||
@ -89,9 +89,9 @@ static void initialise_mcurve(struct ec_curve *curve, int bits,
|
||||
}
|
||||
|
||||
static void initialise_ecurve(struct ec_curve *curve, int bits,
|
||||
unsigned char *p,
|
||||
unsigned char *l, unsigned char *d,
|
||||
unsigned char *Bx, unsigned char *By)
|
||||
const unsigned char *p,
|
||||
const unsigned char *l, const unsigned char *d,
|
||||
const unsigned char *Bx, const unsigned char *By)
|
||||
{
|
||||
int length = bits / 8;
|
||||
if (bits % 8) ++length;
|
||||
@ -119,37 +119,37 @@ static struct ec_curve *ec_p256(void)
|
||||
|
||||
if (!initialised)
|
||||
{
|
||||
unsigned char p[] = {
|
||||
static const unsigned char p[] = {
|
||||
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
|
||||
};
|
||||
unsigned char a[] = {
|
||||
static const unsigned char a[] = {
|
||||
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc
|
||||
};
|
||||
unsigned char b[] = {
|
||||
static const unsigned char b[] = {
|
||||
0x5a, 0xc6, 0x35, 0xd8, 0xaa, 0x3a, 0x93, 0xe7,
|
||||
0xb3, 0xeb, 0xbd, 0x55, 0x76, 0x98, 0x86, 0xbc,
|
||||
0x65, 0x1d, 0x06, 0xb0, 0xcc, 0x53, 0xb0, 0xf6,
|
||||
0x3b, 0xce, 0x3c, 0x3e, 0x27, 0xd2, 0x60, 0x4b
|
||||
};
|
||||
unsigned char n[] = {
|
||||
static const unsigned char n[] = {
|
||||
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xbc, 0xe6, 0xfa, 0xad, 0xa7, 0x17, 0x9e, 0x84,
|
||||
0xf3, 0xb9, 0xca, 0xc2, 0xfc, 0x63, 0x25, 0x51
|
||||
};
|
||||
unsigned char Gx[] = {
|
||||
static const unsigned char Gx[] = {
|
||||
0x6b, 0x17, 0xd1, 0xf2, 0xe1, 0x2c, 0x42, 0x47,
|
||||
0xf8, 0xbc, 0xe6, 0xe5, 0x63, 0xa4, 0x40, 0xf2,
|
||||
0x77, 0x03, 0x7d, 0x81, 0x2d, 0xeb, 0x33, 0xa0,
|
||||
0xf4, 0xa1, 0x39, 0x45, 0xd8, 0x98, 0xc2, 0x96
|
||||
};
|
||||
unsigned char Gy[] = {
|
||||
static const unsigned char Gy[] = {
|
||||
0x4f, 0xe3, 0x42, 0xe2, 0xfe, 0x1a, 0x7f, 0x9b,
|
||||
0x8e, 0xe7, 0xeb, 0x4a, 0x7c, 0x0f, 0x9e, 0x16,
|
||||
0x2b, 0xce, 0x33, 0x57, 0x6b, 0x31, 0x5e, 0xce,
|
||||
@ -173,7 +173,7 @@ static struct ec_curve *ec_p384(void)
|
||||
|
||||
if (!initialised)
|
||||
{
|
||||
unsigned char p[] = {
|
||||
static const unsigned char p[] = {
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
@ -181,7 +181,7 @@ static struct ec_curve *ec_p384(void)
|
||||
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
|
||||
};
|
||||
unsigned char a[] = {
|
||||
static const unsigned char a[] = {
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
@ -189,7 +189,7 @@ static struct ec_curve *ec_p384(void)
|
||||
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xfc
|
||||
};
|
||||
unsigned char b[] = {
|
||||
static const unsigned char b[] = {
|
||||
0xb3, 0x31, 0x2f, 0xa7, 0xe2, 0x3e, 0xe7, 0xe4,
|
||||
0x98, 0x8e, 0x05, 0x6b, 0xe3, 0xf8, 0x2d, 0x19,
|
||||
0x18, 0x1d, 0x9c, 0x6e, 0xfe, 0x81, 0x41, 0x12,
|
||||
@ -197,7 +197,7 @@ static struct ec_curve *ec_p384(void)
|
||||
0xc6, 0x56, 0x39, 0x8d, 0x8a, 0x2e, 0xd1, 0x9d,
|
||||
0x2a, 0x85, 0xc8, 0xed, 0xd3, 0xec, 0x2a, 0xef
|
||||
};
|
||||
unsigned char n[] = {
|
||||
static const unsigned char n[] = {
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
@ -205,7 +205,7 @@ static struct ec_curve *ec_p384(void)
|
||||
0x58, 0x1a, 0x0d, 0xb2, 0x48, 0xb0, 0xa7, 0x7a,
|
||||
0xec, 0xec, 0x19, 0x6a, 0xcc, 0xc5, 0x29, 0x73
|
||||
};
|
||||
unsigned char Gx[] = {
|
||||
static const unsigned char Gx[] = {
|
||||
0xaa, 0x87, 0xca, 0x22, 0xbe, 0x8b, 0x05, 0x37,
|
||||
0x8e, 0xb1, 0xc7, 0x1e, 0xf3, 0x20, 0xad, 0x74,
|
||||
0x6e, 0x1d, 0x3b, 0x62, 0x8b, 0xa7, 0x9b, 0x98,
|
||||
@ -213,7 +213,7 @@ static struct ec_curve *ec_p384(void)
|
||||
0x55, 0x02, 0xf2, 0x5d, 0xbf, 0x55, 0x29, 0x6c,
|
||||
0x3a, 0x54, 0x5e, 0x38, 0x72, 0x76, 0x0a, 0xb7
|
||||
};
|
||||
unsigned char Gy[] = {
|
||||
static const unsigned char Gy[] = {
|
||||
0x36, 0x17, 0xde, 0x4a, 0x96, 0x26, 0x2c, 0x6f,
|
||||
0x5d, 0x9e, 0x98, 0xbf, 0x92, 0x92, 0xdc, 0x29,
|
||||
0xf8, 0xf4, 0x1d, 0xbd, 0x28, 0x9a, 0x14, 0x7c,
|
||||
@ -239,7 +239,7 @@ static struct ec_curve *ec_p521(void)
|
||||
|
||||
if (!initialised)
|
||||
{
|
||||
unsigned char p[] = {
|
||||
static const unsigned char p[] = {
|
||||
0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
@ -250,7 +250,7 @@ static struct ec_curve *ec_p521(void)
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff
|
||||
};
|
||||
unsigned char a[] = {
|
||||
static const unsigned char a[] = {
|
||||
0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
@ -261,7 +261,7 @@ static struct ec_curve *ec_p521(void)
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xfc
|
||||
};
|
||||
unsigned char b[] = {
|
||||
static const unsigned char b[] = {
|
||||
0x00, 0x51, 0x95, 0x3e, 0xb9, 0x61, 0x8e, 0x1c,
|
||||
0x9a, 0x1f, 0x92, 0x9a, 0x21, 0xa0, 0xb6, 0x85,
|
||||
0x40, 0xee, 0xa2, 0xda, 0x72, 0x5b, 0x99, 0xb3,
|
||||
@ -272,7 +272,7 @@ static struct ec_curve *ec_p521(void)
|
||||
0x34, 0xf1, 0xef, 0x45, 0x1f, 0xd4, 0x6b, 0x50,
|
||||
0x3f, 0x00
|
||||
};
|
||||
unsigned char n[] = {
|
||||
static const unsigned char n[] = {
|
||||
0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
@ -283,7 +283,7 @@ static struct ec_curve *ec_p521(void)
|
||||
0x47, 0xae, 0xbb, 0x6f, 0xb7, 0x1e, 0x91, 0x38,
|
||||
0x64, 0x09
|
||||
};
|
||||
unsigned char Gx[] = {
|
||||
static const unsigned char Gx[] = {
|
||||
0x00, 0xc6, 0x85, 0x8e, 0x06, 0xb7, 0x04, 0x04,
|
||||
0xe9, 0xcd, 0x9e, 0x3e, 0xcb, 0x66, 0x23, 0x95,
|
||||
0xb4, 0x42, 0x9c, 0x64, 0x81, 0x39, 0x05, 0x3f,
|
||||
@ -294,7 +294,7 @@ static struct ec_curve *ec_p521(void)
|
||||
0x42, 0x9b, 0xf9, 0x7e, 0x7e, 0x31, 0xc2, 0xe5,
|
||||
0xbd, 0x66
|
||||
};
|
||||
unsigned char Gy[] = {
|
||||
static const unsigned char Gy[] = {
|
||||
0x01, 0x18, 0x39, 0x29, 0x6a, 0x78, 0x9a, 0x3b,
|
||||
0xc0, 0x04, 0x5c, 0x8a, 0x5f, 0xb4, 0x2c, 0x7d,
|
||||
0x1b, 0xd9, 0x98, 0xf5, 0x44, 0x49, 0x57, 0x9b,
|
||||
@ -323,25 +323,25 @@ static struct ec_curve *ec_curve25519(void)
|
||||
|
||||
if (!initialised)
|
||||
{
|
||||
unsigned char p[] = {
|
||||
static const unsigned char p[] = {
|
||||
0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xed
|
||||
};
|
||||
unsigned char a[] = {
|
||||
static const unsigned char a[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x6d, 0x06
|
||||
};
|
||||
unsigned char b[] = {
|
||||
static const unsigned char b[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01
|
||||
};
|
||||
unsigned char gx[32] = {
|
||||
static const unsigned char gx[32] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
@ -367,31 +367,31 @@ static struct ec_curve *ec_ed25519(void)
|
||||
|
||||
if (!initialised)
|
||||
{
|
||||
unsigned char q[] = {
|
||||
static const unsigned char q[] = {
|
||||
0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xed
|
||||
};
|
||||
unsigned char l[32] = {
|
||||
static const unsigned char l[32] = {
|
||||
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x14, 0xde, 0xf9, 0xde, 0xa2, 0xf7, 0x9c, 0xd6,
|
||||
0x58, 0x12, 0x63, 0x1a, 0x5c, 0xf5, 0xd3, 0xed
|
||||
};
|
||||
unsigned char d[32] = {
|
||||
static const unsigned char d[32] = {
|
||||
0x52, 0x03, 0x6c, 0xee, 0x2b, 0x6f, 0xfe, 0x73,
|
||||
0x8c, 0xc7, 0x40, 0x79, 0x77, 0x79, 0xe8, 0x98,
|
||||
0x00, 0x70, 0x0a, 0x4d, 0x41, 0x41, 0xd8, 0xab,
|
||||
0x75, 0xeb, 0x4d, 0xca, 0x13, 0x59, 0x78, 0xa3
|
||||
};
|
||||
unsigned char Bx[32] = {
|
||||
static const unsigned char Bx[32] = {
|
||||
0x21, 0x69, 0x36, 0xd3, 0xcd, 0x6e, 0x53, 0xfe,
|
||||
0xc0, 0xa4, 0xe2, 0x31, 0xfd, 0xd6, 0xdc, 0x5c,
|
||||
0x69, 0x2c, 0xc7, 0x60, 0x95, 0x25, 0xa7, 0xb2,
|
||||
0xc9, 0x56, 0x2d, 0x60, 0x8f, 0x25, 0xd5, 0x1a
|
||||
};
|
||||
unsigned char By[32] = {
|
||||
static const unsigned char By[32] = {
|
||||
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
|
||||
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
|
||||
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
|
||||
|
Loading…
Reference in New Issue
Block a user