mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-05-07 08:56:17 +08:00
Fix REQ format bug
Attributes not OPTIONAL
This commit is contained in:
@@ -647,7 +647,7 @@ int x509_name_add_country_name(uint8_t *d, size_t *dlen, size_t maxlen, const ch
|
||||
{
|
||||
int ret;
|
||||
ret = x509_name_add_rdn(d, dlen, maxlen,
|
||||
OID_at_country_name, ASN1_TAG_PrintableString, (uint8_t *)val, 2, NULL, 0);
|
||||
OID_at_country_name, ASN1_TAG_PrintableString, (uint8_t *)val, val ? 2 : 0, NULL, 0);
|
||||
if (ret < 0) error_print();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1762,6 +1762,9 @@ int x509_attributes_print(FILE *fp, int fmt, int ind, const char *label, const u
|
||||
format_print(fp, fmt, ind, "%s\n", label);
|
||||
ind += 4;
|
||||
}
|
||||
if (!dlen) {
|
||||
format_print(fp, fmt, ind, "(null)\n");
|
||||
}
|
||||
while (dlen) {
|
||||
if (asn1_sequence_from_der(&p, &len, &d, &dlen) != 1) {
|
||||
error_print();
|
||||
|
||||
@@ -41,12 +41,12 @@ int x509_request_info_to_der(
|
||||
if (asn1_int_to_der(version, NULL, &len) != 1
|
||||
|| asn1_sequence_to_der(subject, subject_len, NULL, &len) != 1
|
||||
|| x509_public_key_info_to_der(subject_public_key, NULL, &len) != 1
|
||||
|| asn1_implicit_set_to_der(0, attrs, attrs_len, NULL, &len) < 0
|
||||
|| asn1_implicit_set_to_der(0, attrs, attrs_len, NULL, &len) != 1
|
||||
|| asn1_sequence_header_to_der(len, out, outlen) != 1
|
||||
|| asn1_int_to_der(version, out, outlen) != 1
|
||||
|| asn1_sequence_to_der(subject, subject_len, out, outlen) != 1
|
||||
|| x509_public_key_info_to_der(subject_public_key, out, outlen) != 1
|
||||
|| asn1_implicit_set_to_der(0, attrs, attrs_len, out, outlen) < 0) {
|
||||
|| asn1_implicit_set_to_der(0, attrs, attrs_len, out, outlen) != 1) {
|
||||
error_print();
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user