# dk_init()

SYNOPSIS |
    #include <dk.h>
    DK_LIB *dk_init(
    	void *(*mallocf)(void *closure, size_t nbytes),
    	void (*freef)(void *closure, void *p)
    );
Create a new instantiation for the DomainKeys service, for use signing or verifying messages.
DESCRIPTION |
Called When | `dk_init()` is called when setting up the application. It is used when generating per-message handles for signing and verifying, and is used to declare optional alternate memory allocate and free functions.
ARGUMENTS |
Argument | Description
--- | ---
malloc | Optional alternate memory allocation function. It must take two parameters, a void pointer which is the memory closure specified in calls to `dk_sign()` or `dk_verify()`, and one the number of bytes to be allocated. This allows memory allocations for a specific message to be made within the same closure.
freef | Optional alternate memory release function. It must take two parameters, a void pointer which is the memory closure specified in calls to `dk_sign()` or `dk_verify()`, and one the pointer to memory to be freed. This allows memory allocations for a specific message to be made within the same closure.
NOTES | The handle returned by this function is passed to `dk_sign()` and `dk_verify()`.

Copyright (c) 2004 Sendmail, Inc. and its suppliers. All rights reserved.
By using this file, you agree to the terms and conditions set forth in the LICENSE.