Visitar URL original
drop DSA (ssh-dss) support by vszakats · Pull Request #2598 · libssh2/libssh2 · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -514,9 +514,6 @@ jobs:
cflags+=' -DLIBSSH2_KEX_SHA1_ENABLE -DLIBSSH2_MD5_ENABLE -DLIBSSH2_MD5_PEM_ENABLE -DLIBSSH2_HMAC_SHA1_ENABLE -DLIBSSH2_HMAC_RIPEMD_ENABLE'
cflags+=' -DLIBSSH2_RSA_SHA1_ENABLE -DLIBSSH2_BLOWFISH_ENABLE -DLIBSSH2_RC4_ENABLE -DLIBSSH2_CAST_ENABLE -DLIBSSH2_3DES_ENABLE'
fi
if [ "${MATRIX_TARGET}" = 'distcheck' ]; then
cflags+=' -DLIBSSH2_DSA_ENABLE' # build test only, it cannot pass test in CI
fi
if [ "${MATRIX_BUILD}" = 'CM' ]; then
if [ "${MATRIX_CRYPTO}" = 'AWS-LC' ] || \
[ "${MATRIX_CRYPTO}" = 'BoringSSL' ] || \
Expand Down Expand Up @@ -890,7 +887,6 @@ jobs:
if [ "${MATRIX_TEST}" = 'legacy-options' ]; then
cflags+=' -DLIBSSH2_KEX_SHA1_ENABLE -DLIBSSH2_MD5_ENABLE -DLIBSSH2_MD5_PEM_ENABLE -DLIBSSH2_HMAC_SHA1_ENABLE -DLIBSSH2_HMAC_RIPEMD_ENABLE'
cflags+=' -DLIBSSH2_RSA_SHA1_ENABLE -DLIBSSH2_BLOWFISH_ENABLE -DLIBSSH2_RC4_ENABLE -DLIBSSH2_CAST_ENABLE -DLIBSSH2_3DES_ENABLE'
cflags+=' -DLIBSSH2_DSA_ENABLE'
fi
if [ "${MATRIX_BUILD}" = 'CM' ]; then
if [[ "${MATRIX_ENV}" = 'clang'* ]]; then
Expand Down Expand Up @@ -1028,7 +1024,6 @@ jobs:
options+=" -DENABLE_ECDSA_WINCNG=${MATRIX_WINCND_ECDSA}"
cflags+=' -DLIBSSH2_KEX_SHA1_ENABLE -DLIBSSH2_MD5_ENABLE -DLIBSSH2_MD5_PEM_ENABLE -DLIBSSH2_HMAC_SHA1_ENABLE'
cflags+=' -DLIBSSH2_RSA_SHA1_ENABLE -DLIBSSH2_BLOWFISH_ENABLE -DLIBSSH2_RC4_ENABLE -DLIBSSH2_3DES_ENABLE'
cflags+=' -DLIBSSH2_DSA_ENABLE'
fi
cmake -B bld ${options} \
-DCMAKE_C_FLAGS="${cflags}" \
Expand Down Expand Up @@ -1377,7 +1372,6 @@ jobs:
options+=" -DENABLE_ECDSA_WINCNG=${MATRIX_WINCND_ECDSA}"
cflags+=' -DLIBSSH2_KEX_SHA1_ENABLE -DLIBSSH2_MD5_ENABLE -DLIBSSH2_MD5_PEM_ENABLE -DLIBSSH2_HMAC_SHA1_ENABLE'
cflags+=' -DLIBSSH2_RSA_SHA1_ENABLE -DLIBSSH2_BLOWFISH_ENABLE -DLIBSSH2_RC4_ENABLE -DLIBSSH2_3DES_ENABLE'
cflags+=' -DLIBSSH2_DSA_ENABLE'
fi
cmake -B bld ${options} \
-DCMAKE_INSTALL_PREFIX="$HOME"/libssh2-install \
Expand Down
7 changes: 4 additions & 3 deletions RELEASE-NOTES
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ libssh2 1.11.2_DEV

Deprecation notices:

- This release drops this feature:

- DSA: `ssh-dss` host keys and public-key authentication.

