From 62cce60a15990bf8ec05b4234a5c965a5a8e86c0 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Thu, 6 Feb 2014 15:26:54 -0800 Subject: [PATCH 1/5] [master] better error message when exceeding RPZ zone limit 3726. [cleanup] Clarified the error message when attempting to configure more than 32 response-policy zones. [RT #35283] --- CHANGES | 4 ++++ bin/named/server.c | 8 ++++++-- doc/arm/Bv9ARM-book.xml | 10 ++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index cc9a00d594..cbe306ce69 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +3726. [cleanup] Clarified the error message when attempting + to configure more than 32 response-policy zones. + [RT #35283] + 3725. [contrib] Updated zkt and nslint to newest versions, cleaned up and rearranged the contrib directory, and added a README. diff --git a/bin/named/server.c b/bin/named/server.c index b4f7918c29..15b822e016 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -1628,8 +1628,12 @@ configure_rpz_zone(dns_view_t *view, const cfg_listelt_t *element, rpz_obj = cfg_listelt_value(element); - if (view->rpzs->p.num_zones >= DNS_RPZ_MAX_ZONES) - return (ISC_R_NOMEMORY); + if (view->rpzs->p.num_zones >= DNS_RPZ_MAX_ZONES) { + cfg_obj_log(rpz_obj, ns_g_lctx, DNS_RPZ_ERROR_LEVEL, + "limit of %d response policy zones exceeded", + DNS_RPZ_MAX_ZONES); + return (ISC_R_FAILURE); + } new = isc_mem_get(view->rpzs->mctx, sizeof(*new)); if (new == NULL) { diff --git a/doc/arm/Bv9ARM-book.xml b/doc/arm/Bv9ARM-book.xml index 9d1a3450a0..16490079ae 100644 --- a/doc/arm/Bv9ARM-book.xml +++ b/doc/arm/Bv9ARM-book.xml @@ -9364,6 +9364,16 @@ deny-answer-aliases { "example.net"; }; allow-query { localhost; };. + + A response-policy option can support + multiple policy zones. To maximize performance, a radix + tree is used to quickly identify response policy zones + containing triggers that match the current query. This + imposes an upper limit of 32 on the number of policy zones + in a single response-policy option; more + than that is a configuration error. + + Five policy triggers can be encoded in RPZ records. From e5f9fa7e18d50569a7d723acbb6f641e13ed3787 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Thu, 6 Feb 2014 15:36:13 -0800 Subject: [PATCH 2/5] [master] deprecate isc_bitsrting 3727. [func] The isc_bitstring API is no longer used and has been removed from libisc. [RT #35284] --- CHANGES | 3 + lib/isc/Makefile.in | 4 +- lib/isc/bitstring.c | 127 ------------------- lib/isc/include/isc/Makefile.in | 4 +- lib/isc/include/isc/bitstring.h | 157 ------------------------ lib/isc/include/isc/types.h | 1 - lib/isc/win32/libisc.def.in | 3 - lib/isc/win32/libisc.dsp.in | 8 -- lib/isc/win32/libisc.mak.in | 24 ---- lib/isc/win32/libisc.vcxproj.filters.in | 6 - lib/isc/win32/libisc.vcxproj.in | 2 - 11 files changed, 7 insertions(+), 332 deletions(-) delete mode 100644 lib/isc/bitstring.c delete mode 100644 lib/isc/include/isc/bitstring.h diff --git a/CHANGES b/CHANGES index cbe306ce69..9546f0c6dd 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +3727. [func] The isc_bitstring API is no longer used and + has been removed from libisc. [RT #35284] + 3726. [cleanup] Clarified the error message when attempting to configure more than 32 response-policy zones. [RT #35283] diff --git a/lib/isc/Makefile.in b/lib/isc/Makefile.in index 254ae67d3b..32dd266355 100644 --- a/lib/isc/Makefile.in +++ b/lib/isc/Makefile.in @@ -54,7 +54,7 @@ WIN32OBJS = win32/condition.@O@ win32/dir.@O@ win32/file.@O@ \ # Alphabetically OBJS = @ISC_EXTRA_OBJS@ \ assertions.@O@ backtrace.@O@ base32.@O@ base64.@O@ \ - bind9.@O@ bitstring.@O@ buffer.@O@ bufferlist.@O@ \ + bind9.@O@ buffer.@O@ bufferlist.@O@ \ commandline.@O@ crc64.@O@ error.@O@ event.@O@ \ hash.@O@ heap.@O@ hex.@O@ hmacmd5.@O@ hmacsha.@O@ \ httpd.@O@ inet_aton.@O@ iterated_hash.@O@ \ @@ -73,7 +73,7 @@ SYMTBLOBJS = backtrace-emptytbl.@O@ # Alphabetically SRCS = @ISC_EXTRA_SRCS@ \ assertions.c backtrace.c base32.c base64.c bind9.c \ - bitstring.c buffer.c bufferlist.c commandline.c crc64.c \ + buffer.c bufferlist.c commandline.c crc64.c \ error.c event.c heap.c hex.c hmacmd5.c hmacsha.c \ httpd.c inet_aton.c iterated_hash.c \ lex.c lfsr.c lib.c log.c \ diff --git a/lib/isc/bitstring.c b/lib/isc/bitstring.c deleted file mode 100644 index 33c7c1fa6d..0000000000 --- a/lib/isc/bitstring.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") - * Copyright (C) 1999-2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: bitstring.c,v 1.17 2007/06/19 23:47:17 tbox Exp $ */ - -/*! \file */ - -#include - -#include - -#include -#include -#include - -#define DIV8(x) ((x) >> 3) -#define MOD8(x) ((x) & 0x00000007U) -#define OCTETS(n) (((n) + 7) >> 3) -#define PADDED(n) ((((n) + 7) >> 3) << 3) -#define BITSET(bs, n) (((bs)->data[DIV8(n)] & \ - (1 << (7 - MOD8(n)))) != 0) -#define SETBIT(bs, n) (bs)->data[DIV8(n)] |= (1 << (7 - MOD8(n))) -#define CLEARBIT(bs, n) (bs)->data[DIV8(n)] &= ~(1 << (7 - MOD8(n))) - -#define BITSTRING_MAGIC ISC_MAGIC('B', 'S', 't', 'r') -#define VALID_BITSTRING(b) ISC_MAGIC_VALID(b, BITSTRING_MAGIC) - -void -isc_bitstring_init(isc_bitstring_t *bitstring, unsigned char *data, - unsigned int length, unsigned int size, isc_boolean_t lsb0) -{ - /* - * Make 'bitstring' refer to the bitstring of 'size' bits starting - * at 'data'. 'length' bits of the bitstring are valid. If 'lsb0' - * is set then, bit 0 refers to the least significant bit of the - * bitstring. Otherwise bit 0 is the most significant bit. - */ - - REQUIRE(bitstring != NULL); - REQUIRE(data != NULL); - REQUIRE(length <= size); - - bitstring->magic = BITSTRING_MAGIC; - bitstring->data = data; - bitstring->length = length; - bitstring->size = size; - bitstring->lsb0 = lsb0; -} - -void -isc_bitstring_invalidate(isc_bitstring_t *bitstring) { - - /* - * Invalidate 'bitstring'. - */ - - REQUIRE(VALID_BITSTRING(bitstring)); - - bitstring->magic = 0; - bitstring->data = NULL; - bitstring->length = 0; - bitstring->size = 0; - bitstring->lsb0 = ISC_FALSE; -} - -void -isc_bitstring_copy(isc_bitstring_t *source, unsigned int sbitpos, - isc_bitstring_t *target, unsigned int tbitpos, - unsigned int n) -{ - unsigned int tlast; - - /* - * Starting at bit 'sbitpos', copy 'n' bits from 'source' to - * the 'n' bits of 'target' starting at 'tbitpos'. - */ - - REQUIRE(VALID_BITSTRING(source)); - REQUIRE(VALID_BITSTRING(target)); - REQUIRE(source->lsb0 == target->lsb0); - if (source->lsb0) { - REQUIRE(sbitpos <= source->length); - sbitpos = PADDED(source->size) - sbitpos; - REQUIRE(sbitpos >= n); - sbitpos -= n; - } else - REQUIRE(sbitpos + n <= source->length); - tlast = tbitpos + n; - if (target->lsb0) { - REQUIRE(tbitpos <= target->length); - tbitpos = PADDED(target->size) - tbitpos; - REQUIRE(tbitpos >= n); - tbitpos -= n; - } else - REQUIRE(tlast <= target->size); - - if (tlast > target->length) - target->length = tlast; - - /* - * This is far from optimal... - */ - - while (n > 0) { - if (BITSET(source, sbitpos)) - SETBIT(target, tbitpos); - else - CLEARBIT(target, tbitpos); - sbitpos++; - tbitpos++; - n--; - } -} diff --git a/lib/isc/include/isc/Makefile.in b/lib/isc/include/isc/Makefile.in index f8ea3b6511..bc99bd1ac4 100644 --- a/lib/isc/include/isc/Makefile.in +++ b/lib/isc/include/isc/Makefile.in @@ -26,8 +26,8 @@ top_srcdir = @top_srcdir@ # machine generated. The latter are handled specially in the # install target below. # -HEADERS = app.h assertions.h base64.h bind9.h bitstring.h boolean.h \ - buffer.h bufferlist.h commandline.h entropy.h error.h event.h \ +HEADERS = app.h assertions.h base64.h bind9.h boolean.h buffer.h \ + bufferlist.h commandline.h entropy.h error.h event.h \ eventclass.h file.h formatcheck.h fsaccess.h \ hash.h heap.h hex.h hmacmd5.h hmacsha.h \ httpd.h \ diff --git a/lib/isc/include/isc/bitstring.h b/lib/isc/include/isc/bitstring.h deleted file mode 100644 index 252d1117a7..0000000000 --- a/lib/isc/include/isc/bitstring.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") - * Copyright (C) 1999-2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: bitstring.h,v 1.14 2007/06/19 23:47:18 tbox Exp $ */ - -#ifndef ISC_BITSTRING_H -#define ISC_BITSTRING_H 1 - -/***** - ***** Module Info - *****/ - -/*! \file isc/bitstring.h - * - * \brief Bitstring manipulation functions. - * - * A bitstring is a packed array of bits, stored in a contiguous - * sequence of octets. The "most significant bit" (msb) of a bitstring - * is the high bit of the first octet. The "least significant bit" of a - * bitstring is the low bit of the last octet. - * - * Two bit numbering schemes are supported, "msb0" and "lsb0". - * - * In the "msb0" scheme, bit number 0 designates the most significant bit, - * and any padding bits required to make the bitstring a multiple of 8 bits - * long are added to the least significant end of the last octet. - * - * In the "lsb0" scheme, bit number 0 designates the least significant bit, - * and any padding bits required to make the bitstring a multiple of 8 bits - * long are added to the most significant end of the first octet. - * - * E.g., consider the bitstring "11010001111". This bitstring is 11 bits - * long and will take two octets. Let "p" denote a pad bit. In the msb0 - * encoding, it would be - * - * \verbatim - * Octet 0 Octet 1 - * | - * 1 1 0 1 0 0 0 1 | 1 1 1 p p p p p - * ^ | ^ - * | | - * bit 0 bit 15 - * \endverbatim - * - * In the lsb0 encoding, it would be - * - * \verbatim - * Octet 0 Octet 1 - * | - * p p p p p 1 1 0 | 1 0 0 0 1 1 1 1 - * ^ | ^ - * | | - * bit 15 bit 0 - * \endverbatim - */ - -/*** - *** Imports - ***/ - -#include -#include - -ISC_LANG_BEGINDECLS - -/*** - *** Types - ***/ - -struct isc_bitstring { - unsigned int magic; - unsigned char * data; - unsigned int length; - unsigned int size; - isc_boolean_t lsb0; -}; - -/*** - *** Functions - ***/ - -void -isc_bitstring_init(isc_bitstring_t *bitstring, unsigned char *data, - unsigned int length, unsigned int size, isc_boolean_t lsb0); -/*!< - * \brief Make 'bitstring' refer to the bitstring of 'size' bits starting - * at 'data'. 'length' bits of the bitstring are valid. If 'lsb0' - * is set then, bit 0 refers to the least significant bit of the - * bitstring. Otherwise bit 0 is the most significant bit. - * - * Requires: - * - *\li 'bitstring' points to a isc_bitstring_t. - * - *\li 'data' points to an array of unsigned char large enough to hold - * 'size' bits. - * - *\li 'length' <= 'size'. - * - * Ensures: - * - *\li 'bitstring' is a valid bitstring. - */ - -void -isc_bitstring_invalidate(isc_bitstring_t *bitstring); -/*!< - * \brief Invalidate 'bitstring'. - * - * Requires: - * - *\li 'bitstring' is a valid bitstring. - * - * Ensures: - * - *\li 'bitstring' is not a valid bitstring. - */ - -void -isc_bitstring_copy(isc_bitstring_t *source, unsigned int sbitpos, - isc_bitstring_t *target, unsigned int tbitpos, - unsigned int n); -/*!< - * \brief Starting at bit 'sbitpos', copy 'n' bits from 'source' to - * the 'n' bits of 'target' starting at 'tbitpos'. - * - * Requires: - * - *\li 'source' and target are valid bitstrings with the same lsb0 setting. - * - *\li 'sbitpos' + 'n' is less than or equal to the length of 'source'. - * - *\li 'tbitpos' + 'n' is less than or equal to the size of 'target'. - * - * Ensures: - * - *\li The specified bits have been copied, and the length of 'target' - * adjusted (if required). - */ - -ISC_LANG_ENDDECLS - -#endif /* ISC_BITSTRING_H */ diff --git a/lib/isc/include/isc/types.h b/lib/isc/include/isc/types.h index 011cfd2e32..a32d56130a 100644 --- a/lib/isc/include/isc/types.h +++ b/lib/isc/include/isc/types.h @@ -44,7 +44,6 @@ typedef struct isc_appctx isc_appctx_t; /*%< Application context */ typedef struct isc_backtrace_symmap isc_backtrace_symmap_t; /*%< Symbol Table Entry */ -typedef struct isc_bitstring isc_bitstring_t; /*%< Bitstring */ typedef struct isc_buffer isc_buffer_t; /*%< Buffer */ typedef ISC_LIST(isc_buffer_t) isc_bufferlist_t; /*%< Buffer List */ typedef struct isc_constregion isc_constregion_t; /*%< Const region */ diff --git a/lib/isc/win32/libisc.def.in b/lib/isc/win32/libisc.def.in index d236307e61..89262fbbab 100644 --- a/lib/isc/win32/libisc.def.in +++ b/lib/isc/win32/libisc.def.in @@ -107,9 +107,6 @@ isc_base32hex_totext isc_base64_decodestring isc_base64_tobuffer isc_base64_totext -isc_bitstring_copy -isc_bitstring_init -isc_bitstring_invalidate isc_buffer_allocate isc_buffer_compact isc_buffer_copyregion diff --git a/lib/isc/win32/libisc.dsp.in b/lib/isc/win32/libisc.dsp.in index 08fe918c4c..ad7a9a8f9f 100644 --- a/lib/isc/win32/libisc.dsp.in +++ b/lib/isc/win32/libisc.dsp.in @@ -245,10 +245,6 @@ SOURCE=.\include\isc\bindevt.h # End Source File # Begin Source File -SOURCE=..\include\isc\bitstring.h -# End Source File -# Begin Source File - SOURCE=..\include\isc\boolean.h # End Source File # Begin Source File @@ -657,10 +653,6 @@ SOURCE=..\bind9.c # End Source File # Begin Source File -SOURCE=..\bitstring.c -# End Source File -# Begin Source File - SOURCE=..\buffer.c # End Source File # Begin Source File diff --git a/lib/isc/win32/libisc.mak.in b/lib/isc/win32/libisc.mak.in index 554429a343..be5922c1d2 100644 --- a/lib/isc/win32/libisc.mak.in +++ b/lib/isc/win32/libisc.mak.in @@ -121,7 +121,6 @@ CLEAN : -@erase "$(INTDIR)\base32.obj" -@erase "$(INTDIR)\base64.obj" -@erase "$(INTDIR)\bind9.obj" - -@erase "$(INTDIR)\bitstring.obj" -@erase "$(INTDIR)\buffer.obj" -@erase "$(INTDIR)\bufferlist.obj" -@erase "$(INTDIR)\commandline.obj" @@ -257,7 +256,6 @@ LINK32_OBJS= \ "$(INTDIR)\base32.obj" \ "$(INTDIR)\base64.obj" \ "$(INTDIR)\bind9.obj" \ - "$(INTDIR)\bitstring.obj" \ "$(INTDIR)\buffer.obj" \ "$(INTDIR)\bufferlist.obj" \ "$(INTDIR)\commandline.obj" \ @@ -341,8 +339,6 @@ CLEAN : -@erase "$(INTDIR)\base64.sbr" -@erase "$(INTDIR)\bind9.obj" -@erase "$(INTDIR)\bind9.sbr" - -@erase "$(INTDIR)\bitstring.obj" - -@erase "$(INTDIR)\bitstring.sbr" -@erase "$(INTDIR)\buffer.obj" -@erase "$(INTDIR)\buffer.sbr" -@erase "$(INTDIR)\bufferlist.obj" @@ -548,7 +544,6 @@ BSC32_SBRS= \ "$(INTDIR)\base32.sbr" \ "$(INTDIR)\base64.sbr" \ "$(INTDIR)\bind9.sbr" \ - "$(INTDIR)\bitstring.sbr" \ "$(INTDIR)\buffer.sbr" \ "$(INTDIR)\bufferlist.sbr" \ "$(INTDIR)\commandline.sbr" \ @@ -646,7 +641,6 @@ LINK32_OBJS= \ "$(INTDIR)\base32.obj" \ "$(INTDIR)\base64.obj" \ "$(INTDIR)\bind9.obj" \ - "$(INTDIR)\bitstring.obj" \ "$(INTDIR)\buffer.obj" \ "$(INTDIR)\bufferlist.obj" \ "$(INTDIR)\commandline.obj" \ @@ -1254,24 +1248,6 @@ SOURCE=..\bind9.c $(CPP) $(CPP_PROJ) $(SOURCE) -!ENDIF - -SOURCE=..\bitstring.c - -!IF "$(CFG)" == "libisc - @PLATFORM@ Release" - - -"$(INTDIR)\bitstring.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - @PLATFORM@ Debug" - - -"$(INTDIR)\bitstring.obj" "$(INTDIR)\bitstring.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - !ENDIF SOURCE=..\buffer.c diff --git a/lib/isc/win32/libisc.vcxproj.filters.in b/lib/isc/win32/libisc.vcxproj.filters.in index 8b25ec4534..4bbf2dde1a 100644 --- a/lib/isc/win32/libisc.vcxproj.filters.in +++ b/lib/isc/win32/libisc.vcxproj.filters.in @@ -44,9 +44,6 @@ Library Header Files - - Library Header Files - Library Header Files @@ -443,9 +440,6 @@ Library Source Files - - Library Source Files - Library Source Files diff --git a/lib/isc/win32/libisc.vcxproj.in b/lib/isc/win32/libisc.vcxproj.in index 84f0db1236..15378af1c8 100644 --- a/lib/isc/win32/libisc.vcxproj.in +++ b/lib/isc/win32/libisc.vcxproj.in @@ -265,7 +265,6 @@ copy /Y @VCREDIST_PATH@ ..\Build\Release\ - @@ -376,7 +375,6 @@ copy /Y @VCREDIST_PATH@ ..\Build\Release\ - From 08c67b5b7a54047fbfed423a59b48c86177b9859 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Thu, 6 Feb 2014 15:40:00 -0800 Subject: [PATCH 3/5] [master] improved native-pkcs11 doc 3728. [doc] Expanded native-PKCS#11 documentation, specifically pkcs11: URI labels. [RT #35287] --- CHANGES | 3 + bin/dnssec/dnssec-keyfromlabel.docbook | 32 +- doc/arm/pkcs11.xml | 9 +- doc/draft/draft-pechanec-pkcs11uri-13.txt | 728 ++++++++++++++++++++++ 4 files changed, 767 insertions(+), 5 deletions(-) create mode 100644 doc/draft/draft-pechanec-pkcs11uri-13.txt diff --git a/CHANGES b/CHANGES index 9546f0c6dd..a9ef418455 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +3728. [doc] Expanded native-PKCS#11 documentation, + specifically pkcs11: URI labels. [RT #35287] + 3727. [func] The isc_bitstring API is no longer used and has been removed from libisc. [RT #35284] diff --git a/bin/dnssec/dnssec-keyfromlabel.docbook b/bin/dnssec/dnssec-keyfromlabel.docbook index 7c25807f90..29b6972735 100644 --- a/bin/dnssec/dnssec-keyfromlabel.docbook +++ b/bin/dnssec/dnssec-keyfromlabel.docbook @@ -151,9 +151,32 @@ -l label - Specifies the label of the key pair in the crypto hardware. - The label may be preceded by an optional OpenSSL engine name, - separated by a colon, as in "pkcs11:keylabel". + Specifies the label for a key pair in the crypto hardware. + + + When BIND 9 is built with OpenSSL-based + PKCS#11 support, the label is an arbitrary string that + identifies a particular key. It may be preceded by an + optional OpenSSL engine name, followed by a colon, as in + "pkcs11:keylabel". + + + When BIND 9 is built with native PKCS#11 + support, the label is a PKCS#11 URI string in the format + "pkcs11:=value;=value;..." + Keywords include "token", which identifies the HSM; "object", which + identifies the key; and "pin-source", which identifies a file from + which the HSM's PIN code can be obtained. The label will be + stored in the on-disk "private" file. + + + If the label contains a + field, tools using the generated + key files will be able to use the HSM for signing and other + operations without any need for an operator to manually enter + a PIN. Note: Making the HSM's PIN accessible in this manner + may reduce the security advantage of using an HSM; be sure + this is what you want to do before making use of this feature. @@ -437,7 +460,8 @@ dnssec-signzone8 , BIND 9 Administrator Reference Manual, - RFC 4034. + RFC 4034, + The PKCS#11 URI Scheme (draft-pechanec-pkcs11uri-13). diff --git a/doc/arm/pkcs11.xml b/doc/arm/pkcs11.xml index 9abf7f82ec..286247272a 100644 --- a/doc/arm/pkcs11.xml +++ b/doc/arm/pkcs11.xml @@ -485,6 +485,13 @@ $ dnssec-keyfromlabel -l sample-ksk -f KSK example.net different keylabel, a smaller key size, and omitting "-f KSK" from the dnssec-keyfromlabel arguments: + + (Note: When using OpenSSL-based PKCS#11 the label is an arbitrary + string which identifies the key. With native PKCS#11, the label is + a PKCS#11 URI string which may include other details about the key + and the HSM, including its PIN. See + for details.) + $ pkcs11-keygen -b 1024 -l sample-zsk $ dnssec-keyfromlabel -l sample-zsk example.net @@ -595,7 +602,7 @@ $ dnssec-signzone -E '' -S example.net Placing the HSM's PIN in a text file in this manner may reduce the security advantage of using an HSM. Be sure this is what you want to - do before configuring OpenSSL in this way. + do before configuring the system in this way. diff --git a/doc/draft/draft-pechanec-pkcs11uri-13.txt b/doc/draft/draft-pechanec-pkcs11uri-13.txt new file mode 100644 index 0000000000..2e081bc32e --- /dev/null +++ b/doc/draft/draft-pechanec-pkcs11uri-13.txt @@ -0,0 +1,728 @@ + + + + +Network Working Group J. Pechanec +Internet-Draft D. Moffat +Intended status: Standards Track Oracle Corporation +Expires: April 03, 2014 September 30, 2013 + + + The PKCS#11 URI Scheme + draft-pechanec-pkcs11uri-13 + +Abstract + + This memo specifies a PKCS#11 Uniform Resource Identifier (URI) + Scheme for identifying PKCS#11 objects stored in PKCS#11 tokens, for + identifying PKCS#11 tokens themselves, or for identifying PKCS#11 + libraries. The URI is based on how PKCS#11 objects, tokens, and + libraries are identified in the PKCS#11 Cryptographic Token Interface + Standard. + +Status of This Memo + + This Internet-Draft is submitted in full conformance with the + provisions of BCP 78 and BCP 79. + + Internet-Drafts are working documents of the Internet Engineering + Task Force (IETF). Note that other groups may also distribute + working documents as Internet-Drafts. The list of current Internet- + Drafts is at http://datatracker.ietf.org/drafts/current/. + + Internet-Drafts are draft documents valid for a maximum of six months + and may be updated, replaced, or obsoleted by other documents at any + time. It is inappropriate to use Internet-Drafts as reference + material or to cite them other than as "work in progress." + + This Internet-Draft will expire on April 03, 2014. + +Copyright Notice + + Copyright (c) 2013 IETF Trust and the persons identified as the + document authors. All rights reserved. + + + + + + + + + + + + +Pechanec & Moffat Expires April 03, 2014 [Page 1] + +Internet-Draft The PKCS#11 URI Scheme September 2013 + + + This document is subject to BCP 78 and the IETF Trust's Legal + Provisions Relating to IETF Documents + (http://trustee.ietf.org/license-info) in effect on the date of + publication of this document. Please review these documents + carefully, as they describe your rights and restrictions with respect + to this document. Code Components extracted from this document must + include Simplified BSD License text as described in Section 4.e of + the Trust Legal Provisions and are provided without warranty as + described in the Simplified BSD License. + +Table of Contents + + 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 + 2. Contributors . . . . . . . . . . . . . . . . . . . . . . . . 3 + 3. PKCS#11 URI Scheme Definition . . . . . . . . . . . . . . . . 3 + 3.1. PKCS#11 URI Scheme Name . . . . . . . . . . . . . . . . . 4 + 3.2. PKCS#11 URI Scheme Status . . . . . . . . . . . . . . . . 4 + 3.3. PKCS#11 URI Scheme Syntax . . . . . . . . . . . . . . . . 4 + 3.4. PKCS#11 URI Matching Guidelines . . . . . . . . . . . . . 7 + 3.5. PKCS#11 URI Comparison . . . . . . . . . . . . . . . . . 8 + 4. Examples of PKCS#11 URIs . . . . . . . . . . . . . . . . . . 9 + 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 11 + 6. Security Considerations . . . . . . . . . . . . . . . . . . . 11 + 7. References . . . . . . . . . . . . . . . . . . . . . . . . . 12 + 7.1. Normative References . . . . . . . . . . . . . . . . . . 12 + 7.2. Informative References . . . . . . . . . . . . . . . . . 12 + Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 12 + +1. Introduction + + The PKCS #11: Cryptographic Token Interface Standard [pkcs11_spec] + specifies an API, called Cryptoki, for devices which hold + cryptographic information and perform cryptographic functions. + Cryptoki, pronounced crypto-key and short for cryptographic token + interface, follows a simple object-based approach, addressing the + goals of technology independence (any kind of device may be used) and + resource sharing (multiple applications may access multiple devices), + presenting applications with a common, logical view of the device - a + cryptographic token. + + It is desirable for applications or libraries that work with PKCS#11 + tokens to accept a common identifier that consumers could use to + identify an existing PKCS#11 storage object in a PKCS#11 token, an + existing token itself, or an existing Cryptoki library (also called a + producer, module, or provider). The set of storage object types that + can be stored in a PKCS#11 token includes a certificate, a public, + private or secret key, and a data object. These objects can be + uniquely identifiable via the PKCS#11 URI scheme defined in this + + + +Pechanec & Moffat Expires April 03, 2014 [Page 2] + +Internet-Draft The PKCS#11 URI Scheme September 2013 + + + document. The set of attributes describing a storage object can + contain an object label, its type, and its ID. The set of attributes + that identifies a PKCS#11 token can contain a token label, a + manufacturer name, a serial number, and a token model. Attributes + that can identify a Cryptoki library are a library manufacturer, a + library description, and a library version. Library attributes may + be necessary to use if more than one Cryptoki library provides a + token and/or PKCS#11 objects of the same name(s). + + The PKCS#11 URI cannot identify other objects aside from storage + objects, for example a hardware feature or mechanism. Note that a + Cryptoki library does not have to provide for storage objects at all. + The URI can still be used to identify a specific PKCS#11 token or an + API producer in such a case. + + A subset of existing PKCS#11 structure members and object attributes + was chosen believed to be sufficient in uniquely identifying a + PKCS#11 token, storage object, or library in a configuration file, on + a command line, or in a configuration property of something else. + Should there be a need for a more complex information exchange on + PKCS#11 entities a different means of data marshalling should be + chosen accordingly. + + A PKCS#11 URI is not intended to be used to create new PKCS#11 + objects in tokens, or to create PKCS#11 tokens. It is solely to be + used to identify and work with existing storage objects and tokens + through the PKCS#11 API, or identify Cryptoki libraries themselves. + + The URI scheme defined in this document is designed specifically with + a mapping to the PKCS#11 API in mind. The URI uses the scheme, path + and query components defined in the Uniform Resource Identifier + (URI): Generic Syntax [RFC3986] document. The URI does not use the + hierarchical element for a naming authority in the path since the + authority part could not be mapped to PKCS#11 API elements. The URI + does not use the fragment component. + + If an application has no access to a producer or producers of the + PKCS#11 API it is left to its implementation to provide adequate user + interface to locate and load such producer(s). + +2. Contributors + + Stef Walter, Nikos Mavrogiannopoulos, Nico Williams, Dan Winship, and + Jaroslav Imrich contributed to the development of this document. + +3. PKCS#11 URI Scheme Definition + + + + + +Pechanec & Moffat Expires April 03, 2014 [Page 3] + +Internet-Draft The PKCS#11 URI Scheme September 2013 + + + In accordance with [RFC4395], this section provides the information + required to register the PKCS#11 URI scheme. + +3.1. PKCS#11 URI Scheme Name + + pkcs11 + +3.2. PKCS#11 URI Scheme Status + + Permanent. + +3.3. PKCS#11 URI Scheme Syntax + + The PKCS#11 URI is a sequence of attribute value pairs separated by a + semicolon that form a one level path component, optionally followed + by a query. In accordance with Section 2.5 of [RFC3986], the data + should first be encoded as octets according to the UTF-8 character + encoding [RFC3629]; then only those octets that do not correspond to + characters in the unreserved set or to permitted characters from the + reserved set should be percent-encoded. This specification suggests + one allowable exception to that rule for the "id" attribute, as + stated later in this section. Grammar rules "unreserved" and "pct- + encoded" in the PKCS#11 URI specification below are imported from + [RFC3986]. As a special case, note that according to Appendix A of + [RFC3986], a space must be percent-encoded. + + PKCS#11 specification imposes various limitations on the value of + attributes, be it a more restrictive character set for the "serial" + attribute or fixed sized buffers for almost all the others, including + "token", "manufacturer", and "model" attributes. However, the + PKCS#11 URI notation does not impose such limitations aside from + removing generic and PKCS#11 URI delimiters from a permitted + character set. We believe that being too restrictive on the + attribute values could limit the PKCS#11 URI's usefulness. What is + more, possible future changes to the PKCS#11 specification should not + affect existing attributes. + + A PKCS#11 URI takes the form (for explanation of Augmented BNF, see + [RFC5234]): + + + + + + + + + + + + +Pechanec & Moffat Expires April 03, 2014 [Page 4] + +Internet-Draft The PKCS#11 URI Scheme September 2013 + + + pk11-URI = "pkcs11" ":" pk11-path *1("?" pk11-query) + ; Path component and its attributes. Path may be empty. + pk11-path = *1(pk11-pattr *(";" pk11-pattr)) + pk11-pattr = pk11-token / pk11-manuf / pk11-serial / + pk11-model / pk11-lib-manuf / + pk11-lib-ver / pk11-lib-desc / + pk11-object / pk11-type / pk11-id / + pk11-x-pattr + ; Query component and its attributes. Query may be empty. + pk11-qattr = pk11-pin-source / pk11-x-qattr + pk11-query = *1(pk11-qattr *("&" pk11-qattr)) + ; RFC 3986 section 2.2 mandates all potentially reserved characters + ; that do not conflict with actual delimiters of the URI do not have + ; to be percent-encoded. + pk11-res-avail = ":" / "[" / "]" / "@" / "!" / "$" / + "'" / "(" / ")" / "*" / "+" / "," / "=" + pk11-path-res-avail = pk11-res-avail / "&" + ; We allow "/" and "?" in the query to be unencoded but "&" must + ; be encoded since it may be used as a delimiter in the component. + pk11-query-res-avail = pk11-res-avail / "/" / "?" + pk11-pchar = unreserved / pk11-path-res-avail / pct-encoded + pk11-qchar = unreserved / pk11-query-res-avail / pct-encoded + pk11-token = "token" "=" *pk11-pchar + pk11-manuf = "manufacturer" "=" *pk11-pchar + pk11-serial = "serial" "=" *pk11-pchar + pk11-model = "model" "=" *pk11-pchar + pk11-lib-manuf = "library-manufacturer" "=" *pk11-pchar + pk11-lib-desc = "library-description" "=" *pk11-pchar + pk11-lib-ver = "library-version" "=" 1*DIGIT *1("." 1*DIGIT) + pk11-object = "object" "=" *pk11-pchar + pk11-type = "type" "=" *1("public" / "private" / "cert" / + "secret-key" / "data") + pk11-id = "id" "=" *pk11-pchar + pk11-pin-source = "pin-source" "=" *pk11-qchar + pk11-x-attr-nm-char = ALPHA / DIGIT / "-" / "_" + ; Permitted value of a vendor specific attribute is based on + ; whether the attribute is used in the path or in the query. + pk11-x-pattr = "x-" 1*pk11-x-attr-nm-char "=" *pk11-pchar + pk11-x-qattr = "x-" 1*pk11-x-attr-nm-char "=" *pk11-qchar + + + + + + + + + + + + +Pechanec & Moffat Expires April 03, 2014 [Page 5] + +Internet-Draft The PKCS#11 URI Scheme September 2013 + + + The URI path component contains attributes that identify a resource + in a one level hierarchy provided by Cryptoki producers. The query + component may contain a PIN source attribute that may be needed to + retrieve the resource identified by the URI path. Both path and + query components may contain vendor specific attributes. Such + attribute names must start with an "x-" prefix. Attributes in the + path component are delimited by ';' character, attributes in the + query component use '&' as a delimiter. + + The general '/' delimiter was removed from available characters that + do not have to be percent-encoded in the path component so that + generic URI parsers never split the path component into multiple + segments. The '/' delimiter can be used unencoded in the query + component. Delimiter '?' was removed since the PKCS#11 URI uses a + query component. Delimiter '#' was removed so that generic URI + parsers are not confused by unencoded hash characters. All other + generic delimiters are allowed to be used unencoded (':', '[', ']', + and '@') in the PKCS#11 URI. + + The attribute "token" represents a token label and corresponds to the + "label" member of the CK_TOKEN_INFO structure, the attribute + "manufacturer" corresponds to the "manufacturerID" member of + CK_TOKEN_INFO, the attribute "serial" corresponds to the + "serialNumber" member of CK_TOKEN_INFO, the attribute "model" + corresponds to the "model" member of CK_TOKEN_INFO, the attribute + "library-manufacturer" represents the Cryptoki library manufacturer + and corresponds to the "manufacturerID" member of the CK_INFO + structure, the attribute "library-description" corresponds to the + "libraryDescription" member of CK_INFO, the attribute "library- + version" corresponds to the "libraryVersion" member of CK_INFO, the + attribute "object" represents a PKCS#11 object label and corresponds + to the "CKA_LABEL" object attribute, the attribute "type" represents + the type of the object and corresponds to the "CKA_CLASS" object + attribute, the attribute "id" represents the object ID and + corresponds to the "CKA_ID" object attribute, and the attribute "pin- + source" specifies where the application or library should find the + token PIN, if needed. + + The PKCS#11 URI must not contain duplicate attributes of the same + name in the URI path component. It means that each attribute may be + present at most once in the PKCS#11 URI path. Aside from the "pin- + source" attribute, duplicate attributes may be present in the URI + query component and it is up to the URI consumer to decide on how to + deal with such duplicates. + + The "pin-source" attribute may represent a filename that contains a + token PIN but an application may overload this attribute. For + example, "pin-source=%7Cprog-name" could mean to read a PIN from an + + + +Pechanec & Moffat Expires April 03, 2014 [Page 6] + +Internet-Draft The PKCS#11 URI Scheme September 2013 + + + external application (%7C denotes a pipe '|' character). Note that + an application may always ask for a PIN and/or interpret the "pin- + source" attribute by any means it decides to. However, as discussed + in Section 6, the attribute should never contain the PIN itself. + + It is recommended to percent-encode the whole value of the "id" + attribute which is supposed to be handled as arbitrary binary data. + Value "M" of the "library-version" attribute should be interpreted as + "M" for the major and "0" for the minor version of the library. Note + that if the "library-version" attribute is present, the major version + number is mandatory. + + An empty PKCS#11 URI path attribute that does allow for an empty + value matches a corresponding structure member or an object attribute + with an empty value. Note that according to the PKCS#11 + specification [pkcs11_spec], empty character values in a PKCS#11 API + producer must be padded with spaces and should not be NULL + terminated. + +3.4. PKCS#11 URI Matching Guidelines + + The PKCS#11 URI can identify PKCS#11 storage objects, tokens, or + Cryptoki libraries. The following guidelines should help a PKCS#11 + URI consumer (eg. an application accepting PKCS#11 URIs) to match the + URI with the desired resource. + + o the consumer must know whether the URI is to identify PKCS#11 + storage object(s), token(s), or Cryptoki producer(s). + + o an unrecognized attribute in the URI path component, including a + vendor specific attribute, should result in an empty set of + matched resources. The consumer should consider whether an error + message presented to the user is appropriate in such a case. + + o an unrecognized attribute in the URI query should be ignored. The + consumer should consider whether a warning message presented to + the user is appropriate in such a case. + + o an attribute not present in the URI path but known to a consumer + matches everything. Each additional attribute present in the URI + path further restricts the selection. + + o a logical extension of the above is that an empty URI path matches + everything. For example, if used to identify storage objects, it + matches all accessible objects in all tokens provided by all + PKCS#11 API producers found in the system. + + + + + +Pechanec & Moffat Expires April 03, 2014 [Page 7] + +Internet-Draft The PKCS#11 URI Scheme September 2013 + + + o use of the PIN attribute may change the set of storage objects + visible to the consumer. + + o in addition to the PIN attribute, query string attributes may + contain further information about how to perform the selection or + other related information. + +3.5. PKCS#11 URI Comparison + + Comparison of two URIs is a way of determining whether the URIs are + equivalent without comparing the actual resource the URIs point to. + The comparison of URIs aims to minimize false negatives while + strictly avoiding false positives. + + Two PKCS#11 URIs are said to be equal if URIs as character strings + are identical as specified in Section 6.2.1 of [RFC3986], or if both + following rules are fulfilled: + + o set of attributes present in the URI is equal. Note that the + ordering of attributes in the URI string is not significant for + the mechanism of comparison. + + o values of respective attributes are equal based on rules specified + below + + The rules for comparing values of respective attributes are: + + o values of attributes "library-description", "library- + manufacturer", "manufacturer", "model", "object", "serial", + "token", and "type" must be compared using a simple string + comparison as specified in Section 6.2.1 of [RFC3986] after the + case and the percent-encoding normalization are both applied as + specified in Section 6.2.2 of [RFC3986] + + o value of attribute "id" must be compared using the simple string + comparison after all bytes are percent-encoded using uppercase + letters for digits A-F + + o value for attribute "pin-source", if deemed containing the + filename with the PIN value, must be compared using the simple + string comparison after the full syntax based normalization as + specified in Section 6.2.2 of [RFC3986] is applied. If value of + the "pin-source" attribute is believed to be overloaded it is + recommended to perform case and percent-encoding normalization + before the values are compared but the exact mechanism of + comparison is left to the application. + + + + + +Pechanec & Moffat Expires April 03, 2014 [Page 8] + +Internet-Draft The PKCS#11 URI Scheme September 2013 + + + o value of attribute "library-version" must be processed as a + specific scheme-based normalization permitted by Section 6.2.3 of + [RFC3986]. The value must be split into a major and minor version + with character '.' (dot) serving as a delimiter. Library version + "M" must be treated as "M" for the major version and "0" for the + minor version. Resulting minor and major version numbers must be + then separately compared numerically. + + o when comparing vendor specific attributes it is recommended to + perform case and percent-encoding normalization before the values + are compared but the exact mechanism of comparison is left to the + application. + +4. Examples of PKCS#11 URIs + + This section contains some examples of how PKCS#11 token objects, + PKCS#11 tokens, and PKCS#11 libraries can be identified using the + PKCS#11 URI scheme. Note that in some of the following examples, + newlines and spaces were inserted for better readability. As + specified in Appendix C of [RFC3986], whitespace should be ignored + when extracting the URI. Also note that all spaces as part of the + URI are percent-encoded, as specified in Appendix A of [RFC3986]. + + An empty PKCS#11 URI might be useful to PKCS#11 consumers: + + pkcs11: + + + One of the simplest and most useful forms might be a PKCS#11 URI that + specifies only an object label and its type. The default token is + used so the URI does not specify it. Note that when specifying + public objects, a token PIN might not be required. + + pkcs11:object=my-pubkey;type=public + + + When a private key is specified either the "pin-source" attribute or + an application specific method would be usually used. Note that '/' + is not percent-encoded in the "pin-source" attribute value since this + attribute is part of the query component, not the path, and thus is + separated by '?' from the rest of the URI. + + pkcs11:object=my-key;type=private?pin-source=/etc/token + + + The following example identifies a certificate in the software token. + Note an empty value for the attribute "serial". Also note that the + "id" attribute value is entirely percent-encoded, as recommended. + + + +Pechanec & Moffat Expires April 03, 2014 [Page 9] + +Internet-Draft The PKCS#11 URI Scheme September 2013 + + + While ',' is in the reserved set it does not have to be percent- + encoded since it does not conflict with any sub-delimiters used. The + '#' character as in "The Software PKCS#11 Softtoken" must be percent- + encoded. + + pkcs11:token=The%20Software%20PKCS%2311%20Softtoken; + manufacturer=Snake%20Oil,%20Inc.; + model=1.0; + object=my-certificate; + type=cert; + id=%69%95%3E%5C%F4%BD%EC%91; + serial= + ?pin-source=/etc/token_pin + + + The token alone can be identified without specifying any PKCS#11 + objects. A PIN may still be needed to list all objects, for example. + + pkcs11:token=Software%20PKCS%2311%20softtoken; + manufacturer=Snake%20Oil,%20Inc. + ?pin-source=/etc/token_pin + + + The Cryptoki library alone can be also identified without specifying + a PKCS#11 token or object. + + pkcs11:library-manufacturer=Snake%20Oil,%20Inc.; + library-description=Soft%20Token%20Library; + library-version=1.23 + + + The following example shows that the attribute value can contain a + semicolon. In such case, it is percent-encoded. The token attribute + value must be read as "My token; created by Joe". Lower case letters + can also be used in percent-encoding as shown below in the "id" + attribute value but note that Sections 2.1 and 6.2.2.1 of [RFC3986] + read that all percent-encoded characters should use the uppercase + hexadecimal digits. More specifically, if the URI string was to be + compared, the algorithm defined in Section 3.5 explicitly requires + percent-encoding to use the uppercase digits A-F in the "id" + attribute values. And as explained in Section 3.3, library version + "3" should be interpreted as "3" for the major and "0" for the minor + version of the library. + + pkcs11:token=My%20token%25%20created%20by%20Joe; + library-version=3; + id=%01%02%03%Ba%dd%Ca%fe%04%05%06 + + + + +Pechanec & Moffat Expires April 03, 2014 [Page 10] + +Internet-Draft The PKCS#11 URI Scheme September 2013 + + + If there is any need to include literal "%;" substring, for example, + both characters must be escaped. The token value must be read as "A + name with a substring %;". + + pkcs11:token=A%20name%20with%20a%20substring%20%25%3B; + object=my-certificate; + type=cert + ?pin-source=/etc/token_pin + + + The next example includes a small A with acute in the token name. It + must be encoded in octets according to the UTF-8 character encoding + and then percent-encoded. Given that a small A with acute is U+225 + unicode code point, the UTF-8 encoding is 195 161 in decimal, and + that is "%C3%A1" in percent-encoding. + + pkcs11:token=Name%20with%20a%20small%20A%20with%20acute:%20%C3%A1; + object=my-certificate; + type=cert + + + Both the path and query components may contain vendor specific + attributes. Attributes in the query component may be delimited by + either ';' or '&'. We use '&' in the example that follows. + + pkcs11:token=my-token; + object=my-certificate; + type=cert; + x-vend-aaa=value-a + ?pin-source=/etc/token_pin& + x-vend-bbb=value-b + + +5. IANA Considerations + + This document moves the "pkcs11" URI scheme from the provisional to + the permanent URI scheme registry. The registration template for the + URI scheme is accessible on http://www.iana.org/assignments/uri- + schemes. + +6. Security Considerations + + There are general security considerations for URI schemes discussed + in Section 7 of [RFC3986]. + + From those security considerations, Section 7.1 of [RFC3986] applies + since there is no guarantee that the same PKCS#11 URI will always + identify the same object, token, or a library in the future. + + + +Pechanec & Moffat Expires April 03, 2014 [Page 11] + +Internet-Draft The PKCS#11 URI Scheme September 2013 + + + Section 7.5 of [RFC3986] applies since the PKCS#11 URI may be used in + command line arguments to run applications, and those arguments can + be world readable on some systems. For that reasons, the URI + intentionally does not allow for specifying the PKCS#11 token PIN as + a URI attribute. + +7. References + +7.1. Normative References + + [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO + 10646", RFC 3629, STD 63, November 2003. + + [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform + Resource Identifier (URI): Generic Syntax", RFC 3986, STD + 66, January 2005. + + [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax + Specifications: ABNF", RFC 5234, STD 68, January 2008. + +7.2. Informative References + + [RFC4395] Hansen, T., Hardie, T., and L. Masinter, "Guidelines and + Registration Procedures for New URI Schemes", RFC 4395, + February 2006. + + [pkcs11_spec] + RSA Laboratories, "PKCS #11: Cryptographic Token Interface + Standard v2.20", June 2004. + +Authors' Addresses + + Jan Pechanec + Oracle Corporation + 4180 Network Circle + Santa Clara CA 95054 + USA + + Email: Jan.Pechanec@Oracle.COM + URI: http://www.oracle.com + + + + + + + + + + + +Pechanec & Moffat Expires April 03, 2014 [Page 12] + +Internet-Draft The PKCS#11 URI Scheme September 2013 + + + Darren J. Moffat + Oracle Corporation + Oracle Parkway + Thames Valley Park + Reading RG6 1RA + UK + + Email: Darren.Moffat@Oracle.COM + URI: http://www.oracle.com + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Pechanec & Moffat Expires April 03, 2014 [Page 13] From 7fa75f8e0e542bd28951839461c80adad05677be Mon Sep 17 00:00:00 2001 From: Tinderbox User Date: Thu, 6 Feb 2014 23:46:25 +0000 Subject: [PATCH 4/5] update copyright notice --- bin/tests/system/ecdsa/prereq.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/tests/system/ecdsa/prereq.sh b/bin/tests/system/ecdsa/prereq.sh index 86b1bb4670..8a6b44fdfc 100644 --- a/bin/tests/system/ecdsa/prereq.sh +++ b/bin/tests/system/ecdsa/prereq.sh @@ -1,6 +1,6 @@ #!/bin/sh -e # -# Copyright (C) 20122014, 2014 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2012, 2014 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above From a165a17a81ff3285f4f4d79785fafb465e626183 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Thu, 6 Feb 2014 15:59:14 -0800 Subject: [PATCH 5/5] [master] dnssec-keygen fixes 3730. [cleanup] Added "never" as a synonym for "none" when configuring key event dates in the dnssec tools. [RT #35277] 3729. [bug] dnssec-kegeyn could set the publication date incorrectly when only the activation date was specified on the command line. [RT #35278] --- CHANGES | 8 ++++ bin/dnssec/dnssec-importkey.c | 13 +++--- bin/dnssec/dnssec-importkey.docbook | 3 +- bin/dnssec/dnssec-keyfromlabel.c | 55 +++++++----------------- bin/dnssec/dnssec-keyfromlabel.docbook | 3 +- bin/dnssec/dnssec-keygen.c | 59 ++++++++------------------ bin/dnssec/dnssec-keygen.docbook | 7 ++- bin/dnssec/dnssec-settime.c | 55 +++++++----------------- bin/dnssec/dnssec-settime.docbook | 2 +- bin/dnssec/dnssec-signzone.c | 7 +-- bin/dnssec/dnssectool.c | 22 +++++++++- bin/dnssec/dnssectool.h | 3 +- bin/tests/system/metadata/tests.sh | 17 ++++++++ 13 files changed, 117 insertions(+), 137 deletions(-) diff --git a/CHANGES b/CHANGES index a9ef418455..aad5f8be88 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,11 @@ +3730. [cleanup] Added "never" as a synonym for "none" when + configuring key event dates in the dnssec tools. + [RT #35277] + +3729. [bug] dnssec-kegeyn could set the publication date + incorrectly when only the activation date was + specified on the command line. [RT #35278] + 3728. [doc] Expanded native-PKCS#11 documentation, specifically pkcs11: URI labels. [RT #35287] diff --git a/bin/dnssec/dnssec-importkey.c b/bin/dnssec/dnssec-importkey.c index 563dc09948..2948e8d690 100644 --- a/bin/dnssec/dnssec-importkey.c +++ b/bin/dnssec/dnssec-importkey.c @@ -313,8 +313,8 @@ main(int argc, char **argv) { if (setdel) fatal("-D specified more than once"); - setdel = ISC_TRUE; - del = strtotime(isc_commandline_argument, now, now); + del = strtotime(isc_commandline_argument, + now, now, &setdel); break; case 'K': dir = isc_commandline_argument; @@ -322,18 +322,15 @@ main(int argc, char **argv) { fatal("directory must be non-empty string"); break; case 'L': - if (strcmp(isc_commandline_argument, "none") == 0) - ttl = 0; - else - ttl = strtottl(isc_commandline_argument); + ttl = strtottl(isc_commandline_argument); setttl = ISC_TRUE; break; case 'P': if (setpub) fatal("-P specified more than once"); - setpub = ISC_TRUE; - pub = strtotime(isc_commandline_argument, now, now); + pub = strtotime(isc_commandline_argument, + now, now, &setpub); break; case 'f': filename = isc_commandline_argument; diff --git a/bin/dnssec/dnssec-importkey.docbook b/bin/dnssec/dnssec-importkey.docbook index f9b322c884..3a8babb936 100644 --- a/bin/dnssec/dnssec-importkey.docbook +++ b/bin/dnssec/dnssec-importkey.docbook @@ -160,7 +160,8 @@ then the offset is computed in years (defined as 365 24-hour days, ignoring leap years), months (defined as 30 24-hour days), weeks, days, hours, or minutes, respectively. Without a suffix, the offset - is computed in seconds. To unset a date, use 'none'. + is computed in seconds. To explicitly prevent a date from being + set, use 'none' or 'never'. diff --git a/bin/dnssec/dnssec-keyfromlabel.c b/bin/dnssec/dnssec-keyfromlabel.c index 1b8accdb20..3609be5a22 100644 --- a/bin/dnssec/dnssec-keyfromlabel.c +++ b/bin/dnssec/dnssec-keyfromlabel.c @@ -212,10 +212,7 @@ main(int argc, char **argv) { options |= DST_TYPE_KEY; break; case 'L': - if (strcmp(isc_commandline_argument, "none") == 0) - ttl = 0; - else - ttl = strtottl(isc_commandline_argument); + ttl = strtottl(isc_commandline_argument); setttl = ISC_TRUE; break; case 'l': @@ -248,61 +245,41 @@ main(int argc, char **argv) { if (setpub || unsetpub) fatal("-P specified more than once"); - if (strcasecmp(isc_commandline_argument, "none")) { - setpub = ISC_TRUE; - publish = strtotime(isc_commandline_argument, - now, now); - } else { - unsetpub = ISC_TRUE; - } + publish = strtotime(isc_commandline_argument, + now, now, &setpub); + unsetpub = !setpub; break; case 'A': if (setact || unsetact) fatal("-A specified more than once"); - if (strcasecmp(isc_commandline_argument, "none")) { - setact = ISC_TRUE; - activate = strtotime(isc_commandline_argument, - now, now); - } else { - unsetact = ISC_TRUE; - } + activate = strtotime(isc_commandline_argument, + now, now, &setact); + unsetact = !setact; break; case 'R': if (setrev || unsetrev) fatal("-R specified more than once"); - if (strcasecmp(isc_commandline_argument, "none")) { - setrev = ISC_TRUE; - revoke = strtotime(isc_commandline_argument, - now, now); - } else { - unsetrev = ISC_TRUE; - } + revoke = strtotime(isc_commandline_argument, + now, now, &setrev); + unsetrev = !setrev; break; case 'I': if (setinact || unsetinact) fatal("-I specified more than once"); - if (strcasecmp(isc_commandline_argument, "none")) { - setinact = ISC_TRUE; - inactive = strtotime(isc_commandline_argument, - now, now); - } else { - unsetinact = ISC_TRUE; - } + inactive = strtotime(isc_commandline_argument, + now, now, &setinact); + unsetinact = !setinact; break; case 'D': if (setdel || unsetdel) fatal("-D specified more than once"); - if (strcasecmp(isc_commandline_argument, "none")) { - setdel = ISC_TRUE; - delete = strtotime(isc_commandline_argument, - now, now); - } else { - unsetdel = ISC_TRUE; - } + delete = strtotime(isc_commandline_argument, + now, now, &setdel); + unsetdel = !setdel; break; case 'F': /* Reserved for FIPS mode */ diff --git a/bin/dnssec/dnssec-keyfromlabel.docbook b/bin/dnssec/dnssec-keyfromlabel.docbook index 29b6972735..ad88562164 100644 --- a/bin/dnssec/dnssec-keyfromlabel.docbook +++ b/bin/dnssec/dnssec-keyfromlabel.docbook @@ -342,7 +342,8 @@ then the offset is computed in years (defined as 365 24-hour days, ignoring leap years), months (defined as 30 24-hour days), weeks, days, hours, or minutes, respectively. Without a suffix, the offset - is computed in seconds. + is computed in seconds. To explicitly prevent a date from being + set, use 'none' or 'never'. diff --git a/bin/dnssec/dnssec-keygen.c b/bin/dnssec/dnssec-keygen.c index f0a1217504..610fc24d06 100644 --- a/bin/dnssec/dnssec-keygen.c +++ b/bin/dnssec/dnssec-keygen.c @@ -347,10 +347,7 @@ main(int argc, char **argv) { "To generate a key with TYPE=KEY, use -T KEY.\n"); break; case 'L': - if (strcmp(isc_commandline_argument, "none") == 0) - ttl = 0; - else - ttl = strtottl(isc_commandline_argument); + ttl = strtottl(isc_commandline_argument); setttl = ISC_TRUE; break; case 'n': @@ -407,61 +404,41 @@ main(int argc, char **argv) { if (setpub || unsetpub) fatal("-P specified more than once"); - if (strcasecmp(isc_commandline_argument, "none")) { - setpub = ISC_TRUE; - publish = strtotime(isc_commandline_argument, - now, now); - } else { - unsetpub = ISC_TRUE; - } + publish = strtotime(isc_commandline_argument, + now, now, &setpub); + unsetpub = !setpub; break; case 'A': if (setact || unsetact) fatal("-A specified more than once"); - if (strcasecmp(isc_commandline_argument, "none")) { - setact = ISC_TRUE; - activate = strtotime(isc_commandline_argument, - now, now); - } else { - unsetact = ISC_TRUE; - } + activate = strtotime(isc_commandline_argument, + now, now, &setact); + unsetact = !setact; break; case 'R': if (setrev || unsetrev) fatal("-R specified more than once"); - if (strcasecmp(isc_commandline_argument, "none")) { - setrev = ISC_TRUE; - revoke = strtotime(isc_commandline_argument, - now, now); - } else { - unsetrev = ISC_TRUE; - } + revoke = strtotime(isc_commandline_argument, + now, now, &setrev); + unsetrev = !setrev; break; case 'I': if (setinact || unsetinact) fatal("-I specified more than once"); - if (strcasecmp(isc_commandline_argument, "none")) { - setinact = ISC_TRUE; - inactive = strtotime(isc_commandline_argument, - now, now); - } else { - unsetinact = ISC_TRUE; - } + inactive = strtotime(isc_commandline_argument, + now, now, &setinact); + unsetinact = !setinact; break; case 'D': if (setdel || unsetdel) fatal("-D specified more than once"); - if (strcasecmp(isc_commandline_argument, "none")) { - setdel = ISC_TRUE; - delete = strtotime(isc_commandline_argument, - now, now); - } else { - unsetdel = ISC_TRUE; - } + delete = strtotime(isc_commandline_argument, + now, now, &setdel); + unsetdel = !setdel; break; case 'S': predecessor = isc_commandline_argument; @@ -940,9 +917,9 @@ main(int argc, char **argv) { if (setpub) dst_key_settime(key, DST_TIME_PUBLISH, publish); - else if (setact) + else if (setact && !unsetpub) dst_key_settime(key, DST_TIME_PUBLISH, - activate); + activate - prepub); else if (!genonly && !unsetpub) dst_key_settime(key, DST_TIME_PUBLISH, now); diff --git a/bin/dnssec/dnssec-keygen.docbook b/bin/dnssec/dnssec-keygen.docbook index 6301b52105..ec74bc644c 100644 --- a/bin/dnssec/dnssec-keygen.docbook +++ b/bin/dnssec/dnssec-keygen.docbook @@ -437,7 +437,8 @@ then the offset is computed in years (defined as 365 24-hour days, ignoring leap years), months (defined as 30 24-hour days), weeks, days, hours, or minutes, respectively. Without a suffix, the offset - is computed in seconds. + is computed in seconds. To explicitly prevent a date from being + set, use 'none' or 'never'. @@ -460,7 +461,9 @@ Sets the date on which the key is to be activated. After that date, the key will be included in the zone and used to sign it. If not set, and if the -G option has not been used, the - default is "now". + default is "now". If set, if and -P is not set, then + the publication date will be set to the activation date + minus the prepublication interval. diff --git a/bin/dnssec/dnssec-settime.c b/bin/dnssec/dnssec-settime.c index cb0c384c49..3cb989f53d 100644 --- a/bin/dnssec/dnssec-settime.c +++ b/bin/dnssec/dnssec-settime.c @@ -239,10 +239,7 @@ main(int argc, char **argv) { } break; case 'L': - if (strcmp(isc_commandline_argument, "none") == 0) - ttl = 0; - else - ttl = strtottl(isc_commandline_argument); + ttl = strtottl(isc_commandline_argument); setttl = ISC_TRUE; break; case 'v': @@ -255,65 +252,45 @@ main(int argc, char **argv) { fatal("-P specified more than once"); changed = ISC_TRUE; - if (!strcasecmp(isc_commandline_argument, "none")) { - unsetpub = ISC_TRUE; - } else { - setpub = ISC_TRUE; - pub = strtotime(isc_commandline_argument, - now, now); - } + pub = strtotime(isc_commandline_argument, + now, now, &setpub); + unsetpub = !setpub; break; case 'A': if (setact || unsetact) fatal("-A specified more than once"); changed = ISC_TRUE; - if (!strcasecmp(isc_commandline_argument, "none")) { - unsetact = ISC_TRUE; - } else { - setact = ISC_TRUE; - act = strtotime(isc_commandline_argument, - now, now); - } + act = strtotime(isc_commandline_argument, + now, now, &setact); + unsetact = !setact; break; case 'R': if (setrev || unsetrev) fatal("-R specified more than once"); changed = ISC_TRUE; - if (!strcasecmp(isc_commandline_argument, "none")) { - unsetrev = ISC_TRUE; - } else { - setrev = ISC_TRUE; - rev = strtotime(isc_commandline_argument, - now, now); - } + rev = strtotime(isc_commandline_argument, + now, now, &setrev); + unsetrev = !setrev; break; case 'I': if (setinact || unsetinact) fatal("-I specified more than once"); changed = ISC_TRUE; - if (!strcasecmp(isc_commandline_argument, "none")) { - unsetinact = ISC_TRUE; - } else { - setinact = ISC_TRUE; - inact = strtotime(isc_commandline_argument, - now, now); - } + inact = strtotime(isc_commandline_argument, + now, now, &setinact); + unsetinact = !setinact; break; case 'D': if (setdel || unsetdel) fatal("-D specified more than once"); changed = ISC_TRUE; - if (!strcasecmp(isc_commandline_argument, "none")) { - unsetdel = ISC_TRUE; - } else { - setdel = ISC_TRUE; - del = strtotime(isc_commandline_argument, - now, now); - } + del = strtotime(isc_commandline_argument, + now, now, &setdel); + unsetdel = !setdel; break; case 'S': predecessor = isc_commandline_argument; diff --git a/bin/dnssec/dnssec-settime.docbook b/bin/dnssec/dnssec-settime.docbook index f63c97179a..bcaadceee6 100644 --- a/bin/dnssec/dnssec-settime.docbook +++ b/bin/dnssec/dnssec-settime.docbook @@ -179,7 +179,7 @@ then the offset is computed in years (defined as 365 24-hour days, ignoring leap years), months (defined as 30 24-hour days), weeks, days, hours, or minutes, respectively. Without a suffix, the offset - is computed in seconds. To unset a date, use 'none'. + is computed in seconds. To unset a date, use 'none' or 'never'. diff --git a/bin/dnssec/dnssec-signzone.c b/bin/dnssec/dnssec-signzone.c index 6361daead0..7b2f414e2a 100644 --- a/bin/dnssec/dnssec-signzone.c +++ b/bin/dnssec/dnssec-signzone.c @@ -3365,17 +3365,18 @@ main(int argc, char *argv[]) { isc_stdtime_get(&now); if (startstr != NULL) { - starttime = strtotime(startstr, now, now); + starttime = strtotime(startstr, now, now, NULL); } else starttime = now - 3600; /* Allow for some clock skew. */ if (endstr != NULL) - endtime = strtotime(endstr, now, starttime); + endtime = strtotime(endstr, now, starttime, NULL); else endtime = starttime + (30 * 24 * 60 * 60); if (dnskey_endstr != NULL) { - dnskey_endtime = strtotime(dnskey_endstr, now, starttime); + dnskey_endtime = strtotime(dnskey_endstr, now, starttime, + NULL); if (endstr != NULL && dnskey_endtime == endtime) fprintf(stderr, "WARNING: -e and -X were both set, " "but have identical values.\n"); diff --git a/bin/dnssec/dnssectool.c b/bin/dnssec/dnssectool.c index 74698e1b17..d8069bdbf9 100644 --- a/bin/dnssec/dnssectool.c +++ b/bin/dnssec/dnssectool.c @@ -300,12 +300,21 @@ time_units(isc_stdtime_t offset, char *suffix, const char *str) { return(0); /* silence compiler warning */ } +static inline isc_boolean_t +isnone(const char *str) { + return (ISC_TF((strcasecmp(str, "none") == 0) || + (strcasecmp(str, "never") == 0))); +} + dns_ttl_t strtottl(const char *str) { const char *orig = str; dns_ttl_t ttl; char *endp; + if (isnone(str)) + return ((dns_ttl_t) 0); + ttl = strtol(str, &endp, 0); if (ttl == 0 && endp == str) fatal("TTL must be numeric"); @@ -314,13 +323,24 @@ strtottl(const char *str) { } isc_stdtime_t -strtotime(const char *str, isc_int64_t now, isc_int64_t base) { +strtotime(const char *str, isc_int64_t now, isc_int64_t base, + isc_boolean_t *setp) +{ isc_int64_t val, offset; isc_result_t result; const char *orig = str; char *endp; int n; + if (isnone(str)) { + if (setp != NULL) + *setp = ISC_FALSE; + return ((isc_stdtime_t) 0); + } + + if (setp != NULL) + *setp = ISC_TRUE; + if ((str[0] == '0' || str[0] == '-') && str[1] == '\0') return ((isc_stdtime_t) 0); diff --git a/bin/dnssec/dnssectool.h b/bin/dnssec/dnssectool.h index 09b4fb103b..7449406cfc 100644 --- a/bin/dnssec/dnssectool.h +++ b/bin/dnssec/dnssectool.h @@ -68,7 +68,8 @@ cleanup_entropy(isc_entropy_t **ectx); dns_ttl_t strtottl(const char *str); isc_stdtime_t -strtotime(const char *str, isc_int64_t now, isc_int64_t base); +strtotime(const char *str, isc_int64_t now, isc_int64_t base, + isc_boolean_t *setp); dns_rdataclass_t strtoclass(const char *str); diff --git a/bin/tests/system/metadata/tests.sh b/bin/tests/system/metadata/tests.sh index 73ceb25be3..28d5ac5740 100644 --- a/bin/tests/system/metadata/tests.sh +++ b/bin/tests/system/metadata/tests.sh @@ -174,5 +174,22 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` +echo "I:checking correct behavior setting activation without publication date ($n)" +ret=0 +key=`$KEYGEN -q -r $RANDFILE -A +1w $czone` +pub=`$SETTIME -upP $key | awk '{print $2}'` +act=`$SETTIME -upA $key | awk '{print $2}'` +[ $pub -eq $act ] || ret=1 +key=`$KEYGEN -q -r $RANDFILE -A +1w -i 1d $czone` +pub=`$SETTIME -upP $key | awk '{print $2}'` +act=`$SETTIME -upA $key | awk '{print $2}'` +[ $pub -lt $act ] || ret=1 +key=`$KEYGEN -q -r $RANDFILE -A +1w -P never $czone` +pub=`$SETTIME -upP $key | awk '{print $2}'` +[ $pub = "UNSET" ] || ret=1 +n=`expr $n + 1` +if [ $ret != 0 ]; then echo "I:failed"; fi +status=`expr $status + $ret` + echo "I:exit status: $status" exit $status