Fabiano Fidêncio
d1d003c232
buffer: use ssh_buffer_get() instead of ssh_buffer_get_begin()
...
This commit is a preparatory stage for removing ssh_buffer_get_begin().
Note that removing ssh_buffer_get_begin() doesn't break API
compatibility, as this functions has never been exposed (it only has the
LIBSSH_API prefix).
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2016-01-19 11:31:08 +01:00
Fabiano Fidêncio
05fd0acf45
buffer: do not use ssh_buffer_get_rest_len()
...
As ssh_buffer_get_len() actually calls ssh_buffer_get_rest_len(), let's
just use the first one. This is a preparatory step for removing
ssh_buffer_get_rest_len().
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2016-01-19 11:31:08 +01:00
Fabiano Fidêncio
954341dd1f
buffer: rename ssh_buffer_get_rest() to ssh_buffer_get()
...
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2016-01-19 11:31:07 +01:00
Fabiano Fidêncio
adc8c20ac1
cleanup: use ssh_ prefix in the buffer (non-static) functions
...
Having "ssh_" prefix in the functions' name will avoid possible clashes
when compiling libssh statically.
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2016-01-19 11:31:07 +01:00
Fabiano Fidêncio
0d7da3207f
Fix a bunch of -Wmaybe-uninitialized
...
Reviewed-By: Aris Adamantiadis <aris@0xbadc0de.be >
2015-12-17 15:01:05 +01:00
Andreas Schneider
11f43df873
pki: Fix a memory leak on error in ssh_pki_copy_cert_to_privkey()
...
CID 1323516
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2015-09-09 09:34:22 +02:00
Andreas Schneider
1254ed1833
pki: Fix a memory leak in pki_import_cert_buffer()
...
CID #1323517
2015-09-09 09:32:40 +02:00
Axel Eppe
bdfe6870f6
pki: Add certificate loading functions
...
- ssh_pki_import_cert_base64()
- ssh_pki_import_cert_file()
- ssh_pki_import_cert_blob()
Those functions are currently simple wrappers around their pubkey counterpart.
- ssh_pki_copy_cert_to_privkey()
This function copies the cert-specific data to a private key.
Signed-off-by: Axel Eppe <aeppe@google.com >
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2015-09-07 13:30:14 +02:00
Axel Eppe
9775f78ab2
pki: Add Add new pki_import_cert_buffer function
...
Signed-off-by: Axel Eppe <aeppe@google.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2015-09-07 13:29:52 +02:00
Axel Eppe
6da4e21065
pki: Add rsa, dss certificate key type definitions
...
- Add rsa/dsa (ssh-{rsa,dss}-cert-v01@openssh.com ) as key types.
- Add a cert_type member in the ssh_key struct.
Signed-off-by: Axel Eppe <aeppe@google.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2015-09-07 13:29:23 +02:00
Andreas Schneider
3b0b1c3ee3
pki: Use the standard logging function
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2015-09-07 10:57:34 +02:00
Andreas Schneider
e1081796af
pki: Fix return values of ssh_key_is_(public|private)
...
Thanks to Kevin Haake <khaake@red-cocoa.com >
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2015-08-10 13:57:28 +02:00
Aris Adamantiadis
46bc11f977
ed25519: Add support to export OpenSSH container keys
...
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2015-02-02 14:45:52 +01:00
Aris Adamantiadis
3ec3a926e5
ed25519: Add support o import OpenSSH container keys
...
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2015-02-02 14:45:52 +01:00
Andreas Schneider
9a7d450098
pki: Make sure sig is not used unintialized.
...
BUG: https://red.libssh.org/issues/167
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2015-01-20 19:31:12 +01:00
Jon Simons
59da8dab50
pki: check ssh_buffer_pack return in ssh_pki_do_sign
...
Check the 'ssh_buffer_pack' return in ssh_pki_do_sign for the ED25519 case.
Signed-off-by: Jon Simons <jon@jonsimons.org >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2014-10-02 08:28:05 +02:00
Jon Simons
7edbedf0dd
pki: fail when pubkey buffer length is not ED25519_PK_LEN
...
Fail fast in 'pki_import_pubkey_buffer' for the ED25519 case if a buffer
sized ED25519_PK_LEN can not be retrieved. Before, the 'memcpy' could
have read beyond the bounds of 'ssh_string_data(pubkey)'.
Signed-off-by: Jon Simons <jon@jonsimons.org >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2014-10-02 08:27:05 +02:00
Aris
93c7b81b4e
ed25519: Generate, sign and verify keys.
...
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2014-09-07 22:07:34 +02:00
Andreas Schneider
83633d539e
pki: Fix build without ECC support.
...
Signed-off-by: Andreas Schneider <asn@samba.org >
2014-05-09 08:55:49 +02:00
Hani Benhabiles
2c7dfb02a8
Small documentation fix.
...
Signed-off-by: Hani Benhabiles <hani@linux.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2014-05-06 08:52:55 +02:00
Andreas Schneider
2884bbf5b1
pki: Correctly update the ECDSA keytype.
2014-04-23 11:16:28 +02:00
Andreas Schneider
f48a99b97c
pki: Move ssh_pki_key_ecdsa_name() to the correct file.
2014-04-23 11:15:05 +02:00
Alan Dunn
15f3988bc8
pki: Use SHA-2 for session ID signing with ECDSA keys
...
Previously, SHA-1 was used always.
BUG: https://red.libssh.org/issues/148
Signed-off-by: Alan Dunn <amdunn@gmail.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2014-03-12 14:13:29 +01:00
Andreas Schneider
370d4b014d
pki: Fix the build on OpenSolaris.
2014-02-12 09:39:49 +01:00
Andreas Schneider
7bd5e4101c
pki: Fix memory leak with ecdsa signatures.
2014-02-11 10:32:50 +01:00
Andreas Schneider
cb9786b3ae
src: Rename buffer_add_data() to ssh_buffer_add_data().
2014-01-19 20:55:55 +01:00
Aris Adamantiadis
aecd952d18
update copyright information
2014-01-07 15:18:15 +01:00
Andreas Schneider
cdd7a6cb8d
pki: Fix a memory leak.
...
CID #1132819
2013-11-28 09:09:45 +01:00
Andreas Schneider
136efd6ed5
pki: Add ssh_pki_import_privkey_file().
2013-11-27 22:54:13 +01:00
Andreas Schneider
33890daf41
pki: Add support for ECDSA private key signing.
2013-10-18 23:22:24 +02:00
Andreas Schneider
ac4c5699b1
pki: Add the type as a char pointer.
2013-10-18 23:22:24 +02:00
Andreas Schneider
33cb1bc08b
doc: Improve the PKI documentation a bit.
2013-09-10 06:59:25 +02:00
Andreas Schneider
ebdd0c6ac1
src: Migrate to SSH_LOG.
2013-07-14 12:44:26 +02:00
Aris Adamantiadis
bf5e5eebd7
pki: fix comments
2013-07-13 23:01:30 +02:00
Aris Adamantiadis
dd6a0b51ac
Server: fix rekeying
2013-07-13 22:56:07 +02:00
Andreas Schneider
d83b3d9ebe
pki: Limit privkey to 4M for now.
2013-06-17 12:07:32 +02:00
Andreas Schneider
6f8b5ed679
pki: Fix a resource leak on error.
2013-06-17 11:49:13 +02:00
Andreas Schneider
09663692dd
pki: Use fstat() after opening the file.
2013-06-13 11:04:59 +02:00
Andreas Schneider
e403596d98
pki: Add a size limit for pubkey files.
2012-11-21 12:44:00 +01:00
Xi Wang
cab00c3bfc
pki: Fix integer overflow in ssh_pki_import_privkey_file().
...
If the file size is ULONG_MAX, the call to malloc() may allocate a
small buffer, leading to a memory corruption.
2012-10-22 21:00:08 +02:00
Andreas Schneider
3d390cf6ff
pki: Make sure the key_buf is null terminated.
...
Found by Coverity.
2012-10-12 14:45:54 +02:00
Andreas Schneider
0a4ea19982
pki: Fix a possible null pointer dereference.
...
Found by Coverity.
2012-10-12 08:07:02 +02:00
Andreas Schneider
3e93836e8b
pki: Make error handling code reachable again.
...
Found by Coverity.
2012-10-09 11:09:34 +02:00
Andreas Schneider
bfa568e448
pki: Check for no memory available calling ssh_key_new().
2012-10-07 22:04:58 +02:00
Andreas Schneider
3db2ac41eb
pki: Handle error of pki_import_pubkey_buffer() correctly.
2012-10-07 21:53:37 +02:00
Andreas Schneider
977951e96a
pki: Open privkey file in binary mode.
...
This is needed to correctly detect carriage return.
2012-09-04 11:28:33 +02:00
Andreas Schneider
4019dbed85
pki: Add ecdsa support for signature verification.
2012-02-04 23:45:01 +01:00
Andreas Schneider
0770843309
pki: Fix ssh_pki_log function.
2012-02-04 23:03:53 +01:00
Andreas Schneider
e93f17cad8
pki: Don't free a const key!
2012-02-04 22:07:03 +01:00
Andreas Schneider
e4d0ac7ba1
pki: Update copyright.
2012-02-04 20:37:29 +01:00