@@ -31,7 +31,7 @@ typedef struct we_AesBlock
3131 /** The wolfSSL AES data object. */
3232 Aes aes ;
3333 /** Buffer for streaming. */
34- unsigned char lastBlock [AES_BLOCK_SIZE ];
34+ unsigned char lastBlock [WC_AES_BLOCK_SIZE ];
3535 /** Number of buffered bytes. */
3636 unsigned int over ;
3737 /** Flag to indicate whether we are doing encrypt (1) or decrpyt (0). */
@@ -216,7 +216,7 @@ static int we_aes_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
216216 ret = we_aes_cbc_decrypt (aes , out , in , len );
217217 }
218218
219- XMEMCPY (EVP_CIPHER_CTX_iv_noconst (ctx ), aes -> aes .reg , AES_BLOCK_SIZE );
219+ XMEMCPY (EVP_CIPHER_CTX_iv_noconst (ctx ), aes -> aes .reg , WC_AES_BLOCK_SIZE );
220220 }
221221
222222 WOLFENGINE_LEAVE (WE_LOG_CIPHER , "we_aes_cbc_cipher" , ret );
@@ -328,7 +328,7 @@ int we_init_aescbc_meths()
328328 WOLFENGINE_ENTER (WE_LOG_CIPHER , "we_init_aescbc_meths" );
329329
330330 /* AES128-CBC */
331- we_aes128_cbc_ciph = EVP_CIPHER_meth_new (NID_aes_128_cbc , AES_BLOCK_SIZE ,
331+ we_aes128_cbc_ciph = EVP_CIPHER_meth_new (NID_aes_128_cbc , WC_AES_BLOCK_SIZE ,
332332 AES_128_KEY_SIZE );
333333 if (we_aes128_cbc_ciph == NULL ) {
334334 WOLFENGINE_ERROR_FUNC_NULL (WE_LOG_CIPHER ,
@@ -343,7 +343,7 @@ int we_init_aescbc_meths()
343343 /* AES192-CBC */
344344 if (ret == 1 ) {
345345 we_aes192_cbc_ciph = EVP_CIPHER_meth_new (NID_aes_192_cbc ,
346- AES_BLOCK_SIZE ,
346+ WC_AES_BLOCK_SIZE ,
347347 AES_192_KEY_SIZE );
348348 if (we_aes192_cbc_ciph == NULL ) {
349349 WOLFENGINE_ERROR_FUNC_NULL (WE_LOG_CIPHER ,
@@ -359,7 +359,7 @@ int we_init_aescbc_meths()
359359 /* AES256-CBC */
360360 if (ret == 1 ) {
361361 we_aes256_cbc_ciph = EVP_CIPHER_meth_new (NID_aes_256_cbc ,
362- AES_BLOCK_SIZE ,
362+ WC_AES_BLOCK_SIZE ,
363363 AES_256_KEY_SIZE );
364364 if (we_aes256_cbc_ciph == NULL ) {
365365 WOLFENGINE_ERROR_FUNC_NULL (WE_LOG_CIPHER ,
@@ -498,7 +498,7 @@ static int we_aes_ecb_encrypt(we_AesBlock* aes, unsigned char *out,
498498 "aes->over = %d" , aes -> over );
499499
500500 /* Partial block not yet encrypted. */
501- l = AES_BLOCK_SIZE - aes -> over ;
501+ l = WC_AES_BLOCK_SIZE - aes -> over ;
502502 if (l > len ) {
503503 l = (int )len ;
504504 }
@@ -511,10 +511,10 @@ static int we_aes_ecb_encrypt(we_AesBlock* aes, unsigned char *out,
511511 len -= l ;
512512 }
513513 /* Check if we have a complete block to encrypt. */
514- if (aes -> over == AES_BLOCK_SIZE ) {
514+ if (aes -> over == WC_AES_BLOCK_SIZE ) {
515515 /* Encrypt and return block. */
516516 rc = wc_AesEcbEncrypt (& aes -> aes , out , aes -> lastBlock ,
517- AES_BLOCK_SIZE );
517+ WC_AES_BLOCK_SIZE );
518518 if (rc != 0 ) {
519519 WOLFENGINE_ERROR_FUNC (WE_LOG_CIPHER ,
520520 "wc_AesEcbEncrypt" , rc );
@@ -523,19 +523,19 @@ static int we_aes_ecb_encrypt(we_AesBlock* aes, unsigned char *out,
523523 else {
524524 WOLFENGINE_MSG_VERBOSE (WE_LOG_CIPHER ,
525525 "Encrypted %d bytes (AES-ECB)" ,
526- AES_BLOCK_SIZE );
527- WOLFENGINE_BUFFER (WE_LOG_CIPHER , out , AES_BLOCK_SIZE );
526+ WC_AES_BLOCK_SIZE );
527+ WOLFENGINE_BUFFER (WE_LOG_CIPHER , out , WC_AES_BLOCK_SIZE );
528528 }
529529 /* Data put to output. */
530- out += AES_BLOCK_SIZE ;
530+ out += WC_AES_BLOCK_SIZE ;
531531 /* No more cached data. */
532532 aes -> over = 0 ;
533533 }
534534 }
535535 /* Encrypt full blocks from remaining input. */
536- if ((ret == 1 ) && (len >= AES_BLOCK_SIZE )) {
536+ if ((ret == 1 ) && (len >= WC_AES_BLOCK_SIZE )) {
537537 /* Calculate full blocks. */
538- l = (int )len & (~(AES_BLOCK_SIZE - 1 ));
538+ l = (int )len & (~(WC_AES_BLOCK_SIZE - 1 ));
539539
540540 rc = wc_AesEcbEncrypt (& aes -> aes , out , in , l );
541541 if (rc != 0 ) {
@@ -599,7 +599,7 @@ static int we_aes_ecb_decrypt(we_AesBlock* aes, unsigned char *out,
599599 WOLFENGINE_MSG (WE_LOG_CIPHER , "Decrypting leftover cached data, "
600600 "aes->over = %d" , aes -> over );
601601 /* Calculate amount of input that can be used. */
602- l = AES_BLOCK_SIZE - aes -> over ;
602+ l = WC_AES_BLOCK_SIZE - aes -> over ;
603603 if (l > len ) {
604604 l = (int )len ;
605605 }
@@ -612,10 +612,10 @@ static int we_aes_ecb_decrypt(we_AesBlock* aes, unsigned char *out,
612612 len -= l ;
613613 }
614614 /* Padding and not last full block or not padding and full block. */
615- if ((aes -> over == AES_BLOCK_SIZE ) || len > 0 ) {
615+ if ((aes -> over == WC_AES_BLOCK_SIZE ) || len > 0 ) {
616616 /* Decrypt block cached block. */
617617 rc = wc_AesEcbDecrypt (& aes -> aes , out , aes -> lastBlock ,
618- AES_BLOCK_SIZE );
618+ WC_AES_BLOCK_SIZE );
619619 if (rc != 0 ) {
620620 WOLFENGINE_ERROR_FUNC (WE_LOG_CIPHER ,
621621 "wc_AesEcbDecrypt" , rc );
@@ -624,19 +624,19 @@ static int we_aes_ecb_decrypt(we_AesBlock* aes, unsigned char *out,
624624 else {
625625 WOLFENGINE_MSG_VERBOSE (WE_LOG_CIPHER ,
626626 "Decrypted %d bytes (AES-ECB)" ,
627- AES_BLOCK_SIZE );
628- WOLFENGINE_BUFFER (WE_LOG_CIPHER , out , AES_BLOCK_SIZE );
627+ WC_AES_BLOCK_SIZE );
628+ WOLFENGINE_BUFFER (WE_LOG_CIPHER , out , WC_AES_BLOCK_SIZE );
629629 }
630630 /* Data put to output. */
631- out += AES_BLOCK_SIZE ;
631+ out += WC_AES_BLOCK_SIZE ;
632632 /* No more cached data. */
633633 aes -> over = 0 ;
634634 }
635635 }
636636 /* Decrypt full blocks from remaining input. */
637- if ((ret == 1 ) && (len >= AES_BLOCK_SIZE )) {
637+ if ((ret == 1 ) && (len >= WC_AES_BLOCK_SIZE )) {
638638 /* Calculate full blocks. */
639- l = (int )len & (~(AES_BLOCK_SIZE - 1 ));
639+ l = (int )len & (~(WC_AES_BLOCK_SIZE - 1 ));
640640
641641 if (l > 0 ) {
642642 rc = wc_AesEcbDecrypt (& aes -> aes , out , in , l );
@@ -812,7 +812,7 @@ int we_init_aesecb_meths()
812812 WOLFENGINE_ENTER (WE_LOG_CIPHER , "we_init_aesecb_meths" );
813813
814814 /* AES128-ECB */
815- we_aes128_ecb_ciph = EVP_CIPHER_meth_new (NID_aes_128_ecb , AES_BLOCK_SIZE ,
815+ we_aes128_ecb_ciph = EVP_CIPHER_meth_new (NID_aes_128_ecb , WC_AES_BLOCK_SIZE ,
816816 AES_128_KEY_SIZE );
817817 if (we_aes128_ecb_ciph == NULL ) {
818818 WOLFENGINE_ERROR_FUNC_NULL (WE_LOG_CIPHER ,
@@ -827,7 +827,7 @@ int we_init_aesecb_meths()
827827 /* AES192-ECB */
828828 if (ret == 1 ) {
829829 we_aes192_ecb_ciph = EVP_CIPHER_meth_new (NID_aes_192_ecb ,
830- AES_BLOCK_SIZE , AES_192_KEY_SIZE );
830+ WC_AES_BLOCK_SIZE , AES_192_KEY_SIZE );
831831 if (we_aes192_ecb_ciph == NULL ) {
832832 WOLFENGINE_ERROR_FUNC_NULL (WE_LOG_CIPHER ,
833833 "EVP_CIPHER_meth_new - AES-192-ECB" ,
@@ -842,7 +842,7 @@ int we_init_aesecb_meths()
842842 /* AES256-ECB */
843843 if (ret == 1 ) {
844844 we_aes256_ecb_ciph = EVP_CIPHER_meth_new (NID_aes_256_ecb ,
845- AES_BLOCK_SIZE , AES_256_KEY_SIZE );
845+ WC_AES_BLOCK_SIZE , AES_256_KEY_SIZE );
846846 if (we_aes256_ecb_ciph == NULL ) {
847847 WOLFENGINE_ERROR_FUNC_NULL (WE_LOG_CIPHER ,
848848 "EVP_CIPHER_meth_new - AES-256-ECB" ,
0 commit comments