From: Pauli Date: Thu, 28 Sep 2017 02:13:04 +0000 (+1000) Subject: Use safestack.h exclusively internally. X-Git-Tag: OpenSSL_1_1_1-pre1~615 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f5e0f92808b06cb914f69ced71eccd830fb67e3;p=thirdparty%2Fopenssl.git Use safestack.h exclusively internally. Remove all stack headers from some includes that don't use them. Avoid a genearic untyped stack use. Update stack POD file to include the OPENSSL_sk_ API functions in the notes section. They were mentioned in the name section but not defined anywhere. Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/4430) --- diff --git a/crypto/asn1/tasn_dec.c b/crypto/asn1/tasn_dec.c index c9b637516e3..8667bec76ae 100644 --- a/crypto/asn1/tasn_dec.c +++ b/crypto/asn1/tasn_dec.c @@ -538,7 +538,7 @@ static int asn1_template_noexp_d2i(ASN1_VALUE **val, } else if (ret == -1) return -1; if (!*val) - *val = (ASN1_VALUE *)OPENSSL_sk_new_null(); + *val = (ASN1_VALUE *)sk_ASN1_VALUE_new_null(); else { /* * We've got a valid STACK: free up any items present diff --git a/crypto/conf/conf_def.c b/crypto/conf/conf_def.c index 65eca6558ba..82e191aef30 100644 --- a/crypto/conf/conf_def.c +++ b/crypto/conf/conf_def.c @@ -12,7 +12,6 @@ #include #include #include "internal/cryptlib.h" -#include #include #include #include diff --git a/crypto/x509/x509_att.c b/crypto/x509/x509_att.c index 3876a833235..ff421f19d51 100644 --- a/crypto/x509/x509_att.c +++ b/crypto/x509/x509_att.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -9,7 +9,7 @@ #include #include "internal/cryptlib.h" -#include +#include #include #include #include diff --git a/crypto/x509/x509_ext.c b/crypto/x509/x509_ext.c index 3c59079852f..8b1abcd2293 100644 --- a/crypto/x509/x509_ext.c +++ b/crypto/x509/x509_ext.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -9,7 +9,6 @@ #include #include "internal/cryptlib.h" -#include #include #include #include diff --git a/crypto/x509/x509_v3.c b/crypto/x509/x509_v3.c index 213e762f986..6bbe23404ab 100644 --- a/crypto/x509/x509_v3.c +++ b/crypto/x509/x509_v3.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -9,7 +9,7 @@ #include #include "internal/cryptlib.h" -#include +#include #include #include #include diff --git a/crypto/x509/x509name.c b/crypto/x509/x509name.c index 2935b17af96..90b1fd04d89 100644 --- a/crypto/x509/x509name.c +++ b/crypto/x509/x509name.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -9,7 +9,7 @@ #include #include "internal/cryptlib.h" -#include +#include #include #include #include diff --git a/crypto/x509/x_all.c b/crypto/x509/x_all.c index 42bd161185b..24e4114601c 100644 --- a/crypto/x509/x_all.c +++ b/crypto/x509/x_all.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -9,7 +9,6 @@ #include #include "internal/cryptlib.h" -#include #include #include #include diff --git a/doc/man3/DEFINE_STACK_OF.pod b/doc/man3/DEFINE_STACK_OF.pod index a9fc769f2bf..f41d3ead8b4 100644 --- a/doc/man3/DEFINE_STACK_OF.pod +++ b/doc/man3/DEFINE_STACK_OF.pod @@ -4,13 +4,6 @@ DEFINE_STACK_OF, DEFINE_STACK_OF_CONST, DEFINE_SPECIAL_STACK_OF, DEFINE_SPECIAL_STACK_OF_CONST, -OPENSSL_sk_deep_copy, OPENSSL_sk_delete, OPENSSL_sk_delete_ptr, -OPENSSL_sk_dup, OPENSSL_sk_find, OPENSSL_sk_find_ex, -OPENSSL_sk_free, OPENSSL_sk_insert, OPENSSL_sk_is_sorted, -OPENSSL_sk_new, OPENSSL_sk_new_null, OPENSSL_sk_num, OPENSSL_sk_pop, -OPENSSL_sk_pop_free, OPENSSL_sk_push, OPENSSL_sk_reserve, OPENSSL_sk_set, -OPENSSL_sk_set_cmp_func, OPENSSL_sk_shift, OPENSSL_sk_sort, -OPENSSL_sk_unshift, OPENSSL_sk_value, OPENSSL_sk_zero, sk_TYPE_num, sk_TYPE_value, sk_TYPE_new, sk_TYPE_new_null, sk_TYPE_reserve, sk_TYPE_free, sk_TYPE_zero, sk_TYPE_delete, sk_TYPE_delete_ptr, sk_TYPE_push, sk_TYPE_unshift, sk_TYPE_pop, @@ -198,6 +191,17 @@ A failed search is indicated by a B<-1> return value. STACK_OF(), DEFINE_STACK_OF(), DEFINE_STACK_OF_CONST(), and DEFINE_SPECIAL_STACK_OF() are implemented as macros. +The underlying utility B API should not be used directly. +It defines these functions: OPENSSL_sk_deep_copy(), +OPENSSL_sk_delete(), OPENSSL_sk_delete_ptr(), OPENSSL_sk_dup(), +OPENSSL_sk_find(), OPENSSL_sk_find_ex(), OPENSSL_sk_free(), +OPENSSL_sk_insert(), OPENSSL_sk_is_sorted(), OPENSSL_sk_new(), +OPENSSL_sk_new_null(), OPENSSL_sk_num(), OPENSSL_sk_pop(), +OPENSSL_sk_pop_free(), OPENSSL_sk_push(), OPENSSL_sk_reserve(), +OPENSSL_sk_set(), OPENSSL_sk_set_cmp_func(), OPENSSL_sk_shift(), +OPENSSL_sk_sort(), OPENSSL_sk_unshift(), OPENSSL_sk_value(), +OPENSSL_sk_zero(). + =head1 RETURN VALUES sk_TYPE_num() returns the number of elements in the stack or B<-1> if the diff --git a/include/openssl/asn1.h b/include/openssl/asn1.h index 54aa0380671..3354fa7ac2c 100644 --- a/include/openssl/asn1.h +++ b/include/openssl/asn1.h @@ -1,5 +1,5 @@ /* - * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -14,8 +14,6 @@ # include # include # include -# include -# include # include # include diff --git a/include/openssl/conf.h b/include/openssl/conf.h index 2be21d827d8..205e13793bf 100644 --- a/include/openssl/conf.h +++ b/include/openssl/conf.h @@ -1,5 +1,5 @@ /* - * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -12,8 +12,6 @@ # include # include -# include -# include # include # include # include diff --git a/include/openssl/crypto.h b/include/openssl/crypto.h index c4a36afb7ed..9fc06632335 100644 --- a/include/openssl/crypto.h +++ b/include/openssl/crypto.h @@ -1,5 +1,5 @@ /* - * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved * * Licensed under the OpenSSL license (the "License"). You may not use @@ -20,7 +20,6 @@ # include # endif -# include # include # include # include diff --git a/include/openssl/pem.h b/include/openssl/pem.h index 314d374de96..215ae4c01e2 100644 --- a/include/openssl/pem.h +++ b/include/openssl/pem.h @@ -1,5 +1,5 @@ /* - * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -12,7 +12,6 @@ # include # include -# include # include # include # include diff --git a/include/openssl/ts.h b/include/openssl/ts.h index e67e70fe705..2419e942c5b 100644 --- a/include/openssl/ts.h +++ b/include/openssl/ts.h @@ -1,5 +1,5 @@ /* - * Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2006-2017 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -17,9 +17,7 @@ # include # include # include -# include # include -# include # include # include # include diff --git a/include/openssl/txt_db.h b/include/openssl/txt_db.h index 0e6c943e0eb..fb5f3c74a2c 100644 --- a/include/openssl/txt_db.h +++ b/include/openssl/txt_db.h @@ -1,5 +1,5 @@ /* - * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -12,7 +12,6 @@ # include # include -# include # include # define DB_ERROR_OK 0 diff --git a/include/openssl/x509.h b/include/openssl/x509.h index e4e46397b35..be715ea25a8 100644 --- a/include/openssl/x509.h +++ b/include/openssl/x509.h @@ -1,5 +1,5 @@ /* - * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved * * Licensed under the OpenSSL license (the "License"). You may not use @@ -17,9 +17,7 @@ # include # include # include -# include # include -# include # include # if OPENSSL_API_COMPAT < 0x10100000L diff --git a/ssl/ssl_locl.h b/ssl/ssl_locl.h index 58156f37fe8..2766462222d 100644 --- a/ssl/ssl_locl.h +++ b/ssl/ssl_locl.h @@ -21,7 +21,6 @@ # include # include # include -# include # include # include # include