Skip to content

Commit 79c8dcf

Browse files
committed
Add {lib}_R_{lib}_LIB, for our engines and other "external" modules
Engines lacked the possibility to refer to themselves in this form: WHATEVERerr(WHATEVER_F_SOMETHING, WHATEVER_R_WHATEVER_LIB); This little change makes that possible, and gets used in e_capi. Reviewed-by: Tomas Mraz <[email protected]> Reviewed-by: Hugo Landau <[email protected]> (Merged from openssl#19301)
1 parent e077455 commit 79c8dcf

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

engines/e_capi_err.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Generated by util/mkerr.pl DO NOT EDIT
3-
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
3+
* Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
44
*
55
* Licensed under the Apache License 2.0 (the "License"). You may not use
66
* this file except in compliance with the License. You can obtain a copy
@@ -92,3 +92,10 @@ static void ERR_CAPI_error(int function, int reason, const char *file, int line)
9292
ERR_raise(lib_code, reason);
9393
ERR_set_debug(file, line, NULL);
9494
}
95+
96+
static int ERR_CAPI_lib(void)
97+
{
98+
if (lib_code == 0)
99+
lib_code = ERR_get_next_error_library();
100+
return lib_code;
101+
}

engines/e_capi_err.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Generated by util/mkerr.pl DO NOT EDIT
3-
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
3+
* Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
44
*
55
* Licensed under the Apache License 2.0 (the "License"). You may not use
66
* this file except in compliance with the License. You can obtain a copy
@@ -17,6 +17,7 @@
1717

1818

1919
# define CAPIerr(f, r) ERR_CAPI_error(0, (r), OPENSSL_FILE, OPENSSL_LINE)
20+
# define ERR_R_CAPI_LIB ERR_CAPI_lib()
2021

2122

2223
/*

util/mkerr.pl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /usr/bin/env perl
2-
# Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved.
2+
# Copyright 1999-2022 The OpenSSL Project Authors. All Rights Reserved.
33
#
44
# Licensed under the Apache License 2.0 (the "License"). You may not use
55
# this file except in compliance with the License. You can obtain a copy
@@ -450,6 +450,7 @@ sub help
450450
} else {
451451
print OUT <<"EOF";
452452
# define ${lib}err(f, r) ERR_${lib}_error(0, (r), OPENSSL_FILE, OPENSSL_LINE)
453+
# define ERR_R_${lib}_LIB ERR_${lib}_lib()
453454
454455
EOF
455456
if ( ! $static ) {
@@ -629,6 +630,13 @@ sub help
629630
ERR_raise(lib_code, reason);
630631
ERR_set_debug(file, line, NULL);
631632
}
633+
634+
${st}int ERR_${lib}_lib(void)
635+
{
636+
if (lib_code == 0)
637+
lib_code = ERR_get_next_error_library();
638+
return lib_code;
639+
}
632640
EOF
633641

634642
}

0 commit comments

Comments
 (0)