diff options
Diffstat (limited to 'openssl/crypto/store')
-rw-r--r-- | openssl/crypto/store/Makefile | 18 | ||||
-rw-r--r-- | openssl/crypto/store/store.h | 9 | ||||
-rw-r--r-- | openssl/crypto/store/str_err.c | 2 | ||||
-rw-r--r-- | openssl/crypto/store/str_lib.c | 10 | ||||
-rw-r--r-- | openssl/crypto/store/str_mem.c | 56 |
5 files changed, 57 insertions, 38 deletions
diff --git a/openssl/crypto/store/Makefile b/openssl/crypto/store/Makefile index c9f5d001a..0dcfd7857 100644 --- a/openssl/crypto/store/Makefile +++ b/openssl/crypto/store/Makefile @@ -35,7 +35,7 @@ top: all: lib lib: $(LIBOBJ) - $(ARX) $(LIB) $(LIBOBJ) + $(AR) $(LIB) $(LIBOBJ) $(RANLIB) $(LIB) || echo Never mind. @touch lib @@ -89,14 +89,14 @@ str_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h str_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h str_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h str_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h -str_lib.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h -str_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h -str_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h -str_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h -str_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -str_lib.o: ../../include/openssl/stack.h ../../include/openssl/store.h -str_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h -str_lib.o: ../../include/openssl/x509_vfy.h str_lib.c str_locl.h +str_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h +str_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +str_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h +str_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h +str_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +str_lib.o: ../../include/openssl/store.h ../../include/openssl/symhacks.h +str_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +str_lib.o: str_lib.c str_locl.h str_mem.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h str_mem.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h str_mem.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h diff --git a/openssl/crypto/store/store.h b/openssl/crypto/store/store.h index 64583377a..0a28c7d5a 100644 --- a/openssl/crypto/store/store.h +++ b/openssl/crypto/store/store.h @@ -59,6 +59,12 @@ #ifndef HEADER_STORE_H #define HEADER_STORE_H +#include <openssl/opensslconf.h> + +#ifdef OPENSSL_NO_STORE +#error STORE is disabled. +#endif + #include <openssl/ossl_typ.h> #ifndef OPENSSL_NO_DEPRECATED #include <openssl/evp.h> @@ -408,7 +414,8 @@ int STORE_ATTR_INFO_modify_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, /* Compare on basis of a bit pattern formed by the STORE_ATTR_TYPES values in each contained attribute. */ -int STORE_ATTR_INFO_compare(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b); +int STORE_ATTR_INFO_compare(const STORE_ATTR_INFO * const *a, + const STORE_ATTR_INFO * const *b); /* Check if the set of attributes in a is within the range of attributes set in b. */ int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b); diff --git a/openssl/crypto/store/str_err.c b/openssl/crypto/store/str_err.c index 6fee64982..924edf050 100644 --- a/openssl/crypto/store/str_err.c +++ b/openssl/crypto/store/str_err.c @@ -1,6 +1,6 @@ /* crypto/store/str_err.c */ /* ==================================================================== - * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. + * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/openssl/crypto/store/str_lib.c b/openssl/crypto/store/str_lib.c index 32ae5bd39..f1dbcbd0e 100644 --- a/openssl/crypto/store/str_lib.c +++ b/openssl/crypto/store/str_lib.c @@ -1670,7 +1670,7 @@ int STORE_parse_attrs_endp(void *handle) } static int attr_info_compare_compute_range( - unsigned char *abits, unsigned char *bbits, + const unsigned char *abits, const unsigned char *bbits, unsigned int *alowp, unsigned int *ahighp, unsigned int *blowp, unsigned int *bhighp) { @@ -1739,13 +1739,15 @@ static int attr_info_compare_compute_range( return res; } -int STORE_ATTR_INFO_compare(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) +int STORE_ATTR_INFO_compare(const STORE_ATTR_INFO * const *a, + const STORE_ATTR_INFO * const *b) { if (a == b) return 0; if (!a) return -1; if (!b) return 1; - return attr_info_compare_compute_range(a->set, b->set, 0, 0, 0, 0); + return attr_info_compare_compute_range((*a)->set, (*b)->set, 0, 0, 0, 0); } + int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) { unsigned int alow, ahigh, blow, bhigh; @@ -1759,6 +1761,7 @@ int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) return 1; return 0; } + int STORE_ATTR_INFO_in(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) { unsigned char *abits, *bbits; @@ -1776,6 +1779,7 @@ int STORE_ATTR_INFO_in(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) } return 1; } + int STORE_ATTR_INFO_in_ex(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) { STORE_ATTR_TYPES i; diff --git a/openssl/crypto/store/str_mem.c b/openssl/crypto/store/str_mem.c index 527757ae0..8ac4f7e55 100644 --- a/openssl/crypto/store/str_mem.c +++ b/openssl/crypto/store/str_mem.c @@ -76,30 +76,35 @@ attribute type code). */ -struct mem_object_data_st +typedef struct mem_object_data_st { STORE_OBJECT *object; STORE_ATTR_INFO *attr_info; int references; - }; + } MEM_OBJECT_DATA; +DECLARE_STACK_OF(MEM_OBJECT_DATA) struct mem_data_st { - STACK *data; /* A stack of mem_object_data_st, - sorted with STORE_ATTR_INFO_compare(). */ + STACK_OF(MEM_OBJECT_DATA) *data; /* sorted with + * STORE_ATTR_INFO_compare(). */ unsigned int compute_components : 1; /* Currently unused, but can be used to add attributes from parts of the data. */ }; +DECLARE_STACK_OF(STORE_ATTR_INFO) struct mem_ctx_st { int type; /* The type we're searching for */ - STACK *search_attributes; /* Sets of attributes to search for. - Each element is a STORE_ATTR_INFO. */ - int search_index; /* which of the search attributes we found a match - for, -1 when we still haven't found any */ - int index; /* -1 as long as we're searching for the first */ + STACK_OF(STORE_ATTR_INFO) *search_attributes; /* Sets of + attributes to search for. Each + element is a STORE_ATTR_INFO. */ + int search_index; /* which of the search attributes we + found a match for, -1 when we still + haven't found any */ + int index; /* -1 as long as we're searching for + the first */ }; static int mem_init(STORE *s); @@ -240,7 +245,7 @@ static void *mem_list_start(STORE *s, STORE_OBJECT_TYPES type, if (context->search_attributes == NULL) { context->search_attributes = - sk_new((int (*)(const char * const *, const char * const *))STORE_ATTR_INFO_compare); + sk_STORE_ATTR_INFO_new(STORE_ATTR_INFO_compare); if (!context->search_attributes) { STOREerr(STORE_F_MEM_LIST_START, @@ -248,7 +253,7 @@ static void *mem_list_start(STORE *s, STORE_OBJECT_TYPES type, goto err; } } - sk_push(context->search_attributes,(char *)attrs); + sk_STORE_ATTR_INFO_push(context->search_attributes,attrs); } if (!STORE_parse_attrs_endp(attribute_context)) goto err; @@ -284,11 +289,14 @@ static STORE_OBJECT *mem_list_next(STORE *s, void *handle) if (context->search_index == -1) { - for (i = 0; i < sk_num(context->search_attributes); i++) + for (i = 0; + i < sk_STORE_ATTR_INFO_num(context->search_attributes); + i++) { - key.attr_info = - (STORE_ATTR_INFO *)sk_value(context->search_attributes, i); - srch = sk_find_ex(store->data, (char *)&key); + key.attr_info + = sk_STORE_ATTR_INFO_value(context->search_attributes, + i); + srch = sk_MEM_OBJECT_DATA_find_ex(store->data, &key); if (srch >= 0) { @@ -301,21 +309,20 @@ static STORE_OBJECT *mem_list_next(STORE *s, void *handle) return NULL; key.attr_info = - (STORE_ATTR_INFO *)sk_value(context->search_attributes, - context->search_index); + sk_STORE_ATTR_INFO_value(context->search_attributes, + context->search_index); for(srch = context->search_index; - srch < sk_num(store->data) + srch < sk_MEM_OBJECT_DATA_num(store->data) && STORE_ATTR_INFO_in_range(key.attr_info, - (STORE_ATTR_INFO *)sk_value(store->data, srch)) + sk_MEM_OBJECT_DATA_value(store->data, srch)->attr_info) && !(cres = STORE_ATTR_INFO_in_ex(key.attr_info, - (STORE_ATTR_INFO *)sk_value(store->data, srch))); + sk_MEM_OBJECT_DATA_value(store->data, srch)->attr_info)); srch++) ; context->search_index = srch; if (cres) - return ((struct mem_object_data_st *)sk_value(store->data, - srch))->object; + return (sk_MEM_OBJECT_DATA_value(store->data, srch))->object; return NULL; } static int mem_list_end(STORE *s, void *handle) @@ -328,7 +335,7 @@ static int mem_list_end(STORE *s, void *handle) return 0; } if (context && context->search_attributes) - sk_free(context->search_attributes); + sk_STORE_ATTR_INFO_free(context->search_attributes); if (context) OPENSSL_free(context); return 1; } @@ -337,7 +344,8 @@ static int mem_list_endp(STORE *s, void *handle) struct mem_ctx_st *context = (struct mem_ctx_st *)handle; if (!context - || context->search_index == sk_num(context->search_attributes)) + || context->search_index + == sk_STORE_ATTR_INFO_num(context->search_attributes)) return 1; return 0; } |