Assistance with openssl blowfish simple example inserting garbage characters

前端 未结 2 516
星月不相逢
星月不相逢 2020-12-15 14:37

If you have a good example of simply encrypting a file using openssl that is better than this one that I am having issues with I would be very grateful.

Up

2条回答
  •  清酒与你
    2020-12-15 14:44

    Since you say the error seems to be coming at the decryption stage, I would look with suspicion on these lines:

    if (EVP_DecryptUpdate (&ctx, outbuf, &olen, inbuff, n) != 1)
    ...
    
    if (EVP_DecryptFinal (&ctx, outbuf + olen, &tlen) != 1)
    ...
    

    How big is the memory allocated for outbuf in relation to what the decryption functions will be putting in them? Are you sure outbuf + olen is not going to take you past the end of the buffer?

提交回复
热议问题