diff options
| author | djm <> | 2010-10-01 22:54:19 +0000 |
|---|---|---|
| committer | djm <> | 2010-10-01 22:54:19 +0000 |
| commit | 5bf424abe3e333358a0476841d2085fb5870dde9 (patch) | |
| tree | 03b202b49e2c6367ae5dec12d939ea99c9ca36b3 /src/lib/libcrypto/store | |
| parent | 31f27c0675424c286ead39df16455abf64c6fb22 (diff) | |
| parent | 2dd8058114e20f1cd7c897166a4ce75ed390ee54 (diff) | |
| download | openbsd-5bf424abe3e333358a0476841d2085fb5870dde9.tar.gz openbsd-5bf424abe3e333358a0476841d2085fb5870dde9.tar.bz2 openbsd-5bf424abe3e333358a0476841d2085fb5870dde9.zip | |
This commit was generated by cvs2git to track changes on a CVS vendor
branch.
Diffstat (limited to 'src/lib/libcrypto/store')
| -rw-r--r-- | src/lib/libcrypto/store/Makefile | 18 | ||||
| -rw-r--r-- | src/lib/libcrypto/store/store.h | 9 | ||||
| -rw-r--r-- | src/lib/libcrypto/store/str_err.c | 2 | ||||
| -rw-r--r-- | src/lib/libcrypto/store/str_lib.c | 10 | ||||
| -rw-r--r-- | src/lib/libcrypto/store/str_mem.c | 56 |
5 files changed, 57 insertions, 38 deletions
diff --git a/src/lib/libcrypto/store/Makefile b/src/lib/libcrypto/store/Makefile index c9f5d001a3..0dcfd7857a 100644 --- a/src/lib/libcrypto/store/Makefile +++ b/src/lib/libcrypto/store/Makefile | |||
| @@ -35,7 +35,7 @@ top: | |||
| 35 | all: lib | 35 | all: lib |
| 36 | 36 | ||
| 37 | lib: $(LIBOBJ) | 37 | lib: $(LIBOBJ) |
| 38 | $(ARX) $(LIB) $(LIBOBJ) | 38 | $(AR) $(LIB) $(LIBOBJ) |
| 39 | $(RANLIB) $(LIB) || echo Never mind. | 39 | $(RANLIB) $(LIB) || echo Never mind. |
| 40 | @touch lib | 40 | @touch lib |
| 41 | 41 | ||
| @@ -89,14 +89,14 @@ str_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | |||
| 89 | str_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 89 | str_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 90 | str_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | 90 | str_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h |
| 91 | str_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 91 | str_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 92 | str_lib.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 92 | str_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 93 | str_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 93 | str_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 94 | str_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 94 | str_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 95 | str_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 95 | str_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 96 | str_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 96 | str_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 97 | str_lib.o: ../../include/openssl/stack.h ../../include/openssl/store.h | 97 | str_lib.o: ../../include/openssl/store.h ../../include/openssl/symhacks.h |
| 98 | str_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 98 | str_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 99 | str_lib.o: ../../include/openssl/x509_vfy.h str_lib.c str_locl.h | 99 | str_lib.o: str_lib.c str_locl.h |
| 100 | str_mem.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | 100 | str_mem.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h |
| 101 | str_mem.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 101 | str_mem.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 102 | str_mem.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | 102 | str_mem.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h |
diff --git a/src/lib/libcrypto/store/store.h b/src/lib/libcrypto/store/store.h index 64583377a9..0a28c7d5a2 100644 --- a/src/lib/libcrypto/store/store.h +++ b/src/lib/libcrypto/store/store.h | |||
| @@ -59,6 +59,12 @@ | |||
| 59 | #ifndef HEADER_STORE_H | 59 | #ifndef HEADER_STORE_H |
| 60 | #define HEADER_STORE_H | 60 | #define HEADER_STORE_H |
| 61 | 61 | ||
| 62 | #include <openssl/opensslconf.h> | ||
| 63 | |||
| 64 | #ifdef OPENSSL_NO_STORE | ||
| 65 | #error STORE is disabled. | ||
| 66 | #endif | ||
| 67 | |||
| 62 | #include <openssl/ossl_typ.h> | 68 | #include <openssl/ossl_typ.h> |
| 63 | #ifndef OPENSSL_NO_DEPRECATED | 69 | #ifndef OPENSSL_NO_DEPRECATED |
| 64 | #include <openssl/evp.h> | 70 | #include <openssl/evp.h> |
| @@ -408,7 +414,8 @@ int STORE_ATTR_INFO_modify_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, | |||
| 408 | 414 | ||
| 409 | /* Compare on basis of a bit pattern formed by the STORE_ATTR_TYPES values | 415 | /* Compare on basis of a bit pattern formed by the STORE_ATTR_TYPES values |
| 410 | in each contained attribute. */ | 416 | in each contained attribute. */ |
| 411 | int STORE_ATTR_INFO_compare(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b); | 417 | int STORE_ATTR_INFO_compare(const STORE_ATTR_INFO * const *a, |
| 418 | const STORE_ATTR_INFO * const *b); | ||
| 412 | /* Check if the set of attributes in a is within the range of attributes | 419 | /* Check if the set of attributes in a is within the range of attributes |
| 413 | set in b. */ | 420 | set in b. */ |
| 414 | int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b); | 421 | int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b); |
diff --git a/src/lib/libcrypto/store/str_err.c b/src/lib/libcrypto/store/str_err.c index 6fee649822..924edf0505 100644 --- a/src/lib/libcrypto/store/str_err.c +++ b/src/lib/libcrypto/store/str_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/store/str_err.c */ | 1 | /* crypto/store/str_err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
diff --git a/src/lib/libcrypto/store/str_lib.c b/src/lib/libcrypto/store/str_lib.c index 32ae5bd395..f1dbcbd0e0 100644 --- a/src/lib/libcrypto/store/str_lib.c +++ b/src/lib/libcrypto/store/str_lib.c | |||
| @@ -1670,7 +1670,7 @@ int STORE_parse_attrs_endp(void *handle) | |||
| 1670 | } | 1670 | } |
| 1671 | 1671 | ||
| 1672 | static int attr_info_compare_compute_range( | 1672 | static int attr_info_compare_compute_range( |
| 1673 | unsigned char *abits, unsigned char *bbits, | 1673 | const unsigned char *abits, const unsigned char *bbits, |
| 1674 | unsigned int *alowp, unsigned int *ahighp, | 1674 | unsigned int *alowp, unsigned int *ahighp, |
| 1675 | unsigned int *blowp, unsigned int *bhighp) | 1675 | unsigned int *blowp, unsigned int *bhighp) |
| 1676 | { | 1676 | { |
| @@ -1739,13 +1739,15 @@ static int attr_info_compare_compute_range( | |||
| 1739 | return res; | 1739 | return res; |
| 1740 | } | 1740 | } |
| 1741 | 1741 | ||
| 1742 | int STORE_ATTR_INFO_compare(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) | 1742 | int STORE_ATTR_INFO_compare(const STORE_ATTR_INFO * const *a, |
| 1743 | const STORE_ATTR_INFO * const *b) | ||
| 1743 | { | 1744 | { |
| 1744 | if (a == b) return 0; | 1745 | if (a == b) return 0; |
| 1745 | if (!a) return -1; | 1746 | if (!a) return -1; |
| 1746 | if (!b) return 1; | 1747 | if (!b) return 1; |
| 1747 | return attr_info_compare_compute_range(a->set, b->set, 0, 0, 0, 0); | 1748 | return attr_info_compare_compute_range((*a)->set, (*b)->set, 0, 0, 0, 0); |
| 1748 | } | 1749 | } |
| 1750 | |||
| 1749 | int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) | 1751 | int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) |
| 1750 | { | 1752 | { |
| 1751 | unsigned int alow, ahigh, blow, bhigh; | 1753 | unsigned int alow, ahigh, blow, bhigh; |
| @@ -1759,6 +1761,7 @@ int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) | |||
| 1759 | return 1; | 1761 | return 1; |
| 1760 | return 0; | 1762 | return 0; |
| 1761 | } | 1763 | } |
| 1764 | |||
| 1762 | int STORE_ATTR_INFO_in(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) | 1765 | int STORE_ATTR_INFO_in(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) |
| 1763 | { | 1766 | { |
| 1764 | unsigned char *abits, *bbits; | 1767 | unsigned char *abits, *bbits; |
| @@ -1776,6 +1779,7 @@ int STORE_ATTR_INFO_in(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) | |||
| 1776 | } | 1779 | } |
| 1777 | return 1; | 1780 | return 1; |
| 1778 | } | 1781 | } |
| 1782 | |||
| 1779 | int STORE_ATTR_INFO_in_ex(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) | 1783 | int STORE_ATTR_INFO_in_ex(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) |
| 1780 | { | 1784 | { |
| 1781 | STORE_ATTR_TYPES i; | 1785 | STORE_ATTR_TYPES i; |
diff --git a/src/lib/libcrypto/store/str_mem.c b/src/lib/libcrypto/store/str_mem.c index 527757ae09..8ac4f7e55c 100644 --- a/src/lib/libcrypto/store/str_mem.c +++ b/src/lib/libcrypto/store/str_mem.c | |||
| @@ -76,30 +76,35 @@ | |||
| 76 | attribute type code). | 76 | attribute type code). |
| 77 | */ | 77 | */ |
| 78 | 78 | ||
| 79 | struct mem_object_data_st | 79 | typedef struct mem_object_data_st |
| 80 | { | 80 | { |
| 81 | STORE_OBJECT *object; | 81 | STORE_OBJECT *object; |
| 82 | STORE_ATTR_INFO *attr_info; | 82 | STORE_ATTR_INFO *attr_info; |
| 83 | int references; | 83 | int references; |
| 84 | }; | 84 | } MEM_OBJECT_DATA; |
| 85 | 85 | ||
| 86 | DECLARE_STACK_OF(MEM_OBJECT_DATA) | ||
| 86 | struct mem_data_st | 87 | struct mem_data_st |
| 87 | { | 88 | { |
| 88 | STACK *data; /* A stack of mem_object_data_st, | 89 | STACK_OF(MEM_OBJECT_DATA) *data; /* sorted with |
| 89 | sorted with STORE_ATTR_INFO_compare(). */ | 90 | * STORE_ATTR_INFO_compare(). */ |
| 90 | unsigned int compute_components : 1; /* Currently unused, but can | 91 | unsigned int compute_components : 1; /* Currently unused, but can |
| 91 | be used to add attributes | 92 | be used to add attributes |
| 92 | from parts of the data. */ | 93 | from parts of the data. */ |
| 93 | }; | 94 | }; |
| 94 | 95 | ||
| 96 | DECLARE_STACK_OF(STORE_ATTR_INFO) | ||
| 95 | struct mem_ctx_st | 97 | struct mem_ctx_st |
| 96 | { | 98 | { |
| 97 | int type; /* The type we're searching for */ | 99 | int type; /* The type we're searching for */ |
| 98 | STACK *search_attributes; /* Sets of attributes to search for. | 100 | STACK_OF(STORE_ATTR_INFO) *search_attributes; /* Sets of |
| 99 | Each element is a STORE_ATTR_INFO. */ | 101 | attributes to search for. Each |
| 100 | int search_index; /* which of the search attributes we found a match | 102 | element is a STORE_ATTR_INFO. */ |
| 101 | for, -1 when we still haven't found any */ | 103 | int search_index; /* which of the search attributes we |
| 102 | int index; /* -1 as long as we're searching for the first */ | 104 | found a match for, -1 when we still |
| 105 | haven't found any */ | ||
| 106 | int index; /* -1 as long as we're searching for | ||
| 107 | the first */ | ||
| 103 | }; | 108 | }; |
| 104 | 109 | ||
| 105 | static int mem_init(STORE *s); | 110 | static int mem_init(STORE *s); |
| @@ -240,7 +245,7 @@ static void *mem_list_start(STORE *s, STORE_OBJECT_TYPES type, | |||
| 240 | if (context->search_attributes == NULL) | 245 | if (context->search_attributes == NULL) |
| 241 | { | 246 | { |
| 242 | context->search_attributes = | 247 | context->search_attributes = |
| 243 | sk_new((int (*)(const char * const *, const char * const *))STORE_ATTR_INFO_compare); | 248 | sk_STORE_ATTR_INFO_new(STORE_ATTR_INFO_compare); |
| 244 | if (!context->search_attributes) | 249 | if (!context->search_attributes) |
| 245 | { | 250 | { |
| 246 | STOREerr(STORE_F_MEM_LIST_START, | 251 | STOREerr(STORE_F_MEM_LIST_START, |
| @@ -248,7 +253,7 @@ static void *mem_list_start(STORE *s, STORE_OBJECT_TYPES type, | |||
| 248 | goto err; | 253 | goto err; |
| 249 | } | 254 | } |
| 250 | } | 255 | } |
| 251 | sk_push(context->search_attributes,(char *)attrs); | 256 | sk_STORE_ATTR_INFO_push(context->search_attributes,attrs); |
| 252 | } | 257 | } |
| 253 | if (!STORE_parse_attrs_endp(attribute_context)) | 258 | if (!STORE_parse_attrs_endp(attribute_context)) |
| 254 | goto err; | 259 | goto err; |
| @@ -284,11 +289,14 @@ static STORE_OBJECT *mem_list_next(STORE *s, void *handle) | |||
| 284 | 289 | ||
| 285 | if (context->search_index == -1) | 290 | if (context->search_index == -1) |
| 286 | { | 291 | { |
| 287 | for (i = 0; i < sk_num(context->search_attributes); i++) | 292 | for (i = 0; |
| 293 | i < sk_STORE_ATTR_INFO_num(context->search_attributes); | ||
| 294 | i++) | ||
| 288 | { | 295 | { |
| 289 | key.attr_info = | 296 | key.attr_info |
| 290 | (STORE_ATTR_INFO *)sk_value(context->search_attributes, i); | 297 | = sk_STORE_ATTR_INFO_value(context->search_attributes, |
| 291 | srch = sk_find_ex(store->data, (char *)&key); | 298 | i); |
| 299 | srch = sk_MEM_OBJECT_DATA_find_ex(store->data, &key); | ||
| 292 | 300 | ||
| 293 | if (srch >= 0) | 301 | if (srch >= 0) |
| 294 | { | 302 | { |
| @@ -301,21 +309,20 @@ static STORE_OBJECT *mem_list_next(STORE *s, void *handle) | |||
| 301 | return NULL; | 309 | return NULL; |
| 302 | 310 | ||
| 303 | key.attr_info = | 311 | key.attr_info = |
| 304 | (STORE_ATTR_INFO *)sk_value(context->search_attributes, | 312 | sk_STORE_ATTR_INFO_value(context->search_attributes, |
| 305 | context->search_index); | 313 | context->search_index); |
| 306 | for(srch = context->search_index; | 314 | for(srch = context->search_index; |
| 307 | srch < sk_num(store->data) | 315 | srch < sk_MEM_OBJECT_DATA_num(store->data) |
| 308 | && STORE_ATTR_INFO_in_range(key.attr_info, | 316 | && STORE_ATTR_INFO_in_range(key.attr_info, |
| 309 | (STORE_ATTR_INFO *)sk_value(store->data, srch)) | 317 | sk_MEM_OBJECT_DATA_value(store->data, srch)->attr_info) |
| 310 | && !(cres = STORE_ATTR_INFO_in_ex(key.attr_info, | 318 | && !(cres = STORE_ATTR_INFO_in_ex(key.attr_info, |
| 311 | (STORE_ATTR_INFO *)sk_value(store->data, srch))); | 319 | sk_MEM_OBJECT_DATA_value(store->data, srch)->attr_info)); |
| 312 | srch++) | 320 | srch++) |
| 313 | ; | 321 | ; |
| 314 | 322 | ||
| 315 | context->search_index = srch; | 323 | context->search_index = srch; |
| 316 | if (cres) | 324 | if (cres) |
| 317 | return ((struct mem_object_data_st *)sk_value(store->data, | 325 | return (sk_MEM_OBJECT_DATA_value(store->data, srch))->object; |
| 318 | srch))->object; | ||
| 319 | return NULL; | 326 | return NULL; |
| 320 | } | 327 | } |
| 321 | static int mem_list_end(STORE *s, void *handle) | 328 | static int mem_list_end(STORE *s, void *handle) |
| @@ -328,7 +335,7 @@ static int mem_list_end(STORE *s, void *handle) | |||
| 328 | return 0; | 335 | return 0; |
| 329 | } | 336 | } |
| 330 | if (context && context->search_attributes) | 337 | if (context && context->search_attributes) |
| 331 | sk_free(context->search_attributes); | 338 | sk_STORE_ATTR_INFO_free(context->search_attributes); |
| 332 | if (context) OPENSSL_free(context); | 339 | if (context) OPENSSL_free(context); |
| 333 | return 1; | 340 | return 1; |
| 334 | } | 341 | } |
| @@ -337,7 +344,8 @@ static int mem_list_endp(STORE *s, void *handle) | |||
| 337 | struct mem_ctx_st *context = (struct mem_ctx_st *)handle; | 344 | struct mem_ctx_st *context = (struct mem_ctx_st *)handle; |
| 338 | 345 | ||
| 339 | if (!context | 346 | if (!context |
| 340 | || context->search_index == sk_num(context->search_attributes)) | 347 | || context->search_index |
| 348 | == sk_STORE_ATTR_INFO_num(context->search_attributes)) | ||
| 341 | return 1; | 349 | return 1; |
| 342 | return 0; | 350 | return 0; |
| 343 | } | 351 | } |
