EVP_DecryptUpdate_ex function

  1. @RecordUse.new()
  2. @Native<Int Function(Pointer<EVP_CIPHER_CTX>, Pointer<Uint8>, Pointer<Size>, Size, Pointer<Uint8>, Size)>(ffi.Pointer<EVP_CIPHER_CTX>, ffi.Pointer<ffi.Uint8>, ffi.Pointer<ffi.Size>, ffi.Size, ffi.Pointer<ffi.Uint8>, ffi.Size)>(symbol: 'bssl_dart_EVP_DecryptUpdate_ex')
int EVP_DecryptUpdate_ex(
  1. Pointer<EVP_CIPHER_CTX> ctx,
  2. Pointer<Uint8> out,
  3. Pointer<Size> out_len,
  4. int max_out_len,
  5. Pointer<Uint8> in$,
  6. int in_len,
)

EVP_DecryptUpdate_ex decrypts in_len bytes from in and writes up to max_out_len bytes of plaintext to out. On success, it sets *out_len to the number of output bytes and returns one. Otherwise, it returns zero.

If max_out_len is not large enough for the output, the function will return zero. The size of output buffer needed depends on the cipher and the number of bytes decrypted by ctx thus far. EVP_CIPHER_CTX_max_next_update will return the maximum output for this call.

In ciphers whose block size is not 1, such as CBC, individual calls to EVP_DecryptUpdate_ex may output more or less than in_len bytes: a single call to EVP_DecryptUpdate_ex may output at most in_len + block_size - 1 bytes. Additionally, the total output across all EVP_DecryptUpdate_ex and EVP_DecryptFinal_ex2 calls will be at most the total input.

WARNING: if the cipher is an AEAD cipher, decrypted data should not be parsed or otherwise processed until success has been returned by EVP_EncryptFinal_ex2.

Implementation

@meta.RecordUse()
@ffi.Native<
  ffi.Int Function(
    ffi.Pointer<EVP_CIPHER_CTX>,
    ffi.Pointer<ffi.Uint8>,
    ffi.Pointer<ffi.Size>,
    ffi.Size,
    ffi.Pointer<ffi.Uint8>,
    ffi.Size,
  )
>(symbol: 'bssl_dart_EVP_DecryptUpdate_ex')
external int EVP_DecryptUpdate_ex(
  ffi.Pointer<EVP_CIPHER_CTX> ctx,
  ffi.Pointer<ffi.Uint8> out,
  ffi.Pointer<ffi.Size> out_len,
  int max_out_len,
  ffi.Pointer<ffi.Uint8> in$,
  int in_len,
);