Skip to content

Commit

Permalink
update master-with-bazel from master branch
Browse files Browse the repository at this point in the history
  • Loading branch information
BoringSSL Robot committed Aug 24, 2020
2 parents 1d53ac4 + 125a38f commit 6c5c4fb
Show file tree
Hide file tree
Showing 14 changed files with 115 additions and 97 deletions.
6 changes: 3 additions & 3 deletions src/crypto/x509/a_strex.c
Expand Up @@ -446,7 +446,7 @@ static int do_indent(char_io *io_ch, void *arg, int indent)
#define FN_WIDTH_LN 25
#define FN_WIDTH_SN 10

static int do_name_ex(char_io *io_ch, void *arg, X509_NAME *n,
static int do_name_ex(char_io *io_ch, void *arg, const X509_NAME *n,
int indent, unsigned long flags)
{
int i, prev = -1, orflags, cnt;
Expand Down Expand Up @@ -584,7 +584,7 @@ static int do_name_ex(char_io *io_ch, void *arg, X509_NAME *n,

/* Wrappers round the main functions */

int X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent,
int X509_NAME_print_ex(BIO *out, const X509_NAME *nm, int indent,
unsigned long flags)
{
if (flags == XN_FLAG_COMPAT)
Expand All @@ -593,7 +593,7 @@ int X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent,
}

#ifndef OPENSSL_NO_FP_API
int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent,
int X509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm, int indent,
unsigned long flags)
{
if (flags == XN_FLAG_COMPAT) {
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/x509/t_x509.c
Expand Up @@ -494,7 +494,7 @@ int ASN1_UTCTIME_print(BIO *bp, const ASN1_UTCTIME *tm) {
return 0;
}

int X509_NAME_print(BIO *bp, X509_NAME *name, int obase)
int X509_NAME_print(BIO *bp, const X509_NAME *name, int obase)
{
char *s, *c, *b;
int ret = 0, l, i;
Expand Down
9 changes: 7 additions & 2 deletions src/crypto/x509/x509_cmp.c
Expand Up @@ -131,7 +131,7 @@ int X509_CRL_match(const X509_CRL *a, const X509_CRL *b)
return OPENSSL_memcmp(a->sha1_hash, b->sha1_hash, 20);
}

X509_NAME *X509_get_issuer_name(X509 *a)
X509_NAME *X509_get_issuer_name(const X509 *a)
{
return (a->cert_info->issuer);
}
Expand All @@ -146,7 +146,7 @@ unsigned long X509_issuer_name_hash_old(X509 *x)
return (X509_NAME_hash_old(x->cert_info->issuer));
}

X509_NAME *X509_get_subject_name(X509 *a)
X509_NAME *X509_get_subject_name(const X509 *a)
{
return (a->cert_info->subject);
}
Expand All @@ -156,6 +156,11 @@ ASN1_INTEGER *X509_get_serialNumber(X509 *a)
return (a->cert_info->serialNumber);
}

const ASN1_INTEGER *X509_get0_serialNumber(const X509 *x509)
{
return x509->cert_info->serialNumber;
}

unsigned long X509_subject_name_hash(X509 *x)
{
return (X509_NAME_hash(x->cert_info->subject));
Expand Down
39 changes: 21 additions & 18 deletions src/crypto/x509/x509_ext.c
Expand Up @@ -62,27 +62,28 @@
#include <openssl/x509.h>
#include <openssl/x509v3.h>

int X509_CRL_get_ext_count(X509_CRL *x)
int X509_CRL_get_ext_count(const X509_CRL *x)
{
return (X509v3_get_ext_count(x->crl->extensions));
}

int X509_CRL_get_ext_by_NID(X509_CRL *x, int nid, int lastpos)
int X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid, int lastpos)
{
return (X509v3_get_ext_by_NID(x->crl->extensions, nid, lastpos));
}

int X509_CRL_get_ext_by_OBJ(X509_CRL *x, ASN1_OBJECT *obj, int lastpos)
int X509_CRL_get_ext_by_OBJ(const X509_CRL *x, const ASN1_OBJECT *obj,
int lastpos)
{
return (X509v3_get_ext_by_OBJ(x->crl->extensions, obj, lastpos));
}

int X509_CRL_get_ext_by_critical(X509_CRL *x, int crit, int lastpos)
int X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit, int lastpos)
{
return (X509v3_get_ext_by_critical(x->crl->extensions, crit, lastpos));
}

X509_EXTENSION *X509_CRL_get_ext(X509_CRL *x, int loc)
X509_EXTENSION *X509_CRL_get_ext(const X509_CRL *x, int loc)
{
return (X509v3_get_ext(x->crl->extensions, loc));
}
Expand All @@ -92,7 +93,7 @@ X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc)
return (X509v3_delete_ext(x->crl->extensions, loc));
}

