EVP_PBE_scrypt function
- @RecordUse.new()
- @Native<Int Function(Pointer<
Char> , Size, Pointer<Uint8> , Size, Uint64, Uint64, Uint64, Size, Pointer<Uint8> , Size)>(ffi.Pointer<ffi.Char>, ffi.Size, ffi.Pointer<ffi.Uint8>, ffi.Size, ffi.Uint64, ffi.Uint64, ffi.Uint64, ffi.Size, ffi.Pointer<ffi.Uint8>, ffi.Size)>(symbol: 'bssl_dart_EVP_PBE_scrypt')
EVP_PBE_scrypt expands |password| into a secret key of length |key_len| using scrypt, as described in RFC 7914, and writes the result to |out_key|. It returns one on success and zero on allocation failure, if the memory required for the operation exceeds |max_mem|, or if any of the parameters are invalid as described below.
|N|, |r|, and |p| are as described in RFC 7914 section 6. They determine the cost of the operation. If |max_mem| is zero, a default limit of 65MiB will be used.
The parameters are considered invalid under any of the following conditions:
- |r| or |p| are zero
- |p| > (2^30 - 1) / |r|
- |N| is not a power of two
- |N| > 2^32
- |N| > 2^(128 * |r| / 8)
Implementation
@meta.RecordUse()
@ffi.Native<
ffi.Int Function(
ffi.Pointer<ffi.Char>,
ffi.Size,
ffi.Pointer<ffi.Uint8>,
ffi.Size,
ffi.Uint64,
ffi.Uint64,
ffi.Uint64,
ffi.Size,
ffi.Pointer<ffi.Uint8>,
ffi.Size,
)
>(symbol: 'bssl_dart_EVP_PBE_scrypt')
external int EVP_PBE_scrypt(
ffi.Pointer<ffi.Char> password,
int password_len,
ffi.Pointer<ffi.Uint8> salt,
int salt_len,
int N,
int r,
int p,
int max_mem,
ffi.Pointer<ffi.Uint8> out_key,
int key_len,
);