1

(12 replies, posted in wolfSSL)

Working in IAR 6.5 , trying to open wolfssl 3.15.3

2

(12 replies, posted in wolfSSL)

wolfCrypt-Lib - Debug.

Error:

Fatal Error[Pe1696]: cannot open source file "D:\Stas\wolfssl-3.15.3\wolfssl-3.15.3\wolfcrypt\src\sp.c"


Can you tell me, what's wrong?

3

(12 replies, posted in wolfSSL)

I should go anouther way...
The goal - is to launch any working test project, that will be compiled. I go in wolfssl-3.15.3/IDE/IAR-EWARM/Projects/wolfssl :

wolfCrypt-test - Debug.

Error:

Fatal Error[Li001]: could not open file "D:\Stas\wolfssl-3.15.3\wolfssl-3.15.3\IDE\IAR-EWARM\Projects\lib\ewarm\Exe\wolfSSL-Lib.a"

4

(12 replies, posted in wolfSSL)

Hi, Jacob!
Changing flag resolved the problem with 2 functions:

 int flag = WOLFMEM_GENERAL;//       0x01
    ret = wolfSSL_CTX_load_static_memory(&ctx, wolfTLSv1_2_client_method_ex, memory, memorySz, 0x01, MAX_CONCURRENT_HANDSHAKES);
    if (ret != SSL_SUCCESS) {
    // handle error case
      goto fail;
    }
    flag = WOLFMEM_IO_POOL;
    // load in memory for use with IO
    ret = wolfSSL_CTX_load_static_memory(&ctx, NULL, IO, IOSz, flag, MAX_CONCURRENT_IO);
    if (ret != SSL_SUCCESS) {
    // handle error case
      goto fail;
    }

now they return SSL_SUCCESS.

Next problem - this functions dont return SSL_SUCCESS :

ret = wolfSSL_CTX_load_verify_buffer(ctx, dh_key_der_1024, 
                                         sizeof_dh_key_der_1024, SSL_FILETYPE_ASN1);
    if (ret != SSL_SUCCESS) {
        // error loading key from buffer
        goto fail;
    }

AllocDer() returns MEMORY_E;

5

(12 replies, posted in wolfSSL)

There is mistake in description: https://www.wolfssl.com/docs/wolfssl-ma … llocation/

0 - default general memory
WOLFMEM_IO_POOL - used for input/output buffer when sending receiving messages.
        Overrides general memory, so all memory in buffer passed in is used for IO.
WOLFMEM_IO_FIXED - same as WOLFMEM_IO_POOL but each SSL now keeps two
        buffers to themselves for their lifetime.
WOLFMEM_TRACK_STATS - each SSL keeps track of memory stats while running.


while we have such defines in wolfssl-3.15.3/memory.h

    #define WOLFMEM_GENERAL       0x01
    #define WOLFMEM_IO_POOL       0x02
    #define WOLFMEM_IO_POOL_FIXED 0x04
    #define WOLFMEM_TRACK_STATS   0x08

thats why i have problems with static memory - i have used wrong flag.

6

(12 replies, posted in wolfSSL)

STM32, IAR, STATIC_MEMORY
i have some problems - cant get "method", in function wolfTLSv1_2_client_method  - always getting NULL

this is my user_settnigs.h :

#define SINGLE_THREADED  /* or define RTOS  option */
#define NO_FILESYSTEM
#define NO_ASN_TIME
#define NO_WOLFSSL_SERVER
#define NO_INLINE
#define USER_TIME
#define WOLFSSL_USER_IO
#define SIZEOF_LONG_LONG 8
#define WOLFSSL_STATIC_MEMORY
#define USE_FAST_MATH
#define WOLFSSL_NO_MALLOC

this is my settnigs.h :

 #define WOLFSSL_IAR_ARM 

This is my tls-client function:

#define MAXSZ              1024
#define MAXxxx             256

   
   
   
/*------------------------------------------------------------------------*/
/* TLS CLIENT */
/*------------------------------------------------------------------------*/


