Fix indentation.

This commit is contained in:
Simon Josefsson 2006-12-09 09:06:06 +00:00
parent 91e496ff41
commit 75b5e06773
4 changed files with 45 additions and 41 deletions

View File

@ -68,8 +68,9 @@ static LIBSSH2_CRYPT_METHOD libssh2_crypt_method_none = {
int encrypt, void **abstract) \
{ \
EVP_CIPHER_CTX *ctx = LIBSSH2_ALLOC(session, sizeof(EVP_CIPHER_CTX)); \
if (!ctx) \
if (!ctx) { \
return -1; \
} \
EVP_CIPHER_CTX_init(ctx); \
EVP_CipherInit(ctx, cipher, secret, iv, encrypt); \
*abstract = ctx; \
@ -92,19 +93,22 @@ int crypt(LIBSSH2_SESSION *session, unsigned char *block, void **abstract)
int blocksize = ctx->cipher->block_size;
unsigned char buf[EVP_MAX_BLOCK_LENGTH];
int ret;
if (blocksize == 1) /* Hack for arcfour. */
if (blocksize == 1) {
/* Hack for arcfour. */
blocksize = 8;
}
ret = EVP_Cipher(ctx, buf, block, blocksize);
if (ret == 1)
if (ret == 1) {
memcpy(block, buf, blocksize);
}
return ret == 1 ? 0 : 1;
}
int dtor(LIBSSH2_SESSION *session, void **abstract)
{
EVP_CIPHER_CTX **ctx = (EVP_CIPHER_CTX **)abstract;
if (ctx && *ctx)
{
if (ctx && *ctx) {
EVP_CIPHER_CTX_cleanup(*ctx);
LIBSSH2_FREE(session, *ctx);
*abstract = NULL;