From 1f5e0f92808b06cb914f69ced71eccd830fb67e3 Mon Sep 17 00:00:00 2001 From: Pauli Date: Thu, 28 Sep 2017 12:13:04 +1000 Subject: [PATCH] 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) --- crypto/asn1/tasn_dec.c | 2 +- crypto/conf/conf_def.c | 1 - crypto/x509/x509_att.c | 4 ++-- crypto/x509/x509_ext.c | 3 +-- crypto/x509/x509_v3.c | 4 ++-- crypto/x509/x509name.c | 4 ++-- crypto/x509/x_all.c | 3 +-- doc/man3/DEFINE_STACK_OF.pod | 18 +++++++++++------- include/openssl/asn1.h | 4 +--- include/openssl/conf.h | 4 +--- include/openssl/crypto.h | 3 +-- include/openssl/pem.h | 3 +-- include/openssl/ts.h | 4 +--- include/openssl/txt_db.h | 3 +-- include/openssl/x509.h | 4 +--- ssl/ssl_locl.h | 1 - 16 files changed, 27 insertions(+), 38 deletions(-) diff --git a/crypto/asn1/tasn_dec.c b/crypto/asn1/tasn_dec.c index c9b637516e..8667bec76a 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 65eca6558b..82e191aef3 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 3876a83323..ff421f19d5 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 3c59079852..8b1abcd229 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 213e762f98..6bbe23404a 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 2935b17af9..90b1fd04d8 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 42bd161185..24e4114601 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 a9fc769f2b..f41d3ead8b 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 54aa038067..3354fa7ac2 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 2be21d827d..205e13793b 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 c4a36afb7e..9fc0663233 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 314d374de9..215ae4c01e 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 e67e70fe70..2419e942c5 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 0e6c943e0e..fb5f3c74a2 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 e4e46397b3..be715ea25a 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 58156f37fe..2766462222 100644 --- a/ssl/ssl_locl.h +++ b/ssl/ssl_locl.h @@ -21,7 +21,6 @@ # include # include # include -# include # include # include # include -- 2.25.1