diff options
Diffstat (limited to 'lib/x509/dn.c')
-rw-r--r-- | lib/x509/dn.c | 806 |
1 files changed, 403 insertions, 403 deletions
diff --git a/lib/x509/dn.c b/lib/x509/dn.c index 81b8890375..9757258fa6 100644 --- a/lib/x509/dn.c +++ b/lib/x509/dn.c @@ -67,9 +67,9 @@ str_escape (char *str, char *buffer, unsigned int buffer_size) for (i = j = 0; i < str_length; i++) { if (str[i] == ',' || str[i] == '+' || str[i] == '"' - || str[i] == '\\' || str[i] == '<' || str[i] == '>' - || str[i] == ';') - buffer[j++] = '\\'; + || str[i] == '\\' || str[i] == '<' || str[i] == '>' + || str[i] == ';') + buffer[j++] = '\\'; buffer[j++] = str[i]; } @@ -88,8 +88,8 @@ str_escape (char *str, char *buffer, unsigned int buffer_size) */ int _gnutls_x509_parse_dn (ASN1_TYPE asn1_struct, - const char *asn1_rdn_name, char *buf, - size_t * sizeof_buf) + const char *asn1_rdn_name, char *buf, + size_t * sizeof_buf) { gnutls_buffer_st out_str; int k2, k1, result; @@ -125,176 +125,176 @@ _gnutls_x509_parse_dn (ASN1_TYPE asn1_struct, /* create a string like "tbsCertList.issuer.rdnSequence.?1" */ if (asn1_rdn_name[0] != 0) - snprintf (tmpbuffer1, sizeof (tmpbuffer1), "%s.?%u", asn1_rdn_name, - k1); + snprintf (tmpbuffer1, sizeof (tmpbuffer1), "%s.?%u", asn1_rdn_name, + k1); else - snprintf (tmpbuffer1, sizeof (tmpbuffer1), "?%u", k1); + snprintf (tmpbuffer1, sizeof (tmpbuffer1), "?%u", k1); len = sizeof (value) - 1; result = asn1_read_value (asn1_struct, tmpbuffer1, value, &len); if (result == ASN1_ELEMENT_NOT_FOUND) - { - break; - } + { + break; + } if (result != ASN1_VALUE_NOT_FOUND) - { - gnutls_assert (); - result = _gnutls_asn2err (result); - goto cleanup; - } + { + gnutls_assert (); + result = _gnutls_asn2err (result); + goto cleanup; + } k2 = 0; do - { /* Move to the attibute type and values - */ - k2++; - - if (tmpbuffer1[0] != 0) - snprintf (tmpbuffer2, sizeof (tmpbuffer2), "%s.?%u", tmpbuffer1, - k2); - else - snprintf (tmpbuffer2, sizeof (tmpbuffer2), "?%u", k2); - - /* Try to read the RelativeDistinguishedName attributes. - */ - - len = sizeof (value) - 1; - result = asn1_read_value (asn1_struct, tmpbuffer2, value, &len); - - if (result == ASN1_ELEMENT_NOT_FOUND) - break; - if (result != ASN1_VALUE_NOT_FOUND) - { - gnutls_assert (); - result = _gnutls_asn2err (result); - goto cleanup; - } - - /* Read the OID - */ - _gnutls_str_cpy (tmpbuffer3, sizeof (tmpbuffer3), tmpbuffer2); - _gnutls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".type"); - - len = sizeof (oid) - 1; - result = asn1_read_value (asn1_struct, tmpbuffer3, oid, &len); - - if (result == ASN1_ELEMENT_NOT_FOUND) - break; - else if (result != ASN1_SUCCESS) - { - gnutls_assert (); - result = _gnutls_asn2err (result); - goto cleanup; - } - - /* Read the Value - */ - _gnutls_str_cpy (tmpbuffer3, sizeof (tmpbuffer3), tmpbuffer2); - _gnutls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".value"); - - len = 0; - result = asn1_read_value (asn1_struct, tmpbuffer3, NULL, &len); - - value2 = gnutls_malloc (len); - if (value2 == NULL) - { - gnutls_assert (); - result = GNUTLS_E_MEMORY_ERROR; - goto cleanup; - } - - result = asn1_read_value (asn1_struct, tmpbuffer3, value2, &len); - - if (result != ASN1_SUCCESS) - { - gnutls_assert (); - result = _gnutls_asn2err (result); - goto cleanup; - } + { /* Move to the attibute type and values + */ + k2++; + + if (tmpbuffer1[0] != 0) + snprintf (tmpbuffer2, sizeof (tmpbuffer2), "%s.?%u", tmpbuffer1, + k2); + else + snprintf (tmpbuffer2, sizeof (tmpbuffer2), "?%u", k2); + + /* Try to read the RelativeDistinguishedName attributes. + */ + + len = sizeof (value) - 1; + result = asn1_read_value (asn1_struct, tmpbuffer2, value, &len); + + if (result == ASN1_ELEMENT_NOT_FOUND) + break; + if (result != ASN1_VALUE_NOT_FOUND) + { + gnutls_assert (); + result = _gnutls_asn2err (result); + goto cleanup; + } + + /* Read the OID + */ + _gnutls_str_cpy (tmpbuffer3, sizeof (tmpbuffer3), tmpbuffer2); + _gnutls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".type"); + + len = sizeof (oid) - 1; + result = asn1_read_value (asn1_struct, tmpbuffer3, oid, &len); + + if (result == ASN1_ELEMENT_NOT_FOUND) + break; + else if (result != ASN1_SUCCESS) + { + gnutls_assert (); + result = _gnutls_asn2err (result); + goto cleanup; + } + + /* Read the Value + */ + _gnutls_str_cpy (tmpbuffer3, sizeof (tmpbuffer3), tmpbuffer2); + _gnutls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".value"); + + len = 0; + result = asn1_read_value (asn1_struct, tmpbuffer3, NULL, &len); + + value2 = gnutls_malloc (len); + if (value2 == NULL) + { + gnutls_assert (); + result = GNUTLS_E_MEMORY_ERROR; + goto cleanup; + } + + result = asn1_read_value (asn1_struct, tmpbuffer3, value2, &len); + + if (result != ASN1_SUCCESS) + { + gnutls_assert (); + result = _gnutls_asn2err (result); + goto cleanup; + } #define STR_APPEND(y) if ((result=_gnutls_buffer_append_str( &out_str, y)) < 0) { \ gnutls_assert(); \ goto cleanup; \ } - /* The encodings of adjoining RelativeDistinguishedNames are separated - * by a comma character (',' ASCII 44). - */ - - /* Where there is a multi-valued RDN, the outputs from adjoining - * AttributeTypeAndValues are separated by a plus ('+' ASCII 43) - * character. - */ - if (k1 != 1) - { /* the first time do not append a comma */ - if (k2 != 1) - { /* adjoining multi-value RDN */ - STR_APPEND ("+"); - } - else - { - STR_APPEND (","); - } - } - - ldap_desc = oid2ldap_string (oid); - printable = _gnutls_x509_oid_data_printable (oid); - - /* leading #, hex encoded value and terminating NULL */ - sizeof_escaped = 2 * len + 2; - - escaped = gnutls_malloc (sizeof_escaped); - if (escaped == NULL) - { - gnutls_assert (); - result = GNUTLS_E_MEMORY_ERROR; - goto cleanup; - } - - sizeof_string = 2 * len + 2; /* in case it is not printable */ - - string = gnutls_malloc (sizeof_string); - if (string == NULL) - { - gnutls_assert (); - result = GNUTLS_E_MEMORY_ERROR; - goto cleanup; - } - - STR_APPEND (ldap_desc); - STR_APPEND ("="); - result = 0; - - if (printable) - result = - _gnutls_x509_oid_data2string (oid, - value2, len, - string, &sizeof_string); - - if (!printable || result < 0) - result = - _gnutls_x509_data2hex (value2, len, string, &sizeof_string); - - if (result < 0) - { - gnutls_assert (); - _gnutls_x509_log - ("Found OID: '%s' with value '%s'\n", - oid, _gnutls_bin2hex (value2, len, escaped, sizeof_escaped, - NULL)); - goto cleanup; - } - STR_APPEND (str_escape (string, escaped, sizeof_escaped)); - gnutls_free (string); - string = NULL; - - gnutls_free (escaped); - escaped = NULL; - gnutls_free (value2); - value2 = NULL; - - } + /* The encodings of adjoining RelativeDistinguishedNames are separated + * by a comma character (',' ASCII 44). + */ + + /* Where there is a multi-valued RDN, the outputs from adjoining + * AttributeTypeAndValues are separated by a plus ('+' ASCII 43) + * character. + */ + if (k1 != 1) + { /* the first time do not append a comma */ + if (k2 != 1) + { /* adjoining multi-value RDN */ + STR_APPEND ("+"); + } + else + { + STR_APPEND (","); + } + } + + ldap_desc = oid2ldap_string (oid); + printable = _gnutls_x509_oid_data_printable (oid); + + /* leading #, hex encoded value and terminating NULL */ + sizeof_escaped = 2 * len + 2; + + escaped = gnutls_malloc (sizeof_escaped); + if (escaped == NULL) + { + gnutls_assert (); + result = GNUTLS_E_MEMORY_ERROR; + goto cleanup; + } + + sizeof_string = 2 * len + 2; /* in case it is not printable */ + + string = gnutls_malloc (sizeof_string); + if (string == NULL) + { + gnutls_assert (); + result = GNUTLS_E_MEMORY_ERROR; + goto cleanup; + } + + STR_APPEND (ldap_desc); + STR_APPEND ("="); + result = 0; + + if (printable) + result = + _gnutls_x509_oid_data2string (oid, + value2, len, + string, &sizeof_string); + + if (!printable || result < 0) + result = + _gnutls_x509_data2hex (value2, len, string, &sizeof_string); + + if (result < 0) + { + gnutls_assert (); + _gnutls_x509_log + ("Found OID: '%s' with value '%s'\n", + oid, _gnutls_bin2hex (value2, len, escaped, sizeof_escaped, + NULL)); + goto cleanup; + } + STR_APPEND (str_escape (string, escaped, sizeof_escaped)); + gnutls_free (string); + string = NULL; + + gnutls_free (escaped); + escaped = NULL; + gnutls_free (value2); + value2 = NULL; + + } while (1); } @@ -340,10 +340,10 @@ cleanup: */ int _gnutls_x509_parse_dn_oid (ASN1_TYPE asn1_struct, - const char *asn1_rdn_name, - const char *given_oid, int indx, - unsigned int raw_flag, - void *buf, size_t * sizeof_buf) + const char *asn1_rdn_name, + const char *given_oid, int indx, + unsigned int raw_flag, + void *buf, size_t * sizeof_buf) { int k2, k1, result; char tmpbuffer1[ASN1_MAX_NAME_SIZE]; @@ -368,130 +368,130 @@ _gnutls_x509_parse_dn_oid (ASN1_TYPE asn1_struct, /* create a string like "tbsCertList.issuer.rdnSequence.?1" */ if (asn1_rdn_name[0] != 0) - snprintf (tmpbuffer1, sizeof (tmpbuffer1), "%s.?%u", asn1_rdn_name, - k1); + snprintf (tmpbuffer1, sizeof (tmpbuffer1), "%s.?%u", asn1_rdn_name, + k1); else - snprintf (tmpbuffer1, sizeof (tmpbuffer1), "?%u", k1); + snprintf (tmpbuffer1, sizeof (tmpbuffer1), "?%u", k1); len = sizeof (value) - 1; result = asn1_read_value (asn1_struct, tmpbuffer1, value, &len); if (result == ASN1_ELEMENT_NOT_FOUND) - { - gnutls_assert (); - break; - } + { + gnutls_assert (); + break; + } if (result != ASN1_VALUE_NOT_FOUND) - { - gnutls_assert (); - result = _gnutls_asn2err (result); - goto cleanup; - } + { + gnutls_assert (); + result = _gnutls_asn2err (result); + goto cleanup; + } k2 = 0; do - { /* Move to the attibute type and values - */ - k2++; - - if (tmpbuffer1[0] != 0) - snprintf (tmpbuffer2, sizeof (tmpbuffer2), "%s.?%u", tmpbuffer1, - k2); - else - snprintf (tmpbuffer2, sizeof (tmpbuffer2), "?%u", k2); - - /* Try to read the RelativeDistinguishedName attributes. - */ - - len = sizeof (value) - 1; - result = asn1_read_value (asn1_struct, tmpbuffer2, value, &len); - - if (result == ASN1_ELEMENT_NOT_FOUND) - { - break; - } - if (result != ASN1_VALUE_NOT_FOUND) - { - gnutls_assert (); - result = _gnutls_asn2err (result); - goto cleanup; - } - - /* Read the OID - */ - _gnutls_str_cpy (tmpbuffer3, sizeof (tmpbuffer3), tmpbuffer2); - _gnutls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".type"); - - len = sizeof (oid) - 1; - result = asn1_read_value (asn1_struct, tmpbuffer3, oid, &len); - - if (result == ASN1_ELEMENT_NOT_FOUND) - break; - else if (result != ASN1_SUCCESS) - { - gnutls_assert (); - result = _gnutls_asn2err (result); - goto cleanup; - } - - if (strcmp (oid, given_oid) == 0 && indx == i++) - { /* Found the OID */ - - /* Read the Value - */ - _gnutls_str_cpy (tmpbuffer3, sizeof (tmpbuffer3), tmpbuffer2); - _gnutls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".value"); - - len = *sizeof_buf; - result = asn1_read_value (asn1_struct, tmpbuffer3, buf, &len); - - if (result != ASN1_SUCCESS) - { - gnutls_assert (); - if (result == ASN1_MEM_ERROR) - *sizeof_buf = len; - result = _gnutls_asn2err (result); - goto cleanup; - } - - if (raw_flag != 0) - { - if ((unsigned) len > *sizeof_buf) - { - *sizeof_buf = len; - result = GNUTLS_E_SHORT_MEMORY_BUFFER; - goto cleanup; - } - *sizeof_buf = len; - - return 0; - - } - else - { /* parse data. raw_flag == 0 */ - printable = _gnutls_x509_oid_data_printable (oid); - - if (printable == 1) - result = - _gnutls_x509_oid_data2string (oid, buf, len, - cbuf, sizeof_buf); - else - result = - _gnutls_x509_data2hex (buf, len, cbuf, sizeof_buf); - - if (result < 0) - { - gnutls_assert (); - goto cleanup; - } - - return 0; - - } /* raw_flag == 0 */ - } - } + { /* Move to the attibute type and values + */ + k2++; + + if (tmpbuffer1[0] != 0) + snprintf (tmpbuffer2, sizeof (tmpbuffer2), "%s.?%u", tmpbuffer1, + k2); + else + snprintf (tmpbuffer2, sizeof (tmpbuffer2), "?%u", k2); + + /* Try to read the RelativeDistinguishedName attributes. + */ + + len = sizeof (value) - 1; + result = asn1_read_value (asn1_struct, tmpbuffer2, value, &len); + + if (result == ASN1_ELEMENT_NOT_FOUND) + { + break; + } + if (result != ASN1_VALUE_NOT_FOUND) + { + gnutls_assert (); + result = _gnutls_asn2err (result); + goto cleanup; + } + + /* Read the OID + */ + _gnutls_str_cpy (tmpbuffer3, sizeof (tmpbuffer3), tmpbuffer2); + _gnutls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".type"); + + len = sizeof (oid) - 1; + result = asn1_read_value (asn1_struct, tmpbuffer3, oid, &len); + + if (result == ASN1_ELEMENT_NOT_FOUND) + break; + else if (result != ASN1_SUCCESS) + { + gnutls_assert (); + result = _gnutls_asn2err (result); + goto cleanup; + } + + if (strcmp (oid, given_oid) == 0 && indx == i++) + { /* Found the OID */ + + /* Read the Value + */ + _gnutls_str_cpy (tmpbuffer3, sizeof (tmpbuffer3), tmpbuffer2); + _gnutls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".value"); + + len = *sizeof_buf; + result = asn1_read_value (asn1_struct, tmpbuffer3, buf, &len); + + if (result != ASN1_SUCCESS) + { + gnutls_assert (); + if (result == ASN1_MEM_ERROR) + *sizeof_buf = len; + result = _gnutls_asn2err (result); + goto cleanup; + } + + if (raw_flag != 0) + { + if ((unsigned) len > *sizeof_buf) + { + *sizeof_buf = len; + result = GNUTLS_E_SHORT_MEMORY_BUFFER; + goto cleanup; + } + *sizeof_buf = len; + + return 0; + + } + else + { /* parse data. raw_flag == 0 */ + printable = _gnutls_x509_oid_data_printable (oid); + + if (printable == 1) + result = + _gnutls_x509_oid_data2string (oid, buf, len, + cbuf, sizeof_buf); + else + result = + _gnutls_x509_data2hex (buf, len, cbuf, sizeof_buf); + + if (result < 0) + { + gnutls_assert (); + goto cleanup; + } + + return 0; + + } /* raw_flag == 0 */ + } + } while (1); } @@ -517,8 +517,8 @@ cleanup: */ int _gnutls_x509_get_dn_oid (ASN1_TYPE asn1_struct, - const char *asn1_rdn_name, - int indx, void *_oid, size_t * sizeof_oid) + const char *asn1_rdn_name, + int indx, void *_oid, size_t * sizeof_oid) { int k2, k1, result; char tmpbuffer1[ASN1_MAX_NAME_SIZE]; @@ -537,92 +537,92 @@ _gnutls_x509_get_dn_oid (ASN1_TYPE asn1_struct, /* create a string like "tbsCertList.issuer.rdnSequence.?1" */ if (asn1_rdn_name[0] != 0) - snprintf (tmpbuffer1, sizeof (tmpbuffer1), "%s.?%u", asn1_rdn_name, - k1); + snprintf (tmpbuffer1, sizeof (tmpbuffer1), "%s.?%u", asn1_rdn_name, + k1); else - snprintf (tmpbuffer1, sizeof (tmpbuffer1), "?%u", k1); + snprintf (tmpbuffer1, sizeof (tmpbuffer1), "?%u", k1); len = sizeof (value) - 1; result = asn1_read_value (asn1_struct, tmpbuffer1, value, &len); if (result == ASN1_ELEMENT_NOT_FOUND) - { - gnutls_assert (); - break; - } + { + gnutls_assert (); + break; + } if (result != ASN1_VALUE_NOT_FOUND) - { - gnutls_assert (); - result = _gnutls_asn2err (result); - goto cleanup; - } + { + gnutls_assert (); + result = _gnutls_asn2err (result); + goto cleanup; + } k2 = 0; do - { /* Move to the attibute type and values - */ - k2++; - - if (tmpbuffer1[0] != 0) - snprintf (tmpbuffer2, sizeof (tmpbuffer2), "%s.?%u", tmpbuffer1, - k2); - else - snprintf (tmpbuffer2, sizeof (tmpbuffer2), "?%u", k2); - - /* Try to read the RelativeDistinguishedName attributes. - */ - - len = sizeof (value) - 1; - result = asn1_read_value (asn1_struct, tmpbuffer2, value, &len); - - if (result == ASN1_ELEMENT_NOT_FOUND) - { - break; - } - if (result != ASN1_VALUE_NOT_FOUND) - { - gnutls_assert (); - result = _gnutls_asn2err (result); - goto cleanup; - } - - /* Read the OID - */ - _gnutls_str_cpy (tmpbuffer3, sizeof (tmpbuffer3), tmpbuffer2); - _gnutls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".type"); - - len = sizeof (oid) - 1; - result = asn1_read_value (asn1_struct, tmpbuffer3, oid, &len); - - if (result == ASN1_ELEMENT_NOT_FOUND) - break; - else if (result != ASN1_SUCCESS) - { - gnutls_assert (); - result = _gnutls_asn2err (result); - goto cleanup; - } - - if (indx == i++) - { /* Found the OID */ - - len = strlen (oid) + 1; - - if (*sizeof_oid < (unsigned) len) - { - *sizeof_oid = len; - gnutls_assert (); - return GNUTLS_E_SHORT_MEMORY_BUFFER; - } - - memcpy (_oid, oid, len); - *sizeof_oid = len - 1; - - return 0; - } - } + { /* Move to the attibute type and values + */ + k2++; + + if (tmpbuffer1[0] != 0) + snprintf (tmpbuffer2, sizeof (tmpbuffer2), "%s.?%u", tmpbuffer1, + k2); + else + snprintf (tmpbuffer2, sizeof (tmpbuffer2), "?%u", k2); + + /* Try to read the RelativeDistinguishedName attributes. + */ + + len = sizeof (value) - 1; + result = asn1_read_value (asn1_struct, tmpbuffer2, value, &len); + + if (result == ASN1_ELEMENT_NOT_FOUND) + { + break; + } + if (result != ASN1_VALUE_NOT_FOUND) + { + gnutls_assert (); + result = _gnutls_asn2err (result); + goto cleanup; + } + + /* Read the OID + */ + _gnutls_str_cpy (tmpbuffer3, sizeof (tmpbuffer3), tmpbuffer2); + _gnutls_str_cat (tmpbuffer3, sizeof (tmpbuffer3), ".type"); + + len = sizeof (oid) - 1; + result = asn1_read_value (asn1_struct, tmpbuffer3, oid, &len); + + if (result == ASN1_ELEMENT_NOT_FOUND) + break; + else if (result != ASN1_SUCCESS) + { + gnutls_assert (); + result = _gnutls_asn2err (result); + goto cleanup; + } + + if (indx == i++) + { /* Found the OID */ + + len = strlen (oid) + 1; + + if (*sizeof_oid < (unsigned) len) + { + *sizeof_oid = len; + gnutls_assert (); + return GNUTLS_E_SHORT_MEMORY_BUFFER; + } + + memcpy (_oid, oid, len); + *sizeof_oid = len - 1; + + return 0; + } + } while (1); } @@ -642,10 +642,10 @@ cleanup: */ int _gnutls_x509_encode_and_write_attribute (const char *given_oid, - ASN1_TYPE asn1_struct, - const char *where, - const void *_data, - int sizeof_data, int multi) + ASN1_TYPE asn1_struct, + const char *where, + const void *_data, + int sizeof_data, int multi) { const char *val_name; const opaque *data = _data; @@ -684,24 +684,24 @@ _gnutls_x509_encode_and_write_attribute (const char *given_oid, * the UTF8 string type if not. */ for (i = 0; i < sizeof_data; i++) - { - if (!isascii (data[i])) - { - string_type = "utf8String"; - break; - } - } + { + if (!isascii (data[i])) + { + string_type = "utf8String"; + break; + } + } /* if the type is a CHOICE then write the * type we'll use. */ result = asn1_write_value (c2, "", string_type, 1); if (result != ASN1_SUCCESS) - { - gnutls_assert (); - result = _gnutls_asn2err (result); - goto error; - } + { + gnutls_assert (); + result = _gnutls_asn2err (result); + goto error; + } _gnutls_str_cpy (tmp, sizeof (tmp), string_type); } @@ -722,16 +722,16 @@ _gnutls_x509_encode_and_write_attribute (const char *given_oid, _gnutls_str_cat (tmp, sizeof (tmp), ".value"); if (multi != 0) - { /* if not writing an AttributeTypeAndValue, but an Attribute */ - _gnutls_str_cat (tmp, sizeof (tmp), "s"); /* values */ + { /* if not writing an AttributeTypeAndValue, but an Attribute */ + _gnutls_str_cat (tmp, sizeof (tmp), "s"); /* values */ result = asn1_write_value (asn1_struct, tmp, "NEW", 1); if (result != ASN1_SUCCESS) - { - gnutls_assert (); - result = _gnutls_asn2err (result); - goto error; - } + { + gnutls_assert (); + result = _gnutls_asn2err (result); + goto error; + } _gnutls_str_cat (tmp, sizeof (tmp), ".?LAST"); @@ -771,8 +771,8 @@ error: */ static int _gnutls_x509_write_attribute (const char *given_oid, - ASN1_TYPE asn1_struct, const char *where, - const void *_data, int sizeof_data) + ASN1_TYPE asn1_struct, const char *where, + const void *_data, int sizeof_data) { char tmp[128]; int result; @@ -816,9 +816,9 @@ _gnutls_x509_write_attribute (const char *given_oid, */ int _gnutls_x509_decode_and_read_attribute (ASN1_TYPE asn1_struct, - const char *where, char *oid, - int oid_size, gnutls_datum_t * value, - int multi, int octet_string) + const char *where, char *oid, + int oid_size, gnutls_datum_t * value, + int multi, int octet_string) { char tmpbuffer[128]; int len, result; @@ -845,7 +845,7 @@ _gnutls_x509_decode_and_read_attribute (ASN1_TYPE asn1_struct, _gnutls_str_cat (tmpbuffer, sizeof (tmpbuffer), ".value"); if (multi) - _gnutls_str_cat (tmpbuffer, sizeof (tmpbuffer), "s.?1"); /* .values.?1 */ + _gnutls_str_cat (tmpbuffer, sizeof (tmpbuffer), "s.?1"); /* .values.?1 */ result = _gnutls_x509_read_value (asn1_struct, tmpbuffer, value, octet_string); @@ -868,8 +868,8 @@ _gnutls_x509_decode_and_read_attribute (ASN1_TYPE asn1_struct, */ int _gnutls_x509_set_dn_oid (ASN1_TYPE asn1_struct, - const char *asn1_name, const char *given_oid, - int raw_flag, const char *name, int sizeof_name) + const char *asn1_name, const char *given_oid, + int raw_flag, const char *name, int sizeof_name) { int result; char tmp[ASN1_MAX_NAME_SIZE], asn1_rdn_name[ASN1_MAX_NAME_SIZE]; @@ -922,15 +922,15 @@ _gnutls_x509_set_dn_oid (ASN1_TYPE asn1_struct, if (!raw_flag) { result = - _gnutls_x509_encode_and_write_attribute (given_oid, - asn1_struct, - tmp, name, sizeof_name, 0); + _gnutls_x509_encode_and_write_attribute (given_oid, + asn1_struct, + tmp, name, sizeof_name, 0); } else { result = - _gnutls_x509_write_attribute (given_oid, asn1_struct, - tmp, name, sizeof_name); + _gnutls_x509_write_attribute (given_oid, asn1_struct, + tmp, name, sizeof_name); } if (result < 0) @@ -964,7 +964,7 @@ gnutls_x509_dn_init (gnutls_x509_dn_t * dn) if ((result = asn1_create_element (_gnutls_get_pkix (), - "PKIX1.Name", &tmpdn)) != ASN1_SUCCESS) + "PKIX1.Name", &tmpdn)) != ASN1_SUCCESS) { gnutls_assert (); return _gnutls_asn2err (result); @@ -997,7 +997,7 @@ gnutls_x509_dn_import (gnutls_x509_dn_t dn, const gnutls_datum_t * data) char err[ASN1_MAX_ERROR_DESCRIPTION_SIZE]; result = asn1_der_decoding ((ASN1_TYPE *) & dn, - data->data, data->size, err); + data->data, data->size, err); if (result != ASN1_SUCCESS) { /* couldn't decode DER */ @@ -1041,7 +1041,7 @@ gnutls_x509_dn_deinit (gnutls_x509_dn_t dn) **/ int gnutls_x509_rdn_get (const gnutls_datum_t * idn, - char *buf, size_t * sizeof_buf) + char *buf, size_t * sizeof_buf) { int result; ASN1_TYPE dn = ASN1_TYPE_EMPTY; @@ -1058,7 +1058,7 @@ gnutls_x509_rdn_get (const gnutls_datum_t * idn, if ((result = asn1_create_element (_gnutls_get_pkix (), - "PKIX1.Name", &dn)) != ASN1_SUCCESS) + "PKIX1.Name", &dn)) != ASN1_SUCCESS) { gnutls_assert (); return _gnutls_asn2err (result); @@ -1101,8 +1101,8 @@ gnutls_x509_rdn_get (const gnutls_datum_t * idn, **/ int gnutls_x509_rdn_get_by_oid (const gnutls_datum_t * idn, const char *oid, - int indx, unsigned int raw_flag, - void *buf, size_t * sizeof_buf) + int indx, unsigned int raw_flag, + void *buf, size_t * sizeof_buf) { int result; ASN1_TYPE dn = ASN1_TYPE_EMPTY; @@ -1114,7 +1114,7 @@ gnutls_x509_rdn_get_by_oid (const gnutls_datum_t * idn, const char *oid, if ((result = asn1_create_element (_gnutls_get_pkix (), - "PKIX1.Name", &dn)) != ASN1_SUCCESS) + "PKIX1.Name", &dn)) != ASN1_SUCCESS) { gnutls_assert (); return _gnutls_asn2err (result); @@ -1131,7 +1131,7 @@ gnutls_x509_rdn_get_by_oid (const gnutls_datum_t * idn, const char *oid, result = _gnutls_x509_parse_dn_oid (dn, "rdnSequence", oid, indx, - raw_flag, buf, sizeof_buf); + raw_flag, buf, sizeof_buf); asn1_delete_structure (&dn); return result; @@ -1157,7 +1157,7 @@ gnutls_x509_rdn_get_by_oid (const gnutls_datum_t * idn, const char *oid, **/ int gnutls_x509_rdn_get_oid (const gnutls_datum_t * idn, - int indx, void *buf, size_t * sizeof_buf) + int indx, void *buf, size_t * sizeof_buf) { int result; ASN1_TYPE dn = ASN1_TYPE_EMPTY; @@ -1169,7 +1169,7 @@ gnutls_x509_rdn_get_oid (const gnutls_datum_t * idn, if ((result = asn1_create_element (_gnutls_get_pkix (), - "PKIX1.Name", &dn)) != ASN1_SUCCESS) + "PKIX1.Name", &dn)) != ASN1_SUCCESS) { gnutls_assert (); return _gnutls_asn2err (result); @@ -1201,7 +1201,7 @@ gnutls_x509_rdn_get_oid (const gnutls_datum_t * idn, */ int _gnutls_x509_compare_raw_dn (const gnutls_datum_t * dn1, - const gnutls_datum_t * dn2) + const gnutls_datum_t * dn2) { if (dn1->size != dn2->size) @@ -1214,7 +1214,7 @@ _gnutls_x509_compare_raw_dn (const gnutls_datum_t * dn1, gnutls_assert (); return 0; } - return 1; /* they match */ + return 1; /* they match */ } /** @@ -1239,8 +1239,8 @@ _gnutls_x509_compare_raw_dn (const gnutls_datum_t * dn1, **/ int gnutls_x509_dn_export (gnutls_x509_dn_t dn, - gnutls_x509_crt_fmt_t format, void *output_data, - size_t * output_data_size) + gnutls_x509_crt_fmt_t format, void *output_data, + size_t * output_data_size) { ASN1_TYPE asn1 = dn; @@ -1251,6 +1251,6 @@ gnutls_x509_dn_export (gnutls_x509_dn_t dn, } return _gnutls_x509_export_int_named (asn1, "rdnSequence", - format, "NAME", - output_data, output_data_size); + format, "NAME", + output_data, output_data_size); } |