int tls_client_func(void)
{

    char reply[MAXSZ];
    int msgSz, error;
    char msg[] = "Hello WolfSSL!\r\n";
    
    
    WOLFSSL_CTX* ctx;
    WOLFSSL* ssl;
    
    int ret;
    int MAX_CONCURRENT_HANDSHAKES = 1024;
    int MAX_CONCURRENT_IO = 1024;
      
    unsigned char memory[MAXxxx];
    int memorySz = MAXxxx;
    unsigned char IO[MAXxxx];
    int IOSz = MAXxxx;
    int flag = WOLFMEM_IO_POOL | WOLFMEM_TRACK_STATS;
    
    // create ctx also using static memory, start with general memory to use
    ctx = NULL;
    
    wolfSSL_Init();
    
[b]   // Here, next function doesnt work, gets not SSL_SUCCESS[/b]

    ret = wolfSSL_CTX_load_static_memory(&ctx, wolfTLSv1_2_client_method_ex, memory, memorySz, 0, MAX_CONCURRENT_HANDSHAKES);
    if (ret != SSL_SUCCESS) {
    // handle error case
      goto fail;
    }
    
    // load in memory for use with IO
    ret = wolfSSL_CTX_load_static_memory(&ctx, NULL, IO, IOSz, flag, MAX_CONCURRENT_IO);
    if (ret != SSL_SUCCESS) {
    // handle error case
      goto fail;
    }
    
    
    
    /*------------------------------------------------------------------------*/
    /* ECDHE-ECDSA */
    /*------------------------------------------------------------------------*/
    /*--------------------*/
    /* for peer auth use: */
    /*--------------------*/
    //    wolfSSL_CTX_load_verify_buffer(ctx, rsa_key_der_1024,
    //                                    sizeof_rsa_key_der_1024, SSL_FILETYPE_ASN1);
    //    wolfSSL_CTX_load_verify_buffer(ctx, server_cert_der_1024,
    //                                    sizeof_server_cert_der_1024, SSL_FILETYPE_ASN1);
    /*---------------------*/
    /* for no peer auth:   */
    /*---------------------*/
    wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0);
    /*---------------------*/
    /* end peer auth option*/
    /*---------------------*/
    if ((ret = wolfSSL_CTX_set_cipher_list(ctx, "ECDHE-ECDSA-AES128-SHA256")) != SSL_SUCCESS) {
        wolfSSL_CTX_free(ctx);
        //printf("CTXset_cipher_list failed, error: %d\n", ret);
        goto fail;
    }
    /*------------------------------------------------------------------------*/
    /* END CIPHER SUITE OPTIONS */
    /*------------------------------------------------------------------------*/
    wolfSSL_CTX_SetIORecv(ctx, CbIORecv);
    wolfSSL_CTX_SetIOSend(ctx, CbIOSend);
    
    /*
    if ((ssl = wolfSSL_new(ctx)) == NULL) {
        error = wolfSSL_get_error(ssl, 0);
        //printf("wolfSSL_new failed %d\n", error);
        wolfSSL_CTX_free(ctx);
        return -1;
    }
    */
    /* non blocking accept and connect */
    
    ret = SSL_FAILURE;

    while (ret != SSL_SUCCESS) {
        /* client connect */
        ret = wolfSSL_connect(ssl);
        error = wolfSSL_get_error(ssl, 0);
        if (ret != SSL_SUCCESS) {
            if (error != SSL_ERROR_WANT_READ && error != SSL_ERROR_WANT_WRITE) {
                /* Fail */
                //printf("wolfSSL connect failed with return code %d\n", error);
                goto fail;
            }
        }
        /* Success */
    }

    /* read and write */
    while (1) {
        /* client send/read */
        msgSz = sizeof(msg);
        ret   = wolfSSL_write(ssl, msg, msgSz);
        error = wolfSSL_get_error(ssl, 0);
        if (ret != msgSz) {
            if (error != SSL_ERROR_WANT_READ && error != SSL_ERROR_WANT_WRITE) {
                /* Write failed */
                goto fail;
            }
        }
        /* Write succeeded */
        break;
    }

    while (1) {
        ret = wolfSSL_read(ssl, reply, sizeof(reply) - 1);
        error = wolfSSL_get_error(ssl, 0);
        if (ret < 0) {
            if (error != SSL_ERROR_WANT_READ && error != SSL_ERROR_WANT_WRITE) {
                /* Can put print here, the server enters a loop waiting to read
                 * a confirmation message at this point */
                // printf("client read failed\n");
                goto fail;
            }
            continue;
        }
        else {
            /* Can put print here, the server enters a loop waiting to read
             * a confirmation message at this point */
            reply[ret] = '\0';
            // printf("Client Received Reply: %s\n", reply);
            break;
        }

    }

    return 0;

fail:
    wolfSSL_shutdown(ssl);
    wolfSSL_free(ssl);
    wolfSSL_CTX_free(ctx);

    return -1;
}

7

(12 replies, posted in wolfSSL)

2) We decided to use static memory - so now i have some anouther problems.
first of all: How to configure Visual Studio with this ./configure --enable-staticmemory ? (took from here https://www.wolfssl.com/docs/wolfssl-ma … ocation/), cant find where to put this configuring flag.

8

(12 replies, posted in wolfSSL)

Hello!
I am working on STM32f4 project, in IAR, with my TCP connection with static memory.
1) The first problem - when i tried to build this project with dynamic memory - malloc function was recieving NULL always. I made a big heap, but doesnt work anyway. Can you help me, what is wrong.