- This release disables these options by default:

- SHA1-based host key methods and signatures: `ssh-rsa`,
Expand All @@ -14,9 +18,6 @@ Deprecation notices:
- `diffie-hellman-group-exchange-sha1`
You can enable them with `-DLIBSSH2_KEX_SHA1_ENABLE`.

- DSA: `ssh-dss` host keys.
You can enable it with `-DLIBSSH2_DSA_ENABLE`.

- SHA1-based MACs: `hmac-sha1`, `hmac-sha1-etm@openssh.com`, `hmac-sha1-96`
You can enable them with `-DLIBSSH2_HMAC_SHA1_ENABLE`.

Expand Down
5 changes: 2 additions & 3 deletions docs/libssh2_knownhost_add.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ LIBSSH2_KNOWNHOST_KEYENC_RAW or LIBSSH2_KNOWNHOST_KEYENC_BASE64.

The key is using one of these algorithms:
LIBSSH2_KNOWNHOST_KEY_RSA1, LIBSSH2_KNOWNHOST_KEY_SSHRSA,
LIBSSH2_KNOWNHOST_KEY_SSHDSS (deprecated), LIBSSH2_KNOWNHOST_KEY_ECDSA_256,
LIBSSH2_KNOWNHOST_KEY_ECDSA_384, LIBSSH2_KNOWNHOST_KEY_ECDSA_521 or
LIBSSH2_KNOWNHOST_KEY_ED25519.
LIBSSH2_KNOWNHOST_KEY_ECDSA_256, LIBSSH2_KNOWNHOST_KEY_ECDSA_384,
LIBSSH2_KNOWNHOST_KEY_ECDSA_521 or LIBSSH2_KNOWNHOST_KEY_ED25519.

*store* should point to a pointer that gets filled in to point to the
known host data after the addition. NULL can be passed if you do not care about
Expand Down
5 changes: 2 additions & 3 deletions docs/libssh2_knownhost_addc.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,8 @@ LIBSSH2_KNOWNHOST_KEYENC_RAW or LIBSSH2_KNOWNHOST_KEYENC_BASE64.

The key is using one of these algorithms:
LIBSSH2_KNOWNHOST_KEY_RSA1, LIBSSH2_KNOWNHOST_KEY_SSHRSA,
LIBSSH2_KNOWNHOST_KEY_SSHDSS (deprecated), LIBSSH2_KNOWNHOST_KEY_ECDSA_256,
LIBSSH2_KNOWNHOST_KEY_ECDSA_384, LIBSSH2_KNOWNHOST_KEY_ECDSA_521 or
LIBSSH2_KNOWNHOST_KEY_ED25519.
LIBSSH2_KNOWNHOST_KEY_ECDSA_256, LIBSSH2_KNOWNHOST_KEY_ECDSA_384,
LIBSSH2_KNOWNHOST_KEY_ECDSA_521 or LIBSSH2_KNOWNHOST_KEY_ED25519.

*store* should point to a pointer that gets filled in to point to the
known host data after the addition. NULL can be passed if you do not care about
Expand Down
7 changes: 3 additions & 4 deletions docs/libssh2_session_hostkey.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ Returns a pointer to the current host key, the value *len* points to
gets the length of the key.

The value *type* points to the type of host key which is one of:
LIBSSH2_HOSTKEY_TYPE_RSA, LIBSSH2_HOSTKEY_TYPE_DSS (deprecated),
LIBSSH2_HOSTKEY_TYPE_ECDSA_256, LIBSSH2_HOSTKEY_TYPE_ECDSA_384,
LIBSSH2_HOSTKEY_TYPE_ECDSA_521, LIBSSH2_HOSTKEY_TYPE_ED25519 or
LIBSSH2_HOSTKEY_TYPE_UNKNOWN.
LIBSSH2_HOSTKEY_TYPE_RSA, LIBSSH2_HOSTKEY_TYPE_ECDSA_256,
LIBSSH2_HOSTKEY_TYPE_ECDSA_384, LIBSSH2_HOSTKEY_TYPE_ECDSA_521,
LIBSSH2_HOSTKEY_TYPE_ED25519 or LIBSSH2_HOSTKEY_TYPE_UNKNOWN.

