diff --git a/src/libcrypto.c b/src/libcrypto.c index cf375603..c82b4b5e 100644 --- a/src/libcrypto.c +++ b/src/libcrypto.c @@ -420,38 +420,39 @@ int ssh_kdf(struct ssh_crypto_struct *crypto, } #endif -HMACCTX hmac_init(const void *key, int len, enum ssh_hmac_e type) { - HMACCTX ctx = NULL; +HMACCTX hmac_init(const void *key, int len, enum ssh_hmac_e type) +{ + HMACCTX ctx = NULL; - ctx = HMAC_CTX_new(); - if (ctx == NULL) { - return NULL; - } + ctx = HMAC_CTX_new(); + if (ctx == NULL) { + return NULL; + } - - switch(type) { + switch (type) { case SSH_HMAC_SHA1: - HMAC_Init_ex(ctx, key, len, EVP_sha1(), NULL); - break; + HMAC_Init_ex(ctx, key, len, EVP_sha1(), NULL); + break; case SSH_HMAC_SHA256: - HMAC_Init_ex(ctx, key, len, EVP_sha256(), NULL); - break; + HMAC_Init_ex(ctx, key, len, EVP_sha256(), NULL); + break; case SSH_HMAC_SHA512: - HMAC_Init_ex(ctx, key, len, EVP_sha512(), NULL); - break; + HMAC_Init_ex(ctx, key, len, EVP_sha512(), NULL); + break; case SSH_HMAC_MD5: - HMAC_Init_ex(ctx, key, len, EVP_md5(), NULL); - break; + HMAC_Init_ex(ctx, key, len, EVP_md5(), NULL); + break; default: - HMAC_CTX_free(ctx); - ctx = NULL; - } + HMAC_CTX_free(ctx); + ctx = NULL; + } - return ctx; + return ctx; } -void hmac_update(HMACCTX ctx, const void *data, unsigned long len) { - HMAC_Update(ctx, data, len); +void hmac_update(HMACCTX ctx, const void *data, unsigned long len) +{ + HMAC_Update(ctx, data, 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); } -static void evp_cipher_init(struct ssh_cipher_struct *cipher) { +static void evp_cipher_init(struct ssh_cipher_struct *cipher) +{ if (cipher->ctx == NULL) { cipher->ctx = EVP_CIPHER_CTX_new(); }