Constify a bit X509_NAME_get_entry
authorFdaSilvaYY <fdasilvayy@gmail.com>
Fri, 19 Aug 2016 17:44:10 +0000 (19:44 +0200)
committerRichard Levitte <levitte@openssl.org>
Tue, 23 Aug 2016 09:47:22 +0000 (11:47 +0200)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
crypto/asn1/a_strex.c
crypto/x509/x509name.c
doc/crypto/X509_NAME_get_index_by_NID.pod
include/openssl/x509.h

index fc9883b..9839f5c 100644 (file)
@@ -455,9 +455,9 @@ static int do_name_ex(char_io *io_ch, void *arg, const X509_NAME *n,
     cnt = X509_NAME_entry_count(n);
     for (i = 0; i < cnt; i++) {
         if (flags & XN_FLAG_DN_REV)
-            ent = X509_NAME_get_entry((X509_NAME *)n, cnt - i - 1);
+            ent = X509_NAME_get_entry(n, cnt - i - 1);
         else
-            ent = X509_NAME_get_entry((X509_NAME *)n, i);
+            ent = X509_NAME_get_entry(n, i);
         if (prev != -1) {
             if (prev == X509_NAME_ENTRY_set(ent)) {
                 if (!io_ch(arg, sep_mv, sep_mv_len))
index ae39c75..919d8c1 100644 (file)
@@ -82,7 +82,7 @@ int X509_NAME_get_index_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, int last
     return (-1);
 }
 
-X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc)
+X509_NAME_ENTRY *X509_NAME_get_entry(const X509_NAME *name, int loc)
 {
     if (name == NULL || sk_X509_NAME_ENTRY_num(name->entries) <= loc
         || loc < 0)
index 9b36739..042da24 100644 (file)
@@ -14,7 +14,7 @@ X509_NAME lookup and enumeration functions
  int X509_NAME_get_index_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, int lastpos);
 
  int X509_NAME_entry_count(const X509_NAME *name);
- X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc);
+ X509_NAME_ENTRY *X509_NAME_get_entry(const X509_NAME *name, int loc);
 
  int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, char *buf, int len);
  int X509_NAME_get_text_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, char *buf, int len);
index 3e45ec0..c8996f3 100644 (file)
@@ -790,7 +790,7 @@ int X509_NAME_get_text_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj,
 int X509_NAME_get_index_by_NID(X509_NAME *name, int nid, int lastpos);
 int X509_NAME_get_index_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj,
                                int lastpos);
-X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc);
+X509_NAME_ENTRY *X509_NAME_get_entry(const X509_NAME *name, int loc);
 X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc);
 int X509_NAME_add_entry(X509_NAME *name, const X509_NAME_ENTRY *ne,
                         int loc, int set);