# dkim_init()

[back to index]

SYNOPSIS

    #include <dkim.h>
    DKIM_LIB *dkim_init(
    	void *(*mallocf)(void *closure, size_t nbytes),
    	void (*freef)(void *closure, void *p)
    );

Create a new instantiation of the DKIM service, for signing or verifying Internet messages.

DESCRIPTION

Called When | `dkim_init()` is called when setting up the application. The handle it returns 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
--- | ---
mallocf | Optional alternate memory allocation function. It must take two parameters: a void pointer which is the memory closure specified in calls to `dkim_sign()` or `dkim_verify()`, and 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 `dkim_sign()` or `dkim_verify()`, and the pointer to memory to be released. 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 `dkim_sign()` and `dkim_verify()`.

RETURN VALUES

- On success, a pointer to the created `DKIM_LIB` handle is returned.
- On failure, NULL is returned. Generally this means a memory allocation failure.

Copyright (c) 2005, 2007 Sendmail, Inc. and its suppliers. All rights reserved.
Copyright (c) 2009-2011, The OpenDKIM Project. All rights reserved.
By using this file, you agree to the terms and conditions set forth in the respective licenses.