mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 09:54:25 +09:00
Improve sha1_init().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@515 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
@@ -52,10 +52,11 @@ static int alloc_key(struct crypto_struct *cipher) {
|
|||||||
#ifdef HAVE_LIBGCRYPT
|
#ifdef HAVE_LIBGCRYPT
|
||||||
#include <gcrypt.h>
|
#include <gcrypt.h>
|
||||||
|
|
||||||
SHACTX sha1_init(){
|
SHACTX sha1_init(void) {
|
||||||
SHACTX ret;
|
SHACTX ctx = NULL;
|
||||||
gcry_md_open(&ret,GCRY_MD_SHA1,0);
|
gcry_md_open(&ctx, GCRY_MD_SHA1, 0);
|
||||||
return ret;
|
|
||||||
|
return ctx;
|
||||||
}
|
}
|
||||||
void sha1_update(SHACTX c, const void *data, unsigned long len){
|
void sha1_update(SHACTX c, const void *data, unsigned long len){
|
||||||
gcry_md_write(c,data,len);
|
gcry_md_write(c,data,len);
|
||||||
@@ -249,13 +250,14 @@ static struct crypto_struct ssh_ciphertab[]={
|
|||||||
#define OLD_CRYPTO
|
#define OLD_CRYPTO
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SHACTX sha1_init(){
|
SHACTX sha1_init(void) {
|
||||||
SHACTX c = malloc(sizeof(*c));
|
SHACTX ctx = malloc(sizeof(*c));
|
||||||
if (c == NULL) {
|
if (c == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
SHA1_Init(c);
|
SHA1_Init(c);
|
||||||
return c;
|
|
||||||
|
return c;
|
||||||
}
|
}
|
||||||
void sha1_update(SHACTX c, const void *data, unsigned long len){
|
void sha1_update(SHACTX c, const void *data, unsigned long len){
|
||||||
SHA1_Update(c,data,len);
|
SHA1_Update(c,data,len);
|
||||||
|
|||||||
Reference in New Issue
Block a user