diff mbox series

sslapi: Fix OpenSSL 3.2.0 X509_PURPOSE_CODE_SIGN

Message ID F8682798-B0CF-40A1-B4F7-CA22AF93819B@siemens.com
State Accepted
Headers show
Series sslapi: Fix OpenSSL 3.2.0 X509_PURPOSE_CODE_SIGN | expand

Commit Message

Storm, Christian Nov. 27, 2023, 12:04 p.m. UTC
OpenSSL 3.2.0 defines X509_PURPOSE_CODE_SIGN = 10.
Define it only if not defined so to not end up with
X509_PURPOSE_CODE_SIGN == 11 in SWUpdate as
X509_PURPOSE_MAX has become 10 in OpenSSL 3.2.0.

See: https://github.com/openssl/openssl/commit/178696d6020878361a088086243d56203e0beaa9

Signed-off-by: Christian Storm <christian.storm@siemens.com>
---
 include/sslapi.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

Stefano Babic Nov. 27, 2023, 12:40 p.m. UTC | #1
On 27.11.23 13:04, 'Storm, Christian' via swupdate wrote:
> OpenSSL 3.2.0 defines X509_PURPOSE_CODE_SIGN = 10.
> Define it only if not defined so to not end up with
> X509_PURPOSE_CODE_SIGN == 11 in SWUpdate as
> X509_PURPOSE_MAX has become 10 in OpenSSL 3.2.0.
> 
> See: https://github.com/openssl/openssl/commit/178696d6020878361a088086243d56203e0beaa9
> 
> Signed-off-by: Christian Storm <christian.storm@siemens.com>
> ---
>   include/sslapi.h | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/include/sslapi.h b/include/sslapi.h
> index 9f5b061c..0dce615b 100644
> --- a/include/sslapi.h
> +++ b/include/sslapi.h
> @@ -84,7 +84,9 @@ static inline uint32_t SSL_X509_get_extended_key_usage(X509 *x)
>   #define X509_PURPOSE_CODE_SIGN EXTKEYUSE_CODESIGN
>   #define SSL_PURPOSE_EMAIL_PROT EXTKEYUSE_EMAILPROT
>   #else
> +#if !defined(X509_PURPOSE_CODE_SIGN)
>   #define X509_PURPOSE_CODE_SIGN (X509_PURPOSE_MAX + 1)
> +#endif
>   #define SSL_PURPOSE_EMAIL_PROT X509_PURPOSE_SMIME_SIGN
>   #endif
>   #define SSL_PURPOSE_CODE_SIGN  X509_PURPOSE_CODE_SIGN

Reviewed-by: Stefano Babic <stefano.babic@swupdate.org>

Best regards,
Stefano
diff mbox series

Patch

diff --git a/include/sslapi.h b/include/sslapi.h
index 9f5b061c..0dce615b 100644
--- a/include/sslapi.h
+++ b/include/sslapi.h
@@ -84,7 +84,9 @@  static inline uint32_t SSL_X509_get_extended_key_usage(X509 *x)
 #define X509_PURPOSE_CODE_SIGN EXTKEYUSE_CODESIGN
 #define SSL_PURPOSE_EMAIL_PROT EXTKEYUSE_EMAILPROT
 #else
+#if !defined(X509_PURPOSE_CODE_SIGN)
 #define X509_PURPOSE_CODE_SIGN (X509_PURPOSE_MAX + 1)
+#endif
 #define SSL_PURPOSE_EMAIL_PROT X509_PURPOSE_SMIME_SIGN
 #endif
 #define SSL_PURPOSE_CODE_SIGN  X509_PURPOSE_CODE_SIGN