Document that ASN1_STRING_set_by_NID enforces the bounds on the string
This then impacts X509_NAME_ENTRY_set_data, which impacts
X509_NAME_ENTRY_create_by_OBJ, which impacts
X509_NAME_ENTRY_create_by_NID.
It is... unfortunate that you need to follow so many links in the docs
to find out what these functions do, but they're all so absurdly
complicated, with layered quirks, it was difficult to keep all those
copies in sync without just referencing each other.
(This came up in discussion of cl/817621459.)
Change-Id: I399f1f3a2734e8fa67fe92166e3984e5a2e091e7
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/82748
Auto-Submit: David Benjamin <davidben@google.com>
Reviewed-by: Lily Chen <chlily@google.com>
Commit-Queue: Lily Chen <chlily@google.com>
diff --git a/include/openssl/asn1.h b/include/openssl/asn1.h
index 7a251b5..039594f 100644
--- a/include/openssl/asn1.h
+++ b/include/openssl/asn1.h
@@ -720,7 +720,10 @@
// |mask|, |minsize|, and |maxsize| based on |nid|. When |nid| is a recognized
// X.509 attribute type, it will pick a suitable ASN.1 string type and bounds.
// For most attribute types, it preferentially chooses UTF8String. If |nid| is
-// unrecognized, it uses UTF8String by default.
+// unrecognized, it uses UTF8String by default. This function will also enforce
+// any known attribute-specific constraints on the sizes of the string and fail
+// if the size is invalid. In RFC 5280, these bounds are specified by
+// constraints like "SIZE (1..ub-common-name)" in ASN.1.
//
// Slightly unlike |ASN1_mbstring_ncopy|, this function interprets |out| and
// returns its result as follows: If |out| is NULL, it returns a newly-allocated