EVP_AEAD_CTX_seal_scatter function

  1. @RecordUse.new()
  2. @Native<Int Function(Pointer<EVP_AEAD_CTX>, Pointer<Uint8>, Pointer<Uint8>, Pointer<Size>, Size, Pointer<Uint8>, Size, Pointer<Uint8>, Size, Pointer<Uint8>, Size, Pointer<Uint8>, Size)>(ffi.Pointer<EVP_AEAD_CTX>, ffi.Pointer<ffi.Uint8>, ffi.Pointer<ffi.Uint8>, ffi.Pointer<ffi.Size>, ffi.Size, ffi.Pointer<ffi.Uint8>, ffi.Size, ffi.Pointer<ffi.Uint8>, ffi.Size, ffi.Pointer<ffi.Uint8>, ffi.Size, ffi.Pointer<ffi.Uint8>, ffi.Size)>(symbol: 'bssl_dart_EVP_AEAD_CTX_seal_scatter')
int EVP_AEAD_CTX_seal_scatter(
  1. Pointer<EVP_AEAD_CTX> ctx,
  2. Pointer<Uint8> out,
  3. Pointer<Uint8> out_tag,
  4. Pointer<Size> out_tag_len,
  5. int max_out_tag_len,
  6. Pointer<Uint8> nonce,
  7. int nonce_len,
  8. Pointer<Uint8> in$,
  9. int in_len,
  10. Pointer<Uint8> extra_in,
  11. int extra_in_len,
  12. Pointer<Uint8> ad,
  13. int ad_len,
)

EVP_AEAD_CTX_seal_scatter encrypts and authenticates |in_len| bytes from |in| and authenticates |ad_len| bytes from |ad|. It writes |in_len| bytes of ciphertext to |out| and the authentication tag to |out_tag|. It returns one on success and zero otherwise.

This function may be called concurrently with itself or any other seal/open function on the same |EVP_AEAD_CTX|.

Exactly |in_len| bytes are written to |out|, and up to |EVP_AEAD_max_overhead+extra_in_len| bytes to |out_tag|. On successful return, |*out_tag_len| is set to the actual number of bytes written to |out_tag|.

|extra_in| may point to an additional plaintext input buffer if the cipher supports it. If present, |extra_in_len| additional bytes of plaintext are encrypted and authenticated, and the ciphertext is written (before the tag) to |out_tag|. |max_out_tag_len| must be sized to allow for the additional |extra_in_len| bytes.

The length of |nonce|, |nonce_len|, must be equal to the result of |EVP_AEAD_nonce_length| for this AEAD.

|EVP_AEAD_CTX_seal_scatter| never results in a partial output. If |max_out_tag_len| is insufficient, zero will be returned. If any error occurs, |out| and |out_tag| will be filled with zero bytes and |*out_tag_len| set to zero.

If |in| and |out| alias then |out| must be == |in|. |out_tag| may not alias any other argument.

Implementation

@meta.RecordUse()
@ffi.Native<
  ffi.Int Function(
    ffi.Pointer<EVP_AEAD_CTX>,
    ffi.Pointer<ffi.Uint8>,
    ffi.Pointer<ffi.Uint8>,
    ffi.Pointer<ffi.Size>,
    ffi.Size,
    ffi.Pointer<ffi.Uint8>,
    ffi.Size,
    ffi.Pointer<ffi.Uint8>,
    ffi.Size,
    ffi.Pointer<ffi.Uint8>,
    ffi.Size,
    ffi.Pointer<ffi.Uint8>,
    ffi.Size,
  )
>(symbol: 'bssl_dart_EVP_AEAD_CTX_seal_scatter')
external int EVP_AEAD_CTX_seal_scatter(
  ffi.Pointer<EVP_AEAD_CTX> ctx,
  ffi.Pointer<ffi.Uint8> out,
  ffi.Pointer<ffi.Uint8> out_tag,
  ffi.Pointer<ffi.Size> out_tag_len,
  int max_out_tag_len,
  ffi.Pointer<ffi.Uint8> nonce,
  int nonce_len,
  ffi.Pointer<ffi.Uint8> in$,
  int in_len,
  ffi.Pointer<ffi.Uint8> extra_in,
  int extra_in_len,
  ffi.Pointer<ffi.Uint8> ad,
  int ad_len,
);