void *X509_CRL_get_ext_d2i(X509_CRL *x, int nid, int *crit, int *idx)
void *X509_CRL_get_ext_d2i(const X509_CRL *x, int nid, int *crit, int *idx)
{
return X509V3_get_d2i(x->crl->extensions, nid, crit, idx);
}
Expand All @@ -108,28 +109,28 @@ int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc)
return (X509v3_add_ext(&(x->crl->extensions), ex, loc) != NULL);
}

int X509_get_ext_count(X509 *x)
int X509_get_ext_count(const X509 *x)
{
return (X509v3_get_ext_count(x->cert_info->extensions));
}

int X509_get_ext_by_NID(X509 *x, int nid, int lastpos)
int X509_get_ext_by_NID(const X509 *x, int nid, int lastpos)
{
return (X509v3_get_ext_by_NID(x->cert_info->extensions, nid, lastpos));
}

int X509_get_ext_by_OBJ(X509 *x, ASN1_OBJECT *obj, int lastpos)
int X509_get_ext_by_OBJ(const X509 *x, const ASN1_OBJECT *obj, int lastpos)
{
return (X509v3_get_ext_by_OBJ(x->cert_info->extensions, obj, lastpos));
}

int X509_get_ext_by_critical(X509 *x, int crit, int lastpos)
int X509_get_ext_by_critical(const X509 *x, int crit, int lastpos)
{
return (X509v3_get_ext_by_critical
(x->cert_info->extensions, crit, lastpos));
}

X509_EXTENSION *X509_get_ext(X509 *x, int loc)
X509_EXTENSION *X509_get_ext(const X509 *x, int loc)
{
return (X509v3_get_ext(x->cert_info->extensions, loc));
}
Expand All @@ -144,7 +145,7 @@ int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc)
return (X509v3_add_ext(&(x->cert_info->extensions), ex, loc) != NULL);
}

void *X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx)
void *X509_get_ext_d2i(const X509 *x, int nid, int *crit, int *idx)
{
return X509V3_get_d2i(x->cert_info->extensions, nid, crit, idx);
}
Expand All @@ -156,28 +157,29 @@ int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit,
flags);
}

int X509_REVOKED_get_ext_count(X509_REVOKED *x)
int X509_REVOKED_get_ext_count(const X509_REVOKED *x)
{
return (X509v3_get_ext_count(x->extensions));
}

int X509_REVOKED_get_ext_by_NID(X509_REVOKED *x, int nid, int lastpos)
int X509_REVOKED_get_ext_by_NID(const X509_REVOKED *x, int nid, int lastpos)
{
return (X509v3_get_ext_by_NID(x->extensions, nid, lastpos));
}

