I have a sample signature generator in C which will create a hash message `<count:mac-addr>` and generate a signature.

When I use `char *message = "120:08:00:27:7c:b6:18";` 
and sign, the signature is verified successfully.

But when I use 

```
char * generate_hash()
{
    xmlDoc         *document;
    xmlNode        *root, *first_child, *node;
    char           *filename;
    char            *ap_count;
    char            *ap_mac_address;
    char            *message;

    filename = "/license.xml";

    document = xmlReadFile(filename, NULL, 0);
    root = xmlDocGetRootElement(document);
    first_child = root->children;
    for (node = first_child; node; node = node->next) {
        if ( strcmp((char*)node->name, "ap_count") == 0 ) {
            ap_count = (char*)xmlNodeGetContent(node);
        }
        if ( strcmp((char*)node->name, "ap_mac_address") == 0 ){
            ap_mac_address = (char*)xmlNodeGetContent(node);
        }
    }
    message = (char *) malloc(strlen(ap_count)+ strlen(ap_mac_address) +1 );
    memset(message,0x0,(1 + strlen(ap_count)+ strlen(ap_mac_address)));
    strcpy(message,ap_count);
    strcat(message,":");
    strcat(message,ap_mac_address);
    printf(" %d \n", (1 + strlen(ap_count)+ strlen(ap_mac_address)));
    return message;
}

```

--- while verifying,

```
char* message;
message = generate_hash();

```

I am using the below function call to generate the signature in both the cases.

```
if(RSA_sign(NID_sha256, (unsigned char*) message, strlen(message),
signature, &slen, private_key) != 1) {
    ERR_print_errors_fp(stdout);
    return 1;
}

```

The signature verification fails with this above procedure. Not sure what I am doing wrong here.

Below is the call I am using to verify the same.

```
verified = RSA_verify(NID_sha256, (unsigned char*) message,
        strlen(message), sign, file_len, public_key);

```