diff options
Diffstat (limited to 'crypto/objects')
| -rw-r--r-- | crypto/objects/o_names.c | 44 | ||||
| -rw-r--r-- | crypto/objects/obj_compat.h | 62 | ||||
| -rw-r--r-- | crypto/objects/obj_dat.c | 38 | ||||
| -rw-r--r-- | crypto/objects/obj_dat.h | 2 | ||||
| -rw-r--r-- | crypto/objects/obj_err.c | 10 | ||||
| -rw-r--r-- | crypto/objects/obj_lib.c | 6 |
6 files changed, 79 insertions, 83 deletions
diff --git a/crypto/objects/o_names.c b/crypto/objects/o_names.c index 791f2b011e35..372d7c65d51f 100644 --- a/crypto/objects/o_names.c +++ b/crypto/objects/o_names.c @@ -30,9 +30,9 @@ static int names_type_num = OBJ_NAME_TYPE_NUM; static CRYPTO_RWLOCK *obj_lock = NULL; struct name_funcs_st { - unsigned long (*hash_func) (const char *name); - int (*cmp_func) (const char *a, const char *b); - void (*free_func) (const char *, int, const char *); + unsigned long (*hash_func)(const char *name); + int (*cmp_func)(const char *a, const char *b); + void (*free_func)(const char *, int, const char *); }; static STACK_OF(NAME_FUNCS) *name_funcs_stack; @@ -65,9 +65,9 @@ int OBJ_NAME_init(void) return RUN_ONCE(&init, o_names_init); } -int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *), - int (*cmp_func) (const char *, const char *), - void (*free_func) (const char *, int, const char *)) +int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *), + int (*cmp_func)(const char *, const char *), + void (*free_func)(const char *, int, const char *)) { int ret = 0, i, push; NAME_FUNCS *name_funcs; @@ -126,7 +126,8 @@ static int obj_name_cmp(const OBJ_NAME *a, const OBJ_NAME *b) if ((name_funcs_stack != NULL) && (sk_NAME_FUNCS_num(name_funcs_stack) > a->type)) { ret = sk_NAME_FUNCS_value(name_funcs_stack, - a->type)->cmp_func(a->name, b->name); + a->type) + ->cmp_func(a->name, b->name); } else ret = OPENSSL_strcasecmp(a->name, b->name); } @@ -139,9 +140,9 @@ static unsigned long obj_name_hash(const OBJ_NAME *a) if ((name_funcs_stack != NULL) && (sk_NAME_FUNCS_num(name_funcs_stack) > a->type)) { - ret = - sk_NAME_FUNCS_value(name_funcs_stack, - a->type)->hash_func(a->name); + ret = sk_NAME_FUNCS_value(name_funcs_stack, + a->type) + ->hash_func(a->name); } else { ret = ossl_lh_strcasehash(a->name); } @@ -221,8 +222,9 @@ int OBJ_NAME_add(const char *name, int type, const char *data) * get three arguments... -- Richard Levitte */ sk_NAME_FUNCS_value(name_funcs_stack, - ret->type)->free_func(ret->name, ret->type, - ret->data); + ret->type) + ->free_func(ret->name, ret->type, + ret->data); } OPENSSL_free(ret); } else { @@ -264,8 +266,9 @@ int OBJ_NAME_remove(const char *name, int type) * get three arguments... -- Richard Levitte */ sk_NAME_FUNCS_value(name_funcs_stack, - ret->type)->free_func(ret->name, ret->type, - ret->data); + ret->type) + ->free_func(ret->name, ret->type, + ret->data); } OPENSSL_free(ret); ok = 1; @@ -277,7 +280,7 @@ int OBJ_NAME_remove(const char *name, int type) typedef struct { int type; - void (*fn) (const OBJ_NAME *, void *arg); + void (*fn)(const OBJ_NAME *, void *arg); void *arg; } OBJ_DOALL; @@ -289,8 +292,8 @@ static void do_all_fn(const OBJ_NAME *name, OBJ_DOALL *d) IMPLEMENT_LHASH_DOALL_ARG_CONST(OBJ_NAME, OBJ_DOALL); -void OBJ_NAME_do_all(int type, void (*fn) (const OBJ_NAME *, void *arg), - void *arg) +void OBJ_NAME_do_all(int type, void (*fn)(const OBJ_NAME *, void *arg), + void *arg) { OBJ_DOALL d; @@ -326,15 +329,14 @@ static int do_all_sorted_cmp(const void *n1_, const void *n2_) } void OBJ_NAME_do_all_sorted(int type, - void (*fn) (const OBJ_NAME *, void *arg), - void *arg) + void (*fn)(const OBJ_NAME *, void *arg), + void *arg) { struct doall_sorted d; int n; d.type = type; - d.names = - OPENSSL_malloc(sizeof(*d.names) * lh_OBJ_NAME_num_items(names_lh)); + d.names = OPENSSL_malloc(sizeof(*d.names) * lh_OBJ_NAME_num_items(names_lh)); /* Really should return an error if !d.names...but its a void function! */ if (d.names != NULL) { d.n = 0; diff --git a/crypto/objects/obj_compat.h b/crypto/objects/obj_compat.h index 7d890d1c0b85..76390cf2a95a 100644 --- a/crypto/objects/obj_compat.h +++ b/crypto/objects/obj_compat.h @@ -9,46 +9,46 @@ #ifndef OPENSSL_NO_DEPRECATED_3_0 -#define SN_id_tc26_cipher_gostr3412_2015_magma_ctracpkm SN_magma_ctr_acpkm -#define NID_id_tc26_cipher_gostr3412_2015_magma_ctracpkm NID_magma_ctr_acpkm -#define OBJ_id_tc26_cipher_gostr3412_2015_magma_ctracpkm OBJ_magma_ctr_acpkm +#define SN_id_tc26_cipher_gostr3412_2015_magma_ctracpkm SN_magma_ctr_acpkm +#define NID_id_tc26_cipher_gostr3412_2015_magma_ctracpkm NID_magma_ctr_acpkm +#define OBJ_id_tc26_cipher_gostr3412_2015_magma_ctracpkm OBJ_magma_ctr_acpkm -#define SN_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac SN_magma_ctr_acpkm_omac -#define NID_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac NID_magma_ctr_acpkm_omac -#define OBJ_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac OBJ_magma_ctr_acpkm_omac +#define SN_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac SN_magma_ctr_acpkm_omac +#define NID_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac NID_magma_ctr_acpkm_omac +#define OBJ_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac OBJ_magma_ctr_acpkm_omac -#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm SN_kuznyechik_ctr_acpkm -#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm NID_kuznyechik_ctr_acpkm -#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm OBJ_kuznyechik_ctr_acpkm +#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm SN_kuznyechik_ctr_acpkm +#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm NID_kuznyechik_ctr_acpkm +#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm OBJ_kuznyechik_ctr_acpkm -#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac SN_kuznyechik_ctr_acpkm_omac -#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac NID_kuznyechik_ctr_acpkm_omac -#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac OBJ_kuznyechik_ctr_acpkm_omac +#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac SN_kuznyechik_ctr_acpkm_omac +#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac NID_kuznyechik_ctr_acpkm_omac +#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac OBJ_kuznyechik_ctr_acpkm_omac -#define SN_id_tc26_wrap_gostr3412_2015_magma_kexp15 SN_magma_kexp15 -#define NID_id_tc26_wrap_gostr3412_2015_magma_kexp15 NID_magma_kexp15 -#define OBJ_id_tc26_wrap_gostr3412_2015_magma_kexp15 OBJ_magma_kexp15 +#define SN_id_tc26_wrap_gostr3412_2015_magma_kexp15 SN_magma_kexp15 +#define NID_id_tc26_wrap_gostr3412_2015_magma_kexp15 NID_magma_kexp15 +#define OBJ_id_tc26_wrap_gostr3412_2015_magma_kexp15 OBJ_magma_kexp15 -#define SN_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 SN_kuznyechik_kexp15 -#define NID_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 NID_kuznyechik_kexp15 -#define OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 OBJ_kuznyechik_kexp15 +#define SN_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 SN_kuznyechik_kexp15 +#define NID_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 NID_kuznyechik_kexp15 +#define OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 OBJ_kuznyechik_kexp15 -#define SN_grasshopper_ecb SN_kuznyechik_ecb -#define NID_grasshopper_ecb NID_kuznyechik_ecb +#define SN_grasshopper_ecb SN_kuznyechik_ecb +#define NID_grasshopper_ecb NID_kuznyechik_ecb -#define SN_grasshopper_ctr SN_kuznyechik_ctr -#define NID_grasshopper_ctr NID_kuznyechik_ctr +#define SN_grasshopper_ctr SN_kuznyechik_ctr +#define NID_grasshopper_ctr NID_kuznyechik_ctr -#define SN_grasshopper_ofb SN_kuznyechik_ofb -#define NID_grasshopper_ofb NID_kuznyechik_ofb +#define SN_grasshopper_ofb SN_kuznyechik_ofb +#define NID_grasshopper_ofb NID_kuznyechik_ofb -#define SN_grasshopper_cbc SN_kuznyechik_cbc -#define NID_grasshopper_cbc NID_kuznyechik_cbc +#define SN_grasshopper_cbc SN_kuznyechik_cbc +#define NID_grasshopper_cbc NID_kuznyechik_cbc -#define SN_grasshopper_cfb SN_kuznyechik_cfb -#define NID_grasshopper_cfb NID_kuznyechik_cfb +#define SN_grasshopper_cfb SN_kuznyechik_cfb +#define NID_grasshopper_cfb NID_kuznyechik_cfb -#define SN_grasshopper_mac SN_kuznyechik_mac -#define NID_grasshopper_mac NID_kuznyechik_mac +#define SN_grasshopper_mac SN_kuznyechik_mac +#define NID_grasshopper_mac NID_kuznyechik_mac -#endif /* OPENSSL_NO_DEPRECATED_3_0 */ +#endif /* OPENSSL_NO_DEPRECATED_3_0 */ diff --git a/crypto/objects/obj_dat.c b/crypto/objects/obj_dat.c index dc501cbb8b22..f74f932b68d0 100644 --- a/crypto/objects/obj_dat.c +++ b/crypto/objects/obj_dat.c @@ -25,10 +25,10 @@ DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, sn); DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, ln); DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj); -#define ADDED_DATA 0 -#define ADDED_SNAME 1 -#define ADDED_LNAME 2 -#define ADDED_NID 3 +#define ADDED_DATA 0 +#define ADDED_SNAME 1 +#define ADDED_LNAME 2 +#define ADDED_NID 3 struct added_obj_st { int type; @@ -134,8 +134,7 @@ static int init_added(void) static void cleanup1_doall(ADDED_OBJ *a) { a->obj->nid = 0; - a->obj->flags |= ASN1_OBJECT_FLAG_DYNAMIC | - ASN1_OBJECT_FLAG_DYNAMIC_STRINGS | ASN1_OBJECT_FLAG_DYNAMIC_DATA; + a->obj->flags |= ASN1_OBJECT_FLAG_DYNAMIC | ASN1_OBJECT_FLAG_DYNAMIC_STRINGS | ASN1_OBJECT_FLAG_DYNAMIC_DATA; } static void cleanup2_doall(ADDED_OBJ *a) @@ -203,14 +202,12 @@ int OBJ_add_object(const ASN1_OBJECT *obj) OPENSSL_free(aop); } } - o->flags &= - ~(ASN1_OBJECT_FLAG_DYNAMIC | ASN1_OBJECT_FLAG_DYNAMIC_STRINGS | - ASN1_OBJECT_FLAG_DYNAMIC_DATA); + o->flags &= ~(ASN1_OBJECT_FLAG_DYNAMIC | ASN1_OBJECT_FLAG_DYNAMIC_STRINGS | ASN1_OBJECT_FLAG_DYNAMIC_DATA); return o->nid; - err2: +err2: ERR_raise(ERR_LIB_OBJ, ERR_R_MALLOC_FAILURE); - err: +err: for (i = ADDED_DATA; i <= ADDED_NID; i++) OPENSSL_free(ao[i]); ASN1_OBJECT_free(o); @@ -369,8 +366,7 @@ ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name) int i, j; if (!no_name) { - if (((nid = OBJ_sn2nid(s)) != NID_undef) || - ((nid = OBJ_ln2nid(s)) != NID_undef)) + if (((nid = OBJ_sn2nid(s)) != NID_undef) || ((nid = OBJ_ln2nid(s)) != NID_undef)) return OBJ_nid2obj(nid); if (!ossl_isdigit(*s)) { ERR_raise(ERR_LIB_OBJ, OBJ_R_UNKNOWN_OBJECT_NAME); @@ -557,7 +553,7 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) BN_free(bl); return n; - err: +err: BN_free(bl); return -1; } @@ -621,15 +617,15 @@ int OBJ_sn2nid(const char *s) } const void *OBJ_bsearch_(const void *key, const void *base, int num, int size, - int (*cmp) (const void *, const void *)) + int (*cmp)(const void *, const void *)) { return OBJ_bsearch_ex_(key, base, num, size, cmp, 0); } const void *OBJ_bsearch_ex_(const void *key, const void *base, int num, - int size, - int (*cmp) (const void *, const void *), - int flags) + int size, + int (*cmp)(const void *, const void *), + int flags) { const char *p = ossl_bsearch(key, base, num, size, cmp, flags); @@ -646,7 +642,7 @@ const void *OBJ_bsearch_ex_(const void *key, const void *base, int num, for (i = 0; i < num; ++i) { p1 = &(base_[i * size]); - c = (*cmp) (key, p1); + c = (*cmp)(key, p1); if (c == 0 || (c < 0 && (flags & OBJ_BSEARCH_VALUE_ON_NOMATCH))) return p1; @@ -716,7 +712,7 @@ int OBJ_create(const char *oid, const char *sn, const char *ln) /* Check to see if short or long name already present */ if ((sn != NULL && OBJ_sn2nid(sn) != NID_undef) - || (ln != NULL && OBJ_ln2nid(ln) != NID_undef)) { + || (ln != NULL && OBJ_ln2nid(ln) != NID_undef)) { ERR_raise(ERR_LIB_OBJ, OBJ_R_OID_EXISTS); return 0; } @@ -744,7 +740,7 @@ int OBJ_create(const char *oid, const char *sn, const char *ln) tmpoid->sn = NULL; tmpoid->ln = NULL; - err: +err: ASN1_OBJECT_free(tmpoid); return ok; } diff --git a/crypto/objects/obj_dat.h b/crypto/objects/obj_dat.h index 59d156117a00..0c5ead063d63 100644 --- a/crypto/objects/obj_dat.h +++ b/crypto/objects/obj_dat.h @@ -2,7 +2,7 @@ * WARNING: do not edit! * Generated by crypto/objects/obj_dat.pl * - * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved. * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at diff --git a/crypto/objects/obj_err.c b/crypto/objects/obj_err.c index b4c8df09e66b..c3c547803425 100644 --- a/crypto/objects/obj_err.c +++ b/crypto/objects/obj_err.c @@ -15,11 +15,11 @@ #ifndef OPENSSL_NO_ERR static const ERR_STRING_DATA OBJ_str_reasons[] = { - {ERR_PACK(ERR_LIB_OBJ, 0, OBJ_R_OID_EXISTS), "oid exists"}, - {ERR_PACK(ERR_LIB_OBJ, 0, OBJ_R_UNKNOWN_NID), "unknown nid"}, - {ERR_PACK(ERR_LIB_OBJ, 0, OBJ_R_UNKNOWN_OBJECT_NAME), - "unknown object name"}, - {0, NULL} + { ERR_PACK(ERR_LIB_OBJ, 0, OBJ_R_OID_EXISTS), "oid exists" }, + { ERR_PACK(ERR_LIB_OBJ, 0, OBJ_R_UNKNOWN_NID), "unknown nid" }, + { ERR_PACK(ERR_LIB_OBJ, 0, OBJ_R_UNKNOWN_OBJECT_NAME), + "unknown object name" }, + { 0, NULL } }; #endif diff --git a/crypto/objects/obj_lib.c b/crypto/objects/obj_lib.c index 72c0c2c81dd9..0905cfdcbc7e 100644 --- a/crypto/objects/obj_lib.c +++ b/crypto/objects/obj_lib.c @@ -31,9 +31,7 @@ ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o) /* Set dynamic flags so everything gets freed up on error */ - r->flags = o->flags | (ASN1_OBJECT_FLAG_DYNAMIC | - ASN1_OBJECT_FLAG_DYNAMIC_STRINGS | - ASN1_OBJECT_FLAG_DYNAMIC_DATA); + r->flags = o->flags | (ASN1_OBJECT_FLAG_DYNAMIC | ASN1_OBJECT_FLAG_DYNAMIC_STRINGS | ASN1_OBJECT_FLAG_DYNAMIC_DATA); if (o->length > 0 && (r->data = OPENSSL_memdup(o->data, o->length)) == NULL) goto err; @@ -48,7 +46,7 @@ ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o) goto err; return r; - err: +err: ASN1_OBJECT_free(r); ERR_raise(ERR_LIB_OBJ, ERR_R_MALLOC_FAILURE); return NULL; |
