mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 09:54:25 +09:00
Fix formatting for file with changes
This fixes the formatting for src/libcrypto.c for the last bits where it is not correct. Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
committed by
Jakub Jelen
parent
1991bdac0d
commit
385ac0911d
@@ -420,38 +420,39 @@ int ssh_kdf(struct ssh_crypto_struct *crypto,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
HMACCTX hmac_init(const void *key, int len, enum ssh_hmac_e type) {
|
HMACCTX hmac_init(const void *key, int len, enum ssh_hmac_e type)
|
||||||
HMACCTX ctx = NULL;
|
{
|
||||||
|
HMACCTX ctx = NULL;
|
||||||
|
|
||||||
ctx = HMAC_CTX_new();
|
ctx = HMAC_CTX_new();
|
||||||
if (ctx == NULL) {
|
if (ctx == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
switch(type) {
|
|
||||||
case SSH_HMAC_SHA1:
|
case SSH_HMAC_SHA1:
|
||||||
HMAC_Init_ex(ctx, key, len, EVP_sha1(), NULL);
|
HMAC_Init_ex(ctx, key, len, EVP_sha1(), NULL);
|
||||||
break;
|
break;
|
||||||
case SSH_HMAC_SHA256:
|
case SSH_HMAC_SHA256:
|
||||||
HMAC_Init_ex(ctx, key, len, EVP_sha256(), NULL);
|
HMAC_Init_ex(ctx, key, len, EVP_sha256(), NULL);
|
||||||
break;
|
break;
|
||||||
case SSH_HMAC_SHA512:
|
case SSH_HMAC_SHA512:
|
||||||
HMAC_Init_ex(ctx, key, len, EVP_sha512(), NULL);
|
HMAC_Init_ex(ctx, key, len, EVP_sha512(), NULL);
|
||||||
break;
|
break;
|
||||||
case SSH_HMAC_MD5:
|
case SSH_HMAC_MD5:
|
||||||
HMAC_Init_ex(ctx, key, len, EVP_md5(), NULL);
|
HMAC_Init_ex(ctx, key, len, EVP_md5(), NULL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
HMAC_CTX_free(ctx);
|
HMAC_CTX_free(ctx);
|
||||||
ctx = NULL;
|
ctx = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
void hmac_update(HMACCTX ctx, const void *data, unsigned long len) {
|
void hmac_update(HMACCTX ctx, const void *data, unsigned long len)
|
||||||
HMAC_Update(ctx, data, len);
|
{
|
||||||
|
HMAC_Update(ctx, data, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void hmac_final(HMACCTX ctx, unsigned char *hashmacbuf, unsigned int *len)
|
void hmac_final(HMACCTX ctx, unsigned char *hashmacbuf, unsigned int *len)
|
||||||
@@ -460,7 +461,8 @@ void hmac_final(HMACCTX ctx, unsigned char *hashmacbuf, unsigned int *len)
|
|||||||
HMAC_CTX_free(ctx);
|
HMAC_CTX_free(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void evp_cipher_init(struct ssh_cipher_struct *cipher) {
|
static void evp_cipher_init(struct ssh_cipher_struct *cipher)
|
||||||
|
{
|
||||||
if (cipher->ctx == NULL) {
|
if (cipher->ctx == NULL) {
|
||||||
cipher->ctx = EVP_CIPHER_CTX_new();
|
cipher->ctx = EVP_CIPHER_CTX_new();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user