mirror of
https://github.com/libssh2/libssh2.git
synced 2025-11-20 02:42:09 +03:00
Supply empty hash functions for mac_method_hmac_aesgcm to avoid a crash when e.g. setting LIBSSH2_METHOD_CRYPT_CS (#1321)
This commit is contained in:
44
src/mac.c
44
src/mac.c
@@ -485,6 +485,44 @@ _libssh2_mac_methods(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if LIBSSH2_AES_GCM
|
#if LIBSSH2_AES_GCM
|
||||||
|
static int
|
||||||
|
mac_method_none_init(LIBSSH2_SESSION * session, unsigned char *key,
|
||||||
|
int *free_key, void **abstract)
|
||||||
|
{
|
||||||
|
(void)session;
|
||||||
|
(void)key;
|
||||||
|
(void)free_key;
|
||||||
|
(void)abstract;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
mac_method_hmac_none_hash(LIBSSH2_SESSION * session,
|
||||||
|
unsigned char *buf, uint32_t seqno,
|
||||||
|
const unsigned char *packet,
|
||||||
|
size_t packet_len,
|
||||||
|
const unsigned char *addtl,
|
||||||
|
size_t addtl_len, void **abstract)
|
||||||
|
{
|
||||||
|
(void)session;
|
||||||
|
(void)buf;
|
||||||
|
(void)seqno;
|
||||||
|
(void)packet;
|
||||||
|
(void)packet_len;
|
||||||
|
(void)addtl;
|
||||||
|
(void)addtl_len;
|
||||||
|
(void)abstract;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
mac_method_none_dtor(LIBSSH2_SESSION * session, void **abstract)
|
||||||
|
{
|
||||||
|
(void)session;
|
||||||
|
(void)abstract;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Stub for aes256-gcm@openssh.com crypto type, which has an integrated
|
/* Stub for aes256-gcm@openssh.com crypto type, which has an integrated
|
||||||
HMAC method. This must not be added to mac_methods[] since it cannot be
|
HMAC method. This must not be added to mac_methods[] since it cannot be
|
||||||
negotiated separately. */
|
negotiated separately. */
|
||||||
@@ -492,9 +530,9 @@ static const LIBSSH2_MAC_METHOD mac_method_hmac_aesgcm = {
|
|||||||
"INTEGRATED-AES-GCM", /* made up name for display only */
|
"INTEGRATED-AES-GCM", /* made up name for display only */
|
||||||
16,
|
16,
|
||||||
16,
|
16,
|
||||||
NULL,
|
mac_method_none_init,
|
||||||
NULL,
|
mac_method_hmac_none_hash,
|
||||||
NULL,
|
mac_method_none_dtor,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
#endif /* LIBSSH2_AES_GCM */
|
#endif /* LIBSSH2_AES_GCM */
|
||||||
|
|||||||
Reference in New Issue
Block a user