EVP_BytesToKey function
- @RecordUse.new()
- @Native<Int Function(Pointer<
EVP_CIPHER> , Pointer<EVP_MD> , Pointer<Uint8> , Pointer<Uint8> , Size, UnsignedInt, Pointer<Uint8> , Pointer<Uint8> )>(ffi.Pointer<EVP_CIPHER>, ffi.Pointer<EVP_MD>, ffi.Pointer<ffi.Uint8>, ffi.Pointer<ffi.Uint8>, ffi.Size, ffi.UnsignedInt, ffi.Pointer<ffi.Uint8>, ffi.Pointer<ffi.Uint8>)>(symbol: 'bssl_dart_EVP_BytesToKey')
EVP_BytesToKey generates a key and IV for the cipher |type| by iterating |md| |count| times using |data| and an optional |salt|, writing the result to |key| and |iv|. If not NULL, the |key| and |iv| buffers must have enough space to hold a key and IV for |type|, as returned by |EVP_CIPHER_key_length| and |EVP_CIPHER_iv_length|. This function returns the length of the key (without the IV) on success or zero on error.
If |salt| is NULL, the empty string is used as the salt. Salt lengths other than 0 and 8 are not supported by this function. Either of |key| or |iv| may be NULL to skip that output.
When the total data derived is less than the size of |md|, this function implements PBKDF1 from RFC 8018. Otherwise, it generalizes PBKDF1 by computing prepending the previous output to |data| and re-running PBKDF1 for further output.
This function is provided for compatibility with legacy uses of PBKDF1. New applications should use a more modern algorithm, such as |EVP_PBE_scrypt|.
Implementation
@meta.RecordUse()
@ffi.Native<
ffi.Int Function(
ffi.Pointer<EVP_CIPHER>,
ffi.Pointer<EVP_MD>,
ffi.Pointer<ffi.Uint8>,
ffi.Pointer<ffi.Uint8>,
ffi.Size,
ffi.UnsignedInt,
ffi.Pointer<ffi.Uint8>,
ffi.Pointer<ffi.Uint8>,
)
>(symbol: 'bssl_dart_EVP_BytesToKey')
external int EVP_BytesToKey(
ffi.Pointer<EVP_CIPHER> type,
ffi.Pointer<EVP_MD> md,
ffi.Pointer<ffi.Uint8> salt,
ffi.Pointer<ffi.Uint8> data,
int data_len,
int count,
ffi.Pointer<ffi.Uint8> key,
ffi.Pointer<ffi.Uint8> iv,
);