mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-01 19:54:40 +02:00
COMPAT. LAYER : jenkins warnings and spacing around if statements
This commit is contained in:
@@ -63,7 +63,7 @@ WOLFSSL_API long wolfSSL_BIO_int_ctrl(WOLFSSL_BIO *bp, int cmd, long larg, int i
|
||||
WOLFSSL_API const WOLFSSL_BIO_METHOD *wolfSSL_BIO_s_socket(void)
|
||||
{
|
||||
WOLFSSL_ENTER("BIO_s_socket");
|
||||
return (void *)0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*** TBD ***/
|
||||
|
@@ -2845,9 +2845,9 @@ int wc_InitAes_h(Aes* aes, void* h)
|
||||
#ifdef HAVE_AES_ECB
|
||||
int wc_AesEcbEncrypt(Aes* aes, byte* out, const byte* in, word32 sz)
|
||||
{
|
||||
if((in == NULL) || (out == NULL) || (aes == NULL))
|
||||
if ((in == NULL) || (out == NULL) || (aes == NULL))
|
||||
return BAD_FUNC_ARG;
|
||||
while(sz>0){
|
||||
while (sz>0) {
|
||||
wc_AesEncryptDirect(aes, out, in);
|
||||
out += AES_BLOCK_SIZE;
|
||||
in += AES_BLOCK_SIZE;
|
||||
@@ -2857,9 +2857,9 @@ int wc_AesEcbEncrypt(Aes* aes, byte* out, const byte* in, word32 sz)
|
||||
}
|
||||
int wc_AesEcbDecrypt(Aes* aes, byte* out, const byte* in, word32 sz)
|
||||
{
|
||||
if((in == NULL) || (out == NULL) || (aes == NULL))
|
||||
if ((in == NULL) || (out == NULL) || (aes == NULL))
|
||||
return BAD_FUNC_ARG;
|
||||
while(sz>0){
|
||||
while (sz>0) {
|
||||
wc_AesDecryptDirect(aes, out, in);
|
||||
out += AES_BLOCK_SIZE;
|
||||
in += AES_BLOCK_SIZE;
|
||||
|
@@ -71,8 +71,8 @@ static int fillBuff(WOLFSSL_EVP_CIPHER_CTX *ctx, const unsigned char *in, int sz
|
||||
int fill;
|
||||
WOLFSSL_ENTER("fillBuff");
|
||||
printf("ctx->bufUsed=%d, sz=%d\n",ctx->bufUsed, sz);
|
||||
if(sz > 0){
|
||||
if((sz+ctx->bufUsed) > ctx->block_size){
|
||||
if (sz > 0) {
|
||||
if ((sz+ctx->bufUsed) > ctx->block_size) {
|
||||
fill = ctx->block_size - ctx->bufUsed;
|
||||
} else {
|
||||
fill = sz;
|
||||
@@ -114,7 +114,7 @@ static int evpCipherBlock(WOLFSSL_EVP_CIPHER_CTX *ctx,
|
||||
case AES_128_ECB_TYPE:
|
||||
case AES_192_ECB_TYPE:
|
||||
case AES_256_ECB_TYPE:
|
||||
if(ctx->enc)
|
||||
if (ctx->enc)
|
||||
wc_AesEcbEncrypt(&ctx->cipher.aes, out, in, inl);
|
||||
else
|
||||
wc_AesEcbDecrypt(&ctx->cipher.aes, out, in, inl);
|
||||
@@ -122,13 +122,13 @@ static int evpCipherBlock(WOLFSSL_EVP_CIPHER_CTX *ctx,
|
||||
#endif
|
||||
#ifndef NO_DES3
|
||||
case DES_CBC_TYPE:
|
||||
if(ctx->enc)
|
||||
if (ctx->enc)
|
||||
wc_Des_CbcEncrypt(&ctx->cipher.des, out, in, inl);
|
||||
else
|
||||
wc_Des_CbcDecrypt(&ctx->cipher.des, out, in, inl);
|
||||
break;
|
||||
case DES_EDE3_CBC_TYPE:
|
||||
if(ctx->enc)
|
||||
if (ctx->enc)
|
||||
wc_Des3_CbcEncrypt(&ctx->cipher.des3, out, in, inl);
|
||||
else
|
||||
wc_Des3_CbcDecrypt(&ctx->cipher.des3, out, in, inl);
|
||||
@@ -138,7 +138,7 @@ static int evpCipherBlock(WOLFSSL_EVP_CIPHER_CTX *ctx,
|
||||
wc_Des_EcbEncrypt(&ctx->cipher.des, out, in, inl);
|
||||
break;
|
||||
case DES_EDE3_ECB_TYPE:
|
||||
if(ctx->enc)
|
||||
if (ctx->enc)
|
||||
wc_Des3_EcbEncrypt(&ctx->cipher.des3, out, in, inl);
|
||||
else
|
||||
wc_Des3_EcbEncrypt(&ctx->cipher.des3, out, in, inl);
|
||||
@@ -160,18 +160,17 @@ WOLFSSL_API int wolfSSL_EVP_CipherUpdate(WOLFSSL_EVP_CIPHER_CTX *ctx,
|
||||
int blocks;
|
||||
int fill;
|
||||
|
||||
if(ctx == NULL)return BAD_FUNC_ARG;
|
||||
if (ctx == NULL) return BAD_FUNC_ARG;
|
||||
WOLFSSL_ENTER("wolfSSL_EVP_CipherUpdate");
|
||||
*outl = 0;
|
||||
if(ctx->bufUsed > 0) /* concatinate them if there is anything */
|
||||
{
|
||||
if (ctx->bufUsed > 0) { /* concatinate them if there is anything */
|
||||
fill = fillBuff(ctx, in, inl);
|
||||
inl -= fill;
|
||||
in += fill;
|
||||
}
|
||||
if(ctx->bufUsed == ctx->block_size){
|
||||
if (ctx->bufUsed == ctx->block_size) {
|
||||
/* the buff is full, flash out */
|
||||
if(evpCipherBlock(ctx, out, ctx->buf, ctx->block_size) == 0)
|
||||
if (evpCipherBlock(ctx, out, ctx->buf, ctx->block_size) == 0)
|
||||
return 0;
|
||||
*outl+= ctx->block_size;
|
||||
out += ctx->block_size;
|
||||
@@ -179,20 +178,23 @@ WOLFSSL_API int wolfSSL_EVP_CipherUpdate(WOLFSSL_EVP_CIPHER_CTX *ctx,
|
||||
}
|
||||
|
||||
blocks = inl / ctx->block_size;
|
||||
if(blocks>0){
|
||||
if (blocks > 0) {
|
||||
/* process blocks */
|
||||
if(evpCipherBlock(ctx, out, ctx->buf, blocks) == 0)
|
||||
if (evpCipherBlock(ctx, out, ctx->buf, blocks) == 0)
|
||||
return 0;
|
||||
inl -= ctx->block_size * blocks;
|
||||
*outl+= ctx->block_size * blocks;
|
||||
in += ctx->block_size * blocks;
|
||||
out += ctx->block_size * blocks;
|
||||
}
|
||||
if(inl>0){
|
||||
if (inl > 0) {
|
||||
/* put fraction into buff */
|
||||
fillBuff(ctx, in, inl);
|
||||
/* no increase of outl */
|
||||
}
|
||||
|
||||
(void)out; /* silence warning in case not read */
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -210,9 +212,9 @@ static int checkPad(WOLFSSL_EVP_CIPHER_CTX *ctx)
|
||||
int n;
|
||||
WOLFSSL_ENTER("checkPad");
|
||||
n = ctx->buf[ctx->block_size-1];
|
||||
if(n > ctx->block_size)return FALSE;
|
||||
if (n > ctx->block_size) return FALSE;
|
||||
for (i = n; i < ctx->block_size; i++)
|
||||
if(ctx->buf[i] != n)
|
||||
if (ctx->buf[i] != n)
|
||||
return -1;
|
||||
return n;
|
||||
}
|
||||
@@ -221,26 +223,27 @@ WOLFSSL_API int wolfSSL_EVP_CipherFinal(WOLFSSL_EVP_CIPHER_CTX *ctx,
|
||||
unsigned char *out, int *outl)
|
||||
{
|
||||
int fl ;
|
||||
if(ctx == NULL)return BAD_FUNC_ARG;
|
||||
if (ctx == NULL) return BAD_FUNC_ARG;
|
||||
WOLFSSL_ENTER("wolfSSL_EVP_CipherFinal");
|
||||
if(ctx->flags & WOLFSSL_EVP_CIPH_NO_PADDING){
|
||||
if (ctx->flags & WOLFSSL_EVP_CIPH_NO_PADDING) {
|
||||
*outl = 0;
|
||||
return 1;
|
||||
}
|
||||
if(ctx->bufUsed > 0){
|
||||
if(ctx->enc){
|
||||
if (ctx->bufUsed > 0) {
|
||||
if (ctx->enc) {
|
||||
padBlock(ctx);
|
||||
printf("Enc: block_size=%d\n", ctx->block_size);
|
||||
PRINT_BUF(ctx->buf, ctx->block_size);
|
||||
if(evpCipherBlock(ctx, out, ctx->buf, ctx->block_size) == 0)
|
||||
if (evpCipherBlock(ctx, out, ctx->buf, ctx->block_size) == 0)
|
||||
return 0;
|
||||
*outl = ctx->block_size;
|
||||
} else {
|
||||
if(evpCipherBlock(ctx, out, ctx->buf, ctx->block_size) == 0)
|
||||
}
|
||||
else {
|
||||
if (evpCipherBlock(ctx, out, ctx->buf, ctx->block_size) == 0)
|
||||
return 0;
|
||||
printf("Dec: block_size=%d\n", ctx->block_size);
|
||||
PRINT_BUF(ctx->buf, ctx->block_size);
|
||||
if((fl = checkPad(ctx)) >= 0){
|
||||
if ((fl = checkPad(ctx)) >= 0) {
|
||||
XMEMCPY(out, ctx->buf, fl);
|
||||
*outl = fl;
|
||||
} else return 0;
|
||||
@@ -251,8 +254,8 @@ WOLFSSL_API int wolfSSL_EVP_CipherFinal(WOLFSSL_EVP_CIPHER_CTX *ctx,
|
||||
|
||||
WOLFSSL_API int wolfSSL_EVP_CIPHER_CTX_block_size(const WOLFSSL_EVP_CIPHER_CTX *ctx)
|
||||
{
|
||||
if(ctx == NULL)return BAD_FUNC_ARG;
|
||||
switch(ctx->cipherType){
|
||||
if (ctx == NULL) return BAD_FUNC_ARG;
|
||||
switch (ctx->cipherType) {
|
||||
|
||||
#if !defined(NO_AES) && defined(HAVE_AES_CBC)
|
||||
case AES_128_CBC_TYPE:
|
||||
@@ -283,7 +286,7 @@ WOLFSSL_API int wolfSSL_EVP_CIPHER_CTX_block_size(const WOLFSSL_EVP_CIPHER_CTX *
|
||||
|
||||
static unsigned char cipherType(const WOLFSSL_EVP_CIPHER *cipher)
|
||||
{
|
||||
if(0)return 0; /* dummy for #ifdef */
|
||||
if (0) return 0; /* dummy for #ifdef */
|
||||
#ifndef NO_DES3
|
||||
else if (XSTRNCMP(cipher, EVP_DES_CBC, EVP_DES_SIZE) == 0)
|
||||
return DES_CBC_TYPE;
|
||||
@@ -326,8 +329,8 @@ static unsigned char cipherType(const WOLFSSL_EVP_CIPHER *cipher)
|
||||
|
||||
WOLFSSL_API int wolfSSL_EVP_CIPHER_block_size(const WOLFSSL_EVP_CIPHER *cipher)
|
||||
{
|
||||
if(cipher == NULL)return BAD_FUNC_ARG;
|
||||
switch(cipherType(cipher)){
|
||||
if (cipher == NULL) return BAD_FUNC_ARG;
|
||||
switch (cipherType(cipher)) {
|
||||
#if !defined(NO_AES) && defined(HAVE_AES_CBC)
|
||||
case AES_128_CBC_TYPE: return 16;
|
||||
case AES_192_CBC_TYPE: return 24;
|
||||
@@ -356,7 +359,7 @@ WOLFSSL_API int wolfSSL_EVP_CIPHER_block_size(const WOLFSSL_EVP_CIPHER *cipher)
|
||||
|
||||
unsigned long WOLFSSL_CIPHER_mode(const WOLFSSL_EVP_CIPHER *cipher)
|
||||
{
|
||||
switch(cipherType(cipher)){
|
||||
switch (cipherType(cipher)) {
|
||||
#if !defined(NO_AES) && defined(HAVE_AES_CBC)
|
||||
case AES_128_CBC_TYPE:
|
||||
case AES_192_CBC_TYPE:
|
||||
@@ -390,7 +393,7 @@ unsigned long WOLFSSL_CIPHER_mode(const WOLFSSL_EVP_CIPHER *cipher)
|
||||
|
||||
WOLFSSL_API unsigned long WOLFSSL_EVP_CIPHER_mode(const WOLFSSL_EVP_CIPHER *cipher)
|
||||
{
|
||||
if(cipher == NULL)return BAD_FUNC_ARG;
|
||||
if (cipher == NULL) return BAD_FUNC_ARG;
|
||||
return WOLFSSL_CIPHER_mode(cipher);
|
||||
}
|
||||
|
||||
@@ -401,14 +404,19 @@ WOLFSSL_API void wolfSSL_EVP_CIPHER_CTX_set_flags(WOLFSSL_EVP_CIPHER_CTX *ctx, i
|
||||
|
||||
WOLFSSL_API unsigned long wolfSSL_EVP_CIPHER_flags(const WOLFSSL_EVP_CIPHER *cipher)
|
||||
{
|
||||
if(cipher == NULL)return BAD_FUNC_ARG;
|
||||
if (cipher == NULL) return BAD_FUNC_ARG;
|
||||
return WOLFSSL_CIPHER_mode(cipher);
|
||||
}
|
||||
|
||||
WOLFSSL_API int wolfSSL_EVP_CIPHER_CTX_set_padding(WOLFSSL_EVP_CIPHER_CTX *ctx, int padding)
|
||||
{
|
||||
if(ctx == NULL)return BAD_FUNC_ARG;
|
||||
if(padding)ctx->flags &= ~WOLFSSL_EVP_CIPH_NO_PADDING;
|
||||
else ctx->flags |= WOLFSSL_EVP_CIPH_NO_PADDING;
|
||||
if (ctx == NULL) return BAD_FUNC_ARG;
|
||||
if (padding) {
|
||||
ctx->flags &= ~WOLFSSL_EVP_CIPH_NO_PADDING;
|
||||
}
|
||||
else {
|
||||
ctx->flags |= WOLFSSL_EVP_CIPH_NO_PADDING;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@@ -2,6 +2,7 @@
|
||||
# All paths should be given relative to the root
|
||||
|
||||
EXTRA_DIST += wolfcrypt/src/misc.c
|
||||
EXTRA_DIST += wolfcrypt/src/evp.c
|
||||
EXTRA_DIST += wolfcrypt/src/asm.c
|
||||
EXTRA_DIST += wolfcrypt/src/aes_asm.asm
|
||||
|
||||
|
@@ -3,6 +3,7 @@
|
||||
|
||||
nobase_include_HEADERS+= \
|
||||
wolfssl/openssl/asn1.h \
|
||||
wolfssl/openssl/aes.h\
|
||||
wolfssl/openssl/bio.h \
|
||||
wolfssl/openssl/bn.h \
|
||||
wolfssl/openssl/conf.h \
|
||||
|
@@ -530,7 +530,6 @@ WOLFSSL_API long wolfSSL_BIO_seek(WOLFSSL_BIO *bio, int ofs);
|
||||
WOLFSSL_API long wolfSSL_BIO_write_filename(WOLFSSL_BIO *bio, char *name);
|
||||
WOLFSSL_API long wolfSSL_BIO_set_mem_eof_return(WOLFSSL_BIO *bio, int v);
|
||||
WOLFSSL_API long wolfSSL_BIO_get_mem_ptr(WOLFSSL_BIO *b, void *m);
|
||||
const WOLFSSL_BIO_METHOD *wolfSSL_BIO_s_socket(void);
|
||||
|
||||
WOLFSSL_API void wolfSSL_RAND_screen(void);
|
||||
WOLFSSL_API const char* wolfSSL_RAND_file_name(char*, unsigned long);
|
||||
@@ -1911,8 +1910,6 @@ WOLFSSL_API STACK_OF(WOLFSSL_X509_NAME) *wolfSSL_dup_CA_list( STACK_OF(WOLFSSL_X
|
||||
|
||||
WOLFSSL_API unsigned long wolfSSL_SSL_CTX_get_options(const WOLFSSL_CTX *ctx);
|
||||
WOLFSSL_API unsigned long wolfSSL_SSL_CTX_set_options(WOLFSSL_CTX *ctx, unsigned long op);
|
||||
WOLFSSL_API unsigned long wolfSSL_SSL_get_options(const WOLFSSL *s);
|
||||
WOLFSSL_API unsigned long wolfSSL_SSL_set_options(WOLFSSL *s, unsigned long op);
|
||||
|
||||
/* end lighttpd*/
|
||||
#endif
|
||||
|
@@ -123,24 +123,6 @@ WOLFSSL_API int wc_AesCbcEncrypt(Aes* aes, byte* out,
|
||||
const byte* in, word32 sz);
|
||||
WOLFSSL_API int wc_AesCbcDecrypt(Aes* aes, byte* out,
|
||||
const byte* in, word32 sz);
|
||||
WOLFSSL_API int wc_AesEcbEncrypt(Aes* aes, byte* out,
|
||||
const byte* in, word32 sz);
|
||||
WOLFSSL_API int wc_AesEcbDecrypt(Aes* aes, byte* out,
|
||||
const byte* in, word32 sz);
|
||||
|
||||
#ifdef HAVE_AES_ECB
|
||||
WOLFSSL_API int wc_AesEcbEncrypt(Aes* aes, byte* out,
|
||||
const byte* in, word32 sz);
|
||||
WOLFSSL_API int wc_AesEcbDecrypt(Aes* aes, byte* out,
|
||||
const byte* in, word32 sz);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_AES_ECB
|
||||
WOLFSSL_API int wc_AesEcbEncrypt(Aes* aes, byte* out,
|
||||
const byte* in, word32 sz);
|
||||
WOLFSSL_API int wc_AesEcbDecrypt(Aes* aes, byte* out,
|
||||
const byte* in, word32 sz);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_AES_ECB
|
||||
WOLFSSL_API int wc_AesEcbEncrypt(Aes* aes, byte* out,
|
||||
|
Reference in New Issue
Block a user