pkcs11.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2014  Internet Systems Consortium, Inc. ("ISC")
00003  *
00004  * Permission to use, copy, modify, and/or distribute this software for any
00005  * purpose with or without fee is hereby granted, provided that the above
00006  * copyright notice and this permission notice appear in all copies.
00007  *
00008  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
00009  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
00010  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
00011  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
00012  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
00013  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00014  * PERFORMANCE OF THIS SOFTWARE.
00015  */
00016 
00017 #ifdef PKCS11CRYPTO
00018 
00019 #include <config.h>
00020 
00021 #include <dns/log.h>
00022 #include <dns/result.h>
00023 
00024 #include <pk11/pk11.h>
00025 #include <pk11/internal.h>
00026 
00027 #include "dst_pkcs11.h"
00028 
00029 isc_result_t
00030 dst__pkcs11_toresult(const char *funcname, const char *file, int line,
00031                      isc_result_t fallback, CK_RV rv)
00032 {
00033         isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL,
00034                       DNS_LOGMODULE_CRYPTO, ISC_LOG_WARNING,
00035                       "%s:%d: %s: Error = 0x%.8lX\n",
00036                       file, line, funcname, rv);
00037         if (rv == CKR_HOST_MEMORY)
00038                 return (ISC_R_NOMEMORY);
00039         return (fallback);
00040 }
00041 
00042 
00043 #else /* PKCS11CRYPTO */
00044 
00045 #include <isc/util.h>
00046 
00047 EMPTY_TRANSLATION_UNIT
00048 
00049 #endif /* PKCS11CRYPTO */
00050 /*! \file */

Generated on Tue Apr 28 17:40:58 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha