Mercurial > dropbear
annotate ecdsa.h @ 1631:292f79307600
fix some gcc warnings (#73)
* tweak string size
fix gcc8 warnings
```
svr-agentfwd.c: In function 'bindagent':
svr-agentfwd.c:254:53: warning: '%s' directive output may be truncated writing up to 107 bytes into a region of size between 0 and 107 [-Wformat-truncation=]
snprintf(addr.sun_path, sizeof(addr.sun_path), "%s/%s", path, sockfile);
^~ ~~~~~~~~
svr-agentfwd.c:254:2: note: 'snprintf' output between 2 and 216 bytes into a destination of size 108
snprintf(addr.sun_path, sizeof(addr.sun_path), "%s/%s", path, sockfile);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
* cleanup signed/unsigned comparison
fix gcc8 warnings
```
scp.c: In function 'do_local_cmd':
scp.c:132:17: warning: comparison of integer expressions of different signedness: 'u_int' {aka 'unsigned int'} and 'int' [-Wsign-compare]
for (i = 0; i < a->num; i++)
^
scpmisc.c: In function 'addargs':
scpmisc.c:161:25: warning: comparison of integer expressions of different signedness: 'int' and 'u_int' {aka 'unsigned int'} [-Wsign-compare]
} else if (args->num+2 >= nalloc)
^~
scpmisc.c: In function 'replacearg':
scpmisc.c:183:12: warning: comparison of integer expressions of different signedness: 'u_int' {aka 'unsigned int'} and 'int' [-Wsign-compare]
if (which >= args->num)
^~
scpmisc.c: In function 'freeargs':
scpmisc.c:196:17: warning: comparison of integer expressions of different signedness: 'u_int' {aka 'unsigned int'} and 'int' [-Wsign-compare]
for (i = 0; i < args->num; i++)
^
```
see https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/misc.h.diff?r1=1.16&r2=1.17
author | François Perrad <francois.perrad@gadz.org> |
---|---|
date | Wed, 20 Mar 2019 15:25:15 +0100 |
parents | 99ca393afc56 |
children |
rev | line source |
---|---|
1036
deed0571cacc
DROPBEAR_ prefix for include guards to avoid collisions
Thorsten Horstmann <thorsten.horstmann@web.de>
parents:
857
diff
changeset
|
1 #ifndef DROPBEAR_ECDSA_H_ |
deed0571cacc
DROPBEAR_ prefix for include guards to avoid collisions
Thorsten Horstmann <thorsten.horstmann@web.de>
parents:
857
diff
changeset
|
2 #define DROPBEAR_ECDSA_H_ |
793
70625eed40c9
A bit of work on ecdsa for host/auth keys
Matt Johnston <matt@ucc.asn.au>
parents:
766
diff
changeset
|
3 |
70625eed40c9
A bit of work on ecdsa for host/auth keys
Matt Johnston <matt@ucc.asn.au>
parents:
766
diff
changeset
|
4 #include "includes.h" |
70625eed40c9
A bit of work on ecdsa for host/auth keys
Matt Johnston <matt@ucc.asn.au>
parents:
766
diff
changeset
|
5 #include "buffer.h" |
795 | 6 #include "signkey.h" |
793
70625eed40c9
A bit of work on ecdsa for host/auth keys
Matt Johnston <matt@ucc.asn.au>
parents:
766
diff
changeset
|
7 |
1295
750ec4ec4cbe
Convert #ifdef to #if, other build changes
Matt Johnston <matt@ucc.asn.au>
parents:
1036
diff
changeset
|
8 #if DROPBEAR_ECDSA |
797
45f1bc96f357
Fix build for dropbearkey and ecdsa with certain options
Matt Johnston <matt@ucc.asn.au>
parents:
795
diff
changeset
|
9 |
1543
016b86f03e21
Change default ecdsa size to 256
Matt Johnston <matt@ucc.asn.au>
parents:
1459
diff
changeset
|
10 /* prefer 256 or 384 since those are SHOULD for |
016b86f03e21
Change default ecdsa size to 256
Matt Johnston <matt@ucc.asn.au>
parents:
1459
diff
changeset
|
11 draft-ietf-curdle-ssh-kex-sha2.txt */ |
016b86f03e21
Change default ecdsa size to 256
Matt Johnston <matt@ucc.asn.au>
parents:
1459
diff
changeset
|
12 #if DROPBEAR_ECC_256 |
016b86f03e21
Change default ecdsa size to 256
Matt Johnston <matt@ucc.asn.au>
parents:
1459
diff
changeset
|
13 #define ECDSA_DEFAULT_SIZE 256 |
1295
750ec4ec4cbe
Convert #ifdef to #if, other build changes
Matt Johnston <matt@ucc.asn.au>
parents:
1036
diff
changeset
|
14 #elif DROPBEAR_ECC_384 |
840
5128e525c8fa
Default to some larger key sizes
Matt Johnston <matt@ucc.asn.au>
parents:
797
diff
changeset
|
15 #define ECDSA_DEFAULT_SIZE 384 |
1543
016b86f03e21
Change default ecdsa size to 256
Matt Johnston <matt@ucc.asn.au>
parents:
1459
diff
changeset
|
16 #elif DROPBEAR_ECC_521 |
016b86f03e21
Change default ecdsa size to 256
Matt Johnston <matt@ucc.asn.au>
parents:
1459
diff
changeset
|
17 #define ECDSA_DEFAULT_SIZE 521 |
794
d386defb5376
more ecdsa signkey work, not correct
Matt Johnston <matt@ucc.asn.au>
parents:
793
diff
changeset
|
18 #else |
1604
99ca393afc56
It turns out you can't have a single-quote in an #error
Matt Johnston <matt@ucc.asn.au>
parents:
1602
diff
changeset
|
19 #error ECDSA cannot be enabled without enabling at least one size (256, 384, 521) |
794
d386defb5376
more ecdsa signkey work, not correct
Matt Johnston <matt@ucc.asn.au>
parents:
793
diff
changeset
|
20 #endif |
d386defb5376
more ecdsa signkey work, not correct
Matt Johnston <matt@ucc.asn.au>
parents:
793
diff
changeset
|
21 |
793
70625eed40c9
A bit of work on ecdsa for host/auth keys
Matt Johnston <matt@ucc.asn.au>
parents:
766
diff
changeset
|
22 ecc_key *gen_ecdsa_priv_key(unsigned int bit_size); |
70625eed40c9
A bit of work on ecdsa for host/auth keys
Matt Johnston <matt@ucc.asn.au>
parents:
766
diff
changeset
|
23 ecc_key *buf_get_ecdsa_pub_key(buffer* buf); |
70625eed40c9
A bit of work on ecdsa for host/auth keys
Matt Johnston <matt@ucc.asn.au>
parents:
766
diff
changeset
|
24 ecc_key *buf_get_ecdsa_priv_key(buffer *buf); |
70625eed40c9
A bit of work on ecdsa for host/auth keys
Matt Johnston <matt@ucc.asn.au>
parents:
766
diff
changeset
|
25 void buf_put_ecdsa_pub_key(buffer *buf, ecc_key *key); |
70625eed40c9
A bit of work on ecdsa for host/auth keys
Matt Johnston <matt@ucc.asn.au>
parents:
766
diff
changeset
|
26 void buf_put_ecdsa_priv_key(buffer *buf, ecc_key *key); |
1459
06d52bcb8094
Pointer parameter could be declared as pointing to const
Francois Perrad <francois.perrad@gadz.org>
parents:
1295
diff
changeset
|
27 enum signkey_type ecdsa_signkey_type(const ecc_key * key); |
793
70625eed40c9
A bit of work on ecdsa for host/auth keys
Matt Johnston <matt@ucc.asn.au>
parents:
766
diff
changeset
|
28 |
1459
06d52bcb8094
Pointer parameter could be declared as pointing to const
Francois Perrad <francois.perrad@gadz.org>
parents:
1295
diff
changeset
|
29 void buf_put_ecdsa_sign(buffer *buf, const ecc_key *key, const buffer *data_buf); |
06d52bcb8094
Pointer parameter could be declared as pointing to const
Francois Perrad <francois.perrad@gadz.org>
parents:
1295
diff
changeset
|
30 int buf_ecdsa_verify(buffer *buf, const ecc_key *key, const buffer *data_buf); |
846
b298bb438625
refactor key generation, make it generate as required.
Matt Johnston <matt@ucc.asn.au>
parents:
845
diff
changeset
|
31 /* Returns 1 on success */ |
b298bb438625
refactor key generation, make it generate as required.
Matt Johnston <matt@ucc.asn.au>
parents:
845
diff
changeset
|
32 int signkey_is_ecdsa(enum signkey_type type); |
793
70625eed40c9
A bit of work on ecdsa for host/auth keys
Matt Johnston <matt@ucc.asn.au>
parents:
766
diff
changeset
|
33 |
797
45f1bc96f357
Fix build for dropbearkey and ecdsa with certain options
Matt Johnston <matt@ucc.asn.au>
parents:
795
diff
changeset
|
34 #endif |
45f1bc96f357
Fix build for dropbearkey and ecdsa with certain options
Matt Johnston <matt@ucc.asn.au>
parents:
795
diff
changeset
|
35 |
1036
deed0571cacc
DROPBEAR_ prefix for include guards to avoid collisions
Thorsten Horstmann <thorsten.horstmann@web.de>
parents:
857
diff
changeset
|
36 #endif /* DROPBEAR_ECDSA_H_ */ |