int X509_REVOKED_get_ext_by_OBJ(X509_REVOKED *x, ASN1_OBJECT *obj,
int X509_REVOKED_get_ext_by_OBJ(const X509_REVOKED *x, const ASN1_OBJECT *obj,
int lastpos)
{
return (X509v3_get_ext_by_OBJ(x->extensions, obj, lastpos));
}

int X509_REVOKED_get_ext_by_critical(X509_REVOKED *x, int crit, int lastpos)
int X509_REVOKED_get_ext_by_critical(const X509_REVOKED *x, int crit,
int lastpos)
{
return (X509v3_get_ext_by_critical(x->extensions, crit, lastpos));
}

X509_EXTENSION *X509_REVOKED_get_ext(X509_REVOKED *x, int loc)
X509_EXTENSION *X509_REVOKED_get_ext(const X509_REVOKED *x, int loc)
{
return (X509v3_get_ext(x->extensions, loc));
}
Expand All @@ -192,7 +194,8 @@ int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc)
return (X509v3_add_ext(&(x->extensions), ex, loc) != NULL);
}

void *X509_REVOKED_get_ext_d2i(X509_REVOKED *x, int nid, int *crit, int *idx)
void *X509_REVOKED_get_ext_d2i(const X509_REVOKED *x, int nid, int *crit,
int *idx)
{
return X509V3_get_d2i(x->extensions, nid, crit, idx);
}
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/x509/x509_obj.c
Expand Up @@ -73,7 +73,7 @@

#define NAME_ONELINE_MAX (1024 * 1024)

char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len)
{
X509_NAME_ENTRY *ne;
size_t i;
Expand Down
6 changes: 3 additions & 3 deletions src/crypto/x509/x509_trs.c
Expand Up @@ -260,17 +260,17 @@ void X509_TRUST_cleanup(void)
trtable = NULL;
}

int X509_TRUST_get_flags(X509_TRUST *xp)
int X509_TRUST_get_flags(const X509_TRUST *xp)
{
return xp->flags;
}

char *X509_TRUST_get0_name(X509_TRUST *xp)
char *X509_TRUST_get0_name(const X509_TRUST *xp)
{
return xp->name;
}

int X509_TRUST_get_trust(X509_TRUST *xp)
int X509_TRUST_get_trust(const X509_TRUST *xp)
{
return xp->trust;
}
Expand Down
6 changes: 3 additions & 3 deletions src/crypto/x509/x509_v3.c
Expand Up @@ -181,7 +181,7 @@ STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x,

X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex, int nid,
int crit,
ASN1_OCTET_STRING *data)
const ASN1_OCTET_STRING *data)
{
const ASN1_OBJECT *obj;
X509_EXTENSION *ret;
Expand All @@ -197,7 +197,7 @@ X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex, int nid,

X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex,
const ASN1_OBJECT *obj, int crit,
ASN1_OCTET_STRING *data)
const ASN1_OCTET_STRING *data)
{
X509_EXTENSION *ret;

Expand Down Expand Up @@ -242,7 +242,7 @@ int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit)
return (1);
}

int X509_EXTENSION_set_data(X509_EXTENSION *ex, ASN1_OCTET_STRING *data)
int X509_EXTENSION_set_data(X509_EXTENSION *ex, const ASN1_OCTET_STRING *data)
{
int i;

Expand Down
17 changes: 9 additions & 8 deletions src/crypto/x509/x509name.c
Expand Up @@ -66,7 +66,8 @@
#include "../internal.h"


int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, char *buf, int len)
int X509_NAME_get_text_by_NID(const X509_NAME *name, int nid, char *buf,
int len)
{
const ASN1_OBJECT *obj;

Expand All @@ -76,7 +77,7 @@ int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, char *buf, int len)
return (X509_NAME_get_text_by_OBJ(name, obj, buf, len));
}

int X509_NAME_get_text_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj,
int X509_NAME_get_text_by_OBJ(const X509_NAME *name, const ASN1_OBJECT *obj,
char *buf, int len)
{
int i;
Expand All @@ -94,14 +95,14 @@ int X509_NAME_get_text_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj,
return (i);
}

