mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 09:54:25 +09:00
Fix openSSL support.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@524 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
@@ -38,6 +38,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "libssh/priv.h"
|
#include "libssh/priv.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBGCRYPT
|
||||||
|
#include <gcrypt.h>
|
||||||
|
|
||||||
#include "libssh/crypto.h"
|
#include "libssh/crypto.h"
|
||||||
|
|
||||||
static int alloc_key(struct crypto_struct *cipher) {
|
static int alloc_key(struct crypto_struct *cipher) {
|
||||||
@@ -49,9 +53,6 @@ static int alloc_key(struct crypto_struct *cipher) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LIBGCRYPT
|
|
||||||
#include <gcrypt.h>
|
|
||||||
|
|
||||||
SHACTX sha1_init(void) {
|
SHACTX sha1_init(void) {
|
||||||
SHACTX ctx = NULL;
|
SHACTX ctx = NULL;
|
||||||
gcry_md_open(&ctx, GCRY_MD_SHA1, 0);
|
gcry_md_open(&ctx, GCRY_MD_SHA1, 0);
|
||||||
@@ -410,15 +411,19 @@ static struct crypto_struct ssh_ciphertab[] = {
|
|||||||
#define OLD_CRYPTO
|
#define OLD_CRYPTO
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef cbc_encrypt
|
#include "libssh/crypto.h"
|
||||||
#undef cbc_encrypt
|
|
||||||
#endif
|
static int alloc_key(struct crypto_struct *cipher) {
|
||||||
#ifdef cbc_decrypt
|
cipher->key = malloc(cipher->keylen);
|
||||||
#undef cbc_decrypt
|
if (cipher->key == NULL) {
|
||||||
#endif
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
SHACTX sha1_init(void) {
|
SHACTX sha1_init(void) {
|
||||||
SHACTX c = malloc(sizeof(SHACTX));
|
SHACTX c = malloc(sizeof(*c));
|
||||||
if (c == NULL) {
|
if (c == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -441,10 +446,11 @@ void sha1(unsigned char *digest, int len, unsigned char *hash) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MD5CTX md5_init(void) {
|
MD5CTX md5_init(void) {
|
||||||
MD5CTX c = malloc(sizeof(MD5CTX));
|
MD5CTX c = malloc(sizeof(*c));
|
||||||
if (c == NULL) {
|
if (c == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
MD5_Init(c);
|
MD5_Init(c);
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
@@ -762,7 +768,7 @@ static void cipher_free(struct crypto_struct *cipher) {
|
|||||||
CRYPTO *crypto_new(void) {
|
CRYPTO *crypto_new(void) {
|
||||||
CRYPTO *crypto;
|
CRYPTO *crypto;
|
||||||
|
|
||||||
crypto = malloc(sizeof (CRYPTO));
|
crypto = malloc(sizeof(CRYPTO));
|
||||||
if (crypto == NULL) {
|
if (crypto == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user