diff options
author | FdaSilvaYY <fdasilvayy@gmail.com> | 2016-07-07 23:45:55 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2016-08-23 11:47:22 +0200 |
commit | 9f5466b9b86607bb62239873e6be2de1fe9f71fb (patch) | |
tree | 5726015f77d40cdb31560353bb214eb8d1b24ca5 /crypto/x509/x509name.c | |
parent | bf9d5e483db0683178f43ef74a4ae6577482db83 (diff) |
Constify some X509_NAME, ASN1 printing code
ASN1_buf_print, asn1_print_*, X509_NAME_oneline, X509_NAME_print
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/x509/x509name.c')
-rw-r--r-- | crypto/x509/x509name.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/crypto/x509/x509name.c b/crypto/x509/x509name.c index fa84bff434..ae39c75e58 100644 --- a/crypto/x509/x509name.c +++ b/crypto/x509/x509name.c @@ -30,7 +30,7 @@ int X509_NAME_get_text_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, char *buf int len) { int i; - ASN1_STRING *data; + const ASN1_STRING *data; i = X509_NAME_get_index_by_OBJ(name, obj, -1); if (i < 0) @@ -176,7 +176,7 @@ int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type, * if set is -1, append to previous set, 0 'a new one', and 1, prepend to the * guy we are about to stomp on. */ -int X509_NAME_add_entry(X509_NAME *name, X509_NAME_ENTRY *ne, int loc, +int X509_NAME_add_entry(X509_NAME *name, const X509_NAME_ENTRY *ne, int loc, int set) { X509_NAME_ENTRY *new_name = NULL; @@ -214,7 +214,11 @@ int X509_NAME_add_entry(X509_NAME *name, X509_NAME_ENTRY *ne, int loc, inc = (set == 0) ? 1 : 0; } - if ((new_name = X509_NAME_ENTRY_dup(ne)) == NULL) + /* + * X509_NAME_ENTRY_dup is ASN1 generated code, that can't be easily + * const'ified; harmless cast as dup() don't modify its input. + */ + if ((new_name = X509_NAME_ENTRY_dup((X509_NAME_ENTRY *)ne)) == NULL) goto err; new_name->set = set; if (!sk_X509_NAME_ENTRY_insert(sk, new_name, loc)) { @@ -334,14 +338,14 @@ int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, return (1); } -ASN1_OBJECT *X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne) +ASN1_OBJECT *X509_NAME_ENTRY_get_object(const X509_NAME_ENTRY *ne) { if (ne == NULL) return (NULL); return (ne->object); } -ASN1_STRING *X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne) +ASN1_STRING *X509_NAME_ENTRY_get_data(const X509_NAME_ENTRY *ne) { if (ne == NULL) return (NULL); |