removed trailing spaces ([[:space:]]+$)
This commit is contained in:
@@ -33,30 +33,30 @@ bool openssl_hash_chunk(int hash_type, chunk_t data, chunk_t *hash)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ctx = EVP_MD_CTX_create();
|
||||
|
||||
ctx = EVP_MD_CTX_create();
|
||||
if (!ctx)
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
if (!EVP_DigestInit_ex(ctx, hasher, NULL))
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
if (!EVP_DigestUpdate(ctx, data.ptr, data.len))
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
*hash = chunk_alloc(hasher->md_size);
|
||||
if (!EVP_DigestFinal_ex(ctx, hash->ptr, NULL))
|
||||
{
|
||||
chunk_free(hash);
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
ret = TRUE;
|
||||
error:
|
||||
if (ctx)
|
||||
@@ -72,18 +72,18 @@ error:
|
||||
bool openssl_bn_cat(int len, BIGNUM *a, BIGNUM *b, chunk_t *chunk)
|
||||
{
|
||||
int offset;
|
||||
|
||||
|
||||
chunk->len = len + (b ? len : 0);
|
||||
chunk->ptr = malloc(chunk->len);
|
||||
memset(chunk->ptr, 0, chunk->len);
|
||||
|
||||
|
||||
/* convert a */
|
||||
offset = len - BN_num_bytes(a);
|
||||
if (!BN_bn2bin(a, chunk->ptr + offset))
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
/* optionally convert and concatenate b */
|
||||
if (b)
|
||||
{
|
||||
@@ -92,8 +92,8 @@ bool openssl_bn_cat(int len, BIGNUM *a, BIGNUM *b, chunk_t *chunk)
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
error:
|
||||
chunk_free(chunk);
|
||||
@@ -107,20 +107,20 @@ error:
|
||||
bool openssl_bn_split(chunk_t chunk, BIGNUM *a, BIGNUM *b)
|
||||
{
|
||||
int len;
|
||||
|
||||
|
||||
if ((chunk.len % 2) != 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
len = chunk.len / 2;
|
||||
|
||||
|
||||
if (!BN_bin2bn(chunk.ptr, len, a) ||
|
||||
!BN_bin2bn(chunk.ptr + len, len, b))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user