int X509_NAME_entry_count(X509_NAME *name)
int X509_NAME_entry_count(const X509_NAME *name)
{
if (name == NULL)
return (0);
return (sk_X509_NAME_ENTRY_num(name->entries));
}

int X509_NAME_get_index_by_NID(X509_NAME *name, int nid, int lastpos)
int X509_NAME_get_index_by_NID(const X509_NAME *name, int nid, int lastpos)
{
const ASN1_OBJECT *obj;

Expand All @@ -112,7 +113,7 @@ int X509_NAME_get_index_by_NID(X509_NAME *name, int nid, int lastpos)
}

/* NOTE: you should be passsing -1, not 0 as lastpos */
int X509_NAME_get_index_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj,
int X509_NAME_get_index_by_OBJ(const X509_NAME *name, const ASN1_OBJECT *obj,
int lastpos)
{
int n;
Expand All @@ -133,7 +134,7 @@ int X509_NAME_get_index_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj,
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 || loc < 0
|| sk_X509_NAME_ENTRY_num(name->entries) <= (size_t)loc)
Expand Down Expand Up @@ -374,14 +375,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);
Expand Down
4 changes: 2 additions & 2 deletions src/crypto/x509v3/v3_genn.c
Expand Up @@ -188,7 +188,7 @@ void GENERAL_NAME_set0_value(GENERAL_NAME *a, int type, void *value)
a->type = type;
}

void *GENERAL_NAME_get0_value(GENERAL_NAME *a, int *ptype)
void *GENERAL_NAME_get0_value(const GENERAL_NAME *a, int *ptype)
{
if (ptype)
*ptype = a->type;
Expand Down Expand Up @@ -233,7 +233,7 @@ int GENERAL_NAME_set0_othername(GENERAL_NAME *gen,
return 1;
}

int GENERAL_NAME_get0_otherName(GENERAL_NAME *gen,
int GENERAL_NAME_get0_otherName(const GENERAL_NAME *gen,
ASN1_OBJECT **poid, ASN1_TYPE **pvalue)
{
if (gen->type != GEN_OTHERNAME)
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/x509v3/v3_info.c
Expand Up @@ -208,7 +208,7 @@ static AUTHORITY_INFO_ACCESS *v2i_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD
return NULL;
}

int i2a_ACCESS_DESCRIPTION(BIO *bp, ACCESS_DESCRIPTION *a)
int i2a_ACCESS_DESCRIPTION(BIO *bp, const ACCESS_DESCRIPTION *a)
{
i2a_ASN1_OBJECT(bp, a->method);
#ifdef UNDEF
Expand Down
8 changes: 4 additions & 4 deletions src/crypto/x509v3/v3_purp.c
Expand Up @@ -307,22 +307,22 @@ void X509_PURPOSE_cleanup(void)
xptable = NULL;
}

int X509_PURPOSE_get_id(X509_PURPOSE *xp)
int X509_PURPOSE_get_id(const X509_PURPOSE *xp)
{
return xp->purpose;
}

char *X509_PURPOSE_get0_name(X509_PURPOSE *xp)
char *X509_PURPOSE_get0_name(const X509_PURPOSE *xp)
{
return xp->name;
}

char *X509_PURPOSE_get0_sname(X509_PURPOSE *xp)
char *X509_PURPOSE_get0_sname(const X509_PURPOSE *xp)
{
return xp->sname;
}

int X509_PURPOSE_get_trust(X509_PURPOSE *xp)
int X509_PURPOSE_get_trust(const X509_PURPOSE *xp)
{
return xp->trust;
}
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/x509v3/v3_skey.c
Expand Up @@ -77,7 +77,7 @@ const X509V3_EXT_METHOD v3_skey_id = {
NULL
};

char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *oct)
char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, const ASN1_OCTET_STRING *oct)
{
return x509v3_bytes_to_hex(oct->data, oct->length);
}
Expand Down

0 comments on commit 6c5c4fb

Please sign in to comment.