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.

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);

   free(firma);
   EVP_PKEY_free(clave_EVP);

*******************************************************************
Silvia Pavon

_________________________________________________________________________________
NOTA: La informaci�n de este correo es de propiedad exclusiva y
confidencial. Este mensaje es s�lo para el destinatario se�alado, si usted
no lo es, destr�yalo de inmediato. Ninguna informaci�n aqu� contenida debe
ser entendida como dada o avalada por Alestra, sus subsidiarias o sus
empleados, salvo cuando ello expresamente se indique. Es responsabilidad de
quien recibe este correo de asegurarse que est� libre de virus, por lo
tanto ni Alestra, sus subsidiarias ni sus empleados aceptan responsabilidad
alguna.
NOTE:  The information in this email is proprietary and confidential. This
message is for the designated recipient only, if you are not the intended
recipient, you should destroy it immediately. Any information in this
message shall not be understood as given or endorsed by Alestra, its
subsidiaries or their employees, unless expressly so stated. It is the
responsibility of the recipient to ensure that this email is virus free,
therefore neither Alestra, its subsidiaries nor their employees accept any
responsibility.

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [email protected]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to