# RETURN VALUE

Expand Down
2 changes: 1 addition & 1 deletion include/libssh2.h
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ typedef struct _LIBSSH2_POLLFD {
#define LIBSSH2_HOSTKEY_TYPE_UNKNOWN 0
#define LIBSSH2_HOSTKEY_TYPE_RSA 1
#ifndef LIBSSH2_NO_DEPRECATED
#define LIBSSH2_HOSTKEY_TYPE_DSS 2 /* deprecated */
#define LIBSSH2_HOSTKEY_TYPE_DSS 2 /* obsolete, unused */
#endif
#define LIBSSH2_HOSTKEY_TYPE_ECDSA_256 3
#define LIBSSH2_HOSTKEY_TYPE_ECDSA_384 4
Expand Down
3 changes: 1 addition & 2 deletions os400/README400
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ additional procedures are provided for string transcoding (see below). No
wrappers to standard procedures are provided: however, nested calls to
transcoding procedures may be used.

Crypto API is provided by the IBM QC3 API library. It supports RSA and EC,
but not DSA.
Crypto API is provided by the IBM QC3 API library. It supports RSA and EC.

Standard compilation environment does support neither autotools nor make;
in fact, few common utilities are available. As a consequence, the
Expand Down
78 changes: 2 additions & 76 deletions src/HACKING-CRYPTO.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,16 +378,6 @@ Format of an RSA public key:

Each item is preceded by its 32-bit byte length, MSB first.

Format of a DSA public key:

1. "ssh-dss".
2. p, MSB first, with high order bit = 0.
3. q, MSB first, with high order bit = 0.
4. g, MSB first, with high order bit = 0.
5. pub_key, MSB first, with high order bit = 0.

Each item is preceded by its 32-bit byte length, MSB first.

Format of an ECDSA public key:

1. `ecdsa-sha2-nistp256` or `ecdsa-sha2-nistp384` or `ecdsa-sha2-nistp521`.
Expand Down Expand Up @@ -557,71 +547,7 @@ based on hash length and the RSA context.
Return 0 if OK, else -1.
This procedure is already prototyped in `crypto.h`.

### 7.2) DSA

`LIBSSH2_DSA`: define as 1 if the crypto library supports DSA, else 0. If
defined as 0, the rest of this section can be omitted.

`ssh2_dsa_ctx`: Type of a DSA computation context. Generally a struct.

```c
int ssh2_dsa_new(ssh2_dsa_ctx **dsa, LIBSSH2_SESSION *session,
const unsigned char *pdata, size_t plen,
const unsigned char *qdata, size_t qlen,
const unsigned char *gdata, size_t glen,
const unsigned char *ydata, size_t ylen,
const unsigned char *x, size_t x_len);
```

Creates a new context for DSA computations from source key values:

- `pdata`, `plen` Prime number p. Only used if private key known (`ddata`).
- `qdata`, `qlen` Prime number q. Only used if private key known (`ddata`).
- `gdata`, `glen` G number.
- `ydata`, `ylen` Public key.
- `xdata`, `xlen` Private key. Only taken if xlen non-zero.

Returns 0 if OK.
This procedure is already prototyped in `crypto.h`.

```c
int ssh2_dsa_new_priv(ssh2_dsa_ctx **dsa,
LIBSSH2_SESSION *session,
const char *filename,
const char *blob, size_t blob_len,
const char *passphrase);
```
Reads a DSA private key from file `filename`, or `blob` into a new DSA
context.
Must call `ssh2_init_if_needed()`.
Returns 0 if OK, else -1.
This procedure is already prototyped in `crypto.h`.

```c
int ssh2_dsa_sha1_verify(ssh2_dsa_ctx *dsa, LIBSSH2_SESSION *session,
const unsigned char *sig,
const unsigned char *m, size_t m_len);
```
Verify (`sig`, `siglen`) signature of (`m`, `m_len`) using an SHA-1 hash and
the DSA context.
Returns 0 if OK, else -1.
This procedure is already prototyped in `crypto.h`.

```c
int ssh2_dsa_sha1_sign(ssh2_dsa_ctx *dsa, LIBSSH2_SESSION *session,
const unsigned char *hash,
size_t hash_len, unsigned char *sig);
```
DSA signs the (`hash`, `hash_len`) data using SHA-1 and store the signature at
`sig`. Returns 0 if OK, else -1.
This procedure is already prototyped in `crypto.h`.

```c
void ssh2_dsa_free(ssh2_dsa_ctx *dsa, LIBSSH2_SESSION *session);
```
Releases the DSA computation context at `dsa`.

### 7.3) ECDSA
### 7.2) ECDSA

`LIBSSH2_ECDSA`: define as 1 if the crypto library supports ECDSA, else 0. If
defined as 0, `ssh2_ec_key` should be defined as void and the rest of this
Expand Down Expand Up @@ -723,7 +649,7 @@ void ssh2_ecdsa_free(ssh2_ecdsa_ctx *ec_ctx, LIBSSH2_SESSION *session);
```
Releases the ECDSA computation context at `ec_ctx`.

### 7.4) ED25519
### 7.3) ED25519

`LIBSSH2_ED25519`: define as 1 if the crypto library supports ED25519, else 0.
If defined as 0, the rest of this section can be omitted.
Expand Down
27 changes: 0 additions & 27 deletions src/crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,29 +160,6 @@ void ssh2_rsa_free(ssh2_rsa_ctx *rsa, LIBSSH2_SESSION *session);
#endif
#endif /* LIBSSH2_RSA */

#if LIBSSH2_DSA
int ssh2_dsa_new(ssh2_dsa_ctx **dsa, LIBSSH2_SESSION *session,
const unsigned char *pdata, size_t plen,
const unsigned char *qdata, size_t qlen,
const unsigned char *gdata, size_t glen,
const unsigned char *ydata, size_t ylen,
const unsigned char *xdata, size_t xlen);
int ssh2_dsa_new_priv(ssh2_dsa_ctx **dsa,
LIBSSH2_SESSION *session,
const char *filename,
const char *blob, size_t blob_len,
const char *passphrase);
int ssh2_dsa_sha1_sign(ssh2_dsa_ctx *dsa, LIBSSH2_SESSION *session,
const unsigned char *hash, size_t hash_len,
unsigned char *signature);
int ssh2_dsa_sha1_verify(ssh2_dsa_ctx *dsa, LIBSSH2_SESSION *session,
const unsigned char *sig,
const unsigned char *m, size_t m_len);
#ifndef ssh2_dsa_free
void ssh2_dsa_free(ssh2_dsa_ctx *dsa, LIBSSH2_SESSION *session);
#endif
#endif /* LIBSSH2_DSA */

#if LIBSSH2_ECDSA
/* Maximum uncompressed EC point length for NIST P-521:
* two 521-bit coordinates rounded up to bytes, plus 1-byte format prefix.
Expand Down Expand Up @@ -323,10 +300,6 @@ void ssh2_dh_dtor(ssh2_dh_ctx *dhctx);
#define PEM_RSA_HEADER "-----BEGIN RSA PRIVATE KEY-----"
#define PEM_RSA_FOOTER "-----END RSA PRIVATE KEY-----"
#endif
#if LIBSSH2_DSA
#define PEM_DSA_HEADER "-----BEGIN DSA PRIVATE KEY-----"
#define PEM_DSA_FOOTER "-----END DSA PRIVATE KEY-----"
#endif
#if LIBSSH2_ECDSA
#define PEM_ECDSA_HEADER "-----BEGIN EC PRIVATE KEY-----"
#define PEM_ECDSA_FOOTER "-----END EC PRIVATE KEY-----"
Expand Down
5 changes: 0 additions & 5 deletions src/crypto_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@
#define LIBSSH2_HMAC_RIPEMD 0
#endif

#ifndef LIBSSH2_DSA_ENABLE
#undef LIBSSH2_DSA
#define LIBSSH2_DSA 0
#endif

#ifdef LIBSSH2_NO_RSA
#undef LIBSSH2_RSA
#define LIBSSH2_RSA 0
Expand Down
Loading
Loading