return result;
}
+isc_result_t
+dst__privelement_is_nul_terminated(const dst_private_element_t *element) {
+ if (element->length < 1 || element->data[element->length - 1] != 0 ||
+ strlen((char *)element->data) != (size_t)element->length - 1)
+ {
+ return DST_R_INVALIDPRIVATEKEY;
+ }
+ return ISC_R_SUCCESS;
+}
+
/*! \file */
isc_result_t
dst__privstruct_writefile(const dst_key_t *key, const dst_private_t *priv,
const char *directory);
+
+isc_result_t
+dst__privelement_is_nul_terminated(
+ const dst_private_element_t *dst_private_element_t);
/* The Engine: tag is explicitly ignored */
break;
case TAG_ECDSA_LABEL:
+ /* NUL terminated data? */
+ CHECK(dst__privelement_is_nul_terminated(
+ &priv.elements[i]));
label = (char *)priv.elements[i].data;
break;
case TAG_ECDSA_PRIVATEKEY:
/* The Engine: tag is explicitly ignored */
break;
case TAG_EDDSA_LABEL:
+ /* NUL terminated data? */
+ CHECK(dst__privelement_is_nul_terminated(
+ &priv.elements[i]));
label = (char *)priv.elements[i].data;
break;
case TAG_EDDSA_PRIVATEKEY:
/* The Engine: tag is explicitly ignored */
break;
case TAG_RSA_LABEL:
+ /* NUL terminated data? */
+ CHECK(dst__privelement_is_nul_terminated(
+ &priv.elements[i]));
label = (char *)priv.elements[i].data;
break;
default: