1
1
Этот коммит содержится в:
Simon Josefsson 2007-01-23 12:44:14 +00:00
родитель b1d855d1ac
Коммит d2be40421a
7 изменённых файлов: 25 добавлений и 15 удалений

Просмотреть файл

@ -90,14 +90,14 @@ static int init (LIBSSH2_SESSION *session,
return 0; return 0;
} }
int crypt(LIBSSH2_SESSION *session, unsigned char *block, void **abstract) static int crypt(LIBSSH2_SESSION *session, unsigned char *block, void **abstract)
{ {
struct crypt_ctx *cctx = *(struct crypt_ctx **)abstract; struct crypt_ctx *cctx = *(struct crypt_ctx **)abstract;
return _libssh2_cipher_crypt(&cctx->h, cctx->algo, return _libssh2_cipher_crypt(&cctx->h, cctx->algo,
cctx->encrypt, block); cctx->encrypt, block);
} }
int dtor(LIBSSH2_SESSION *session, void **abstract) static int dtor(LIBSSH2_SESSION *session, void **abstract)
{ {
struct crypt_ctx **cctx = (struct crypt_ctx **)abstract; struct crypt_ctx **cctx = (struct crypt_ctx **)abstract;
if (cctx && *cctx) { if (cctx && *cctx) {

Просмотреть файл

@ -301,7 +301,7 @@ static int libssh2_hostkey_method_ssh_dss_sig_verify(LIBSSH2_SESSION *session, c
libssh2_error(session, LIBSSH2_ERROR_PROTO, "Invalid DSS signature length", 0); libssh2_error(session, LIBSSH2_ERROR_PROTO, "Invalid DSS signature length", 0);
return -1; return -1;
} }
return _libssh2_dsa_sha1_verify(dsactx, sig, sig_len, m, m_len); return _libssh2_dsa_sha1_verify(dsactx, sig, m, m_len);
} }
/* }}} */ /* }}} */

Просмотреть файл

@ -79,7 +79,6 @@ int _libssh2_rsa_new(libssh2_rsa_ctx **rsa,
int _libssh2_rsa_sha1_verify(libssh2_rsa_ctx *rsa, int _libssh2_rsa_sha1_verify(libssh2_rsa_ctx *rsa,
const unsigned char *sig, const unsigned char *sig,
unsigned long sig_len,
const unsigned char *m, const unsigned char *m,
unsigned long m_len) unsigned long m_len)
{ {

Просмотреть файл

@ -147,7 +147,6 @@ int _libssh2_dsa_new_private (libssh2_dsa_ctx **dsa,
unsigned const char *passphrase); unsigned const char *passphrase);
int _libssh2_dsa_sha1_verify(libssh2_dsa_ctx *dsa, int _libssh2_dsa_sha1_verify(libssh2_dsa_ctx *dsa,
const unsigned char *sig, const unsigned char *sig,
unsigned long sig_len,
const unsigned char *m, const unsigned char *m,
unsigned long m_len); unsigned long m_len);
int _libssh2_dsa_sign(libssh2_dsa_ctx *dsactx, int _libssh2_dsa_sign(libssh2_dsa_ctx *dsactx,

Просмотреть файл

@ -260,7 +260,7 @@ struct _LIBSSH2_SESSION {
/* libssh2 extensible ssh api, ultimately I'd like to allow loading additional methods via .so/.dll */ /* libssh2 extensible ssh api, ultimately I'd like to allow loading additional methods via .so/.dll */
struct _LIBSSH2_KEX_METHOD { struct _LIBSSH2_KEX_METHOD {
char *name; const char *name;
/* Key exchange, populates session->* and returns 0 on success, non-0 on error */ /* Key exchange, populates session->* and returns 0 on success, non-0 on error */
int (*exchange_keys)(LIBSSH2_SESSION *session); int (*exchange_keys)(LIBSSH2_SESSION *session);
@ -269,11 +269,11 @@ struct _LIBSSH2_KEX_METHOD {
}; };
struct _LIBSSH2_HOSTKEY_METHOD { struct _LIBSSH2_HOSTKEY_METHOD {
char *name; const char *name;
unsigned long hash_len; unsigned long hash_len;
int (*init)(LIBSSH2_SESSION *session, unsigned char *hostkey_data, unsigned long hostkey_data_len, void **abstract); int (*init)(LIBSSH2_SESSION *session, unsigned char *hostkey_data, unsigned long hostkey_data_len, void **abstract);
int (*initPEM)(LIBSSH2_SESSION *session, unsigned const char *privkeyfile, unsigned const char *passphrase, void **abstract); int (*initPEM)(LIBSSH2_SESSION *session, const char *privkeyfile, unsigned const char *passphrase, void **abstract);
int (*sig_verify)(LIBSSH2_SESSION *session, const unsigned char *sig, unsigned long sig_len, const unsigned char *m, unsigned long m_len, void **abstract); int (*sig_verify)(LIBSSH2_SESSION *session, const unsigned char *sig, unsigned long sig_len, const unsigned char *m, unsigned long m_len, void **abstract);
int (*signv)(LIBSSH2_SESSION *session, unsigned char **signature, unsigned long *signature_len, unsigned long veccount, const struct iovec datavec[], void **abstract); int (*signv)(LIBSSH2_SESSION *session, unsigned char **signature, unsigned long *signature_len, unsigned long veccount, const struct iovec datavec[], void **abstract);
int (*encrypt)(LIBSSH2_SESSION *session, unsigned char **dst, unsigned long *dst_len, const unsigned char *src, unsigned long src_len, void **abstract); int (*encrypt)(LIBSSH2_SESSION *session, unsigned char **dst, unsigned long *dst_len, const unsigned char *src, unsigned long src_len, void **abstract);
@ -281,7 +281,7 @@ struct _LIBSSH2_HOSTKEY_METHOD {
}; };
struct _LIBSSH2_CRYPT_METHOD { struct _LIBSSH2_CRYPT_METHOD {
char *name; const char *name;
int blocksize; int blocksize;
@ -299,7 +299,7 @@ struct _LIBSSH2_CRYPT_METHOD {
}; };
struct _LIBSSH2_COMP_METHOD { struct _LIBSSH2_COMP_METHOD {
char *name; const char *name;
int (*init)(LIBSSH2_SESSION *session, int compress, void **abstract); int (*init)(LIBSSH2_SESSION *session, int compress, void **abstract);
int (*comp)(LIBSSH2_SESSION *session, int compress, unsigned char **dest, unsigned long *dest_len, unsigned long payload_limit, int *free_dest, int (*comp)(LIBSSH2_SESSION *session, int compress, unsigned char **dest, unsigned long *dest_len, unsigned long payload_limit, int *free_dest,
@ -308,7 +308,7 @@ struct _LIBSSH2_COMP_METHOD {
}; };
struct _LIBSSH2_MAC_METHOD { struct _LIBSSH2_MAC_METHOD {
char *name; const char *name;
/* The length of a given MAC packet */ /* The length of a given MAC packet */
int mac_len; int mac_len;

Просмотреть файл

@ -139,7 +139,6 @@ int _libssh2_dsa_new(libssh2_dsa_ctx **dsactx,
int _libssh2_dsa_sha1_verify(libssh2_dsa_ctx *dsactx, int _libssh2_dsa_sha1_verify(libssh2_dsa_ctx *dsactx,
const unsigned char *sig, const unsigned char *sig,
unsigned long sig_len,
const unsigned char *m, const unsigned char *m,
unsigned long m_len) unsigned long m_len)
{ {

Просмотреть файл

@ -127,7 +127,7 @@
#define libssh2_hmac_final(ctx, data) HMAC_Final(&(ctx), data, NULL) #define libssh2_hmac_final(ctx, data) HMAC_Final(&(ctx), data, NULL)
#define libssh2_hmac_cleanup(ctx) HMAC_cleanup(ctx) #define libssh2_hmac_cleanup(ctx) HMAC_cleanup(ctx)
#define libssh2_crypto_init() 1 #define libssh2_crypto_init()
#define libssh2_rsa_ctx RSA #define libssh2_rsa_ctx RSA
@ -148,11 +148,21 @@ int _libssh2_rsa_new(libssh2_rsa_ctx **rsa,
unsigned long e2len, unsigned long e2len,
const unsigned char *coeffdata, const unsigned char *coeffdata,
unsigned long coefflen); unsigned long coefflen);
int _libssh2_rsa_new_private (libssh2_rsa_ctx **rsa,
LIBSSH2_SESSION *session,
FILE *fp,
unsigned const char *passphrase);
int _libssh2_rsa_sha1_verify(libssh2_rsa_ctx *rsa, int _libssh2_rsa_sha1_verify(libssh2_rsa_ctx *rsa,
const unsigned char *sig, const unsigned char *sig,
unsigned long sig_len, unsigned long sig_len,
const unsigned char *m, const unsigned char *m,
unsigned long m_len); unsigned long m_len);
int _libssh2_rsa_sha1_sign(LIBSSH2_SESSION *session,
libssh2_rsa_ctx *rsactx,
const unsigned char *hash,
unsigned long hash_len,
unsigned char **signature,
unsigned long *signature_len);
#define _libssh2_rsa_free(rsactx) RSA_free(rsactx) #define _libssh2_rsa_free(rsactx) RSA_free(rsactx)
@ -169,9 +179,12 @@ int _libssh2_dsa_new(libssh2_dsa_ctx **dsa,
unsigned long ylen, unsigned long ylen,
const unsigned char *x, const unsigned char *x,
unsigned long x_len); unsigned long x_len);
int _libssh2_dsa_new_private (libssh2_dsa_ctx **dsa,
LIBSSH2_SESSION *session,
FILE *fp,
unsigned const char *passphrase);
int _libssh2_dsa_sha1_verify(libssh2_dsa_ctx *dsactx, int _libssh2_dsa_sha1_verify(libssh2_dsa_ctx *dsactx,
const unsigned char *sig, const unsigned char *sig,
unsigned long sig_len,
const unsigned char *m, const unsigned char *m,
unsigned long m_len); unsigned long m_len);
int _libssh2_dsa_sha1_sign(libssh2_dsa_ctx *dsactx, int _libssh2_dsa_sha1_sign(libssh2_dsa_ctx *dsactx,