EVP_EncryptUpdate_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_EncryptUpdate_ex')
int EVP_EncryptUpdate_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_EncryptUpdate_ex encrypts |in_len| bytes from |in| and writes up to |max_out| bytes of ciphertext to |out|. On success, it sets |*out_len| to the number of output bytes and returns one. Otherwise, it returns zero.

If |max_out| 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 encrypted by |ctx| thus far.

In ciphers whose block size is not 1, such as CBC, individual calls to |EVP_EncryptUpdate_ex| may output more or less than |in_len| bytes: a single call to |EVP_EncryptUpdate_ex| may output at most |in_len + block_size - 1| bytes. Additionally, the total output across all |EVP_EncryptUpdate_ex| and |EVP_EncryptFinal_ex2| calls will be at most the total input plus one byte, rounded up to a multiple of the block size.

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_EncryptUpdate_ex')
external int EVP_EncryptUpdate_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,
);