I think that you should initialized the EVP_MD_CTX ctx with this function:
void EVP_MD_CTX_init(EVP_MD_CTX *ctx);

or get a EVP_MD_CTX with this function:
EVP_MD_CTX *EVP_MD_CTX_create(void);

Good luck!



Silvia Gisela Pavon Velasco wrote:



Nils,
I changed to %d instead of %s it worked  =)

But althougth I changed the declaration of the third argument to:
unsigned int  *bytes_firma;
I'm still getting the warning at compilation time.

If I let:
unsigned int  *bytes_firma;     and
err = EVP_SignFinal(&ctx, firma, bytes_firma, clave_EVP);

The warning goes away but the program crashes with "Bus error(coredump)"

Shouldn't I care about the warning? I'm concern that the warning means that
Im not signing well.

Another question: I have to save the signature in a file in a base64
format, any clues how can I do this?


Silvia G. Pavón V.
Procesos de Facturación
Alestra S.A.
Tel. 8748 6100 x4107


Nils Larsch <[EMAIL PROTECTED]> Sent by: To owner-openssl-use openssl-users@openssl.org [EMAIL PROTECTED] cc Subject 27/05/2005 04:29 Re: EVP_SignFinal third parameter p.m. type Please respond to [EMAIL PROTECTED] nssl.org



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]


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

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

Reply via email to