Silvia Gisela Pavon Velasco wrote:



I'm trying to sign a file and when I try to compile it I get the following
warning in the EVP_SignFinal function:

$ cc -o sign_test -I/opt/openssl/include -lssl -lcrypto sign_test.c
cc: "sign_test.c", line 43: warning 604: Pointers are not
assignment-compatible.
cc: "sign_test.c", line 43: warning 563: Argument #3 is not the correct
type.

the third argument should be a pointer to a "unsigned int"


Although that warning I run the program but I get the next output:

$ sign_test
Key Size is 128 bytes
Sign size is

How should I declare the bytes_firma variable? Or the error is somewhere
else?

Code extract:
*******************************************************************
   // Signing
   unsigned char *firma;
   int           bytes_leidos;
   int           bytes_firma;
   EVP_MD_CTX    ctx;
   char          buf[TAM_BUF];
   int           err;

   firma = (unsigned char *) malloc(EVP_PKEY_size(clave_EVP));

   EVP_SignInit_ex(&ctx, EVP_md5(), NULL);
   while (!feof(fp_ext)){
     bytes_leidos = fread( (void *) buf, sizeof(char), TAM_BUF, fp_ext);
     EVP_SignUpdate(&ctx, (void *) buf, bytes_leidos);
   }//while

   err = EVP_SignFinal(&ctx, firma, &bytes_firma, clave_EVP);m <-- in this
line occurs the error
   if (err != 1){
     ERR_print_errors_fp(stderr);
     exit (1);
   }//if

   printf("Sign size is %s\n",bytes_firma);

you might try %d instead of %s ;-)

Nils
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to