| 
									
										
										
										
											2020-11-25 14:56:08 +08:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2021-01-28 20:54:57 +08:00
										 |  |  |  * Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved. | 
					
						
							| 
									
										
										
										
											2020-11-25 14:56:08 +08:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Licensed under the Apache License 2.0 (the "License").  You may not use | 
					
						
							|  |  |  |  * this file except in compliance with the License.  You can obtain a copy | 
					
						
							|  |  |  |  * in the file LICENSE in the source distribution or at | 
					
						
							|  |  |  |  * https://www.openssl.org/source/license.html
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef OSSL_TEST_SIMPLEDYNAMIC_H
 | 
					
						
							|  |  |  | # define OSSL_TEST_SIMPLEDYNAMIC_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # include "crypto/dso_conf.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-23 14:21:04 +08:00
										 |  |  | # if defined(DSO_DLFCN) || defined(DSO_VMS)
 | 
					
						
							| 
									
										
										
										
											2020-11-25 14:56:08 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | #  include <dlfcn.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #  define SD_INIT       NULL
 | 
					
						
							| 
									
										
										
										
											2021-06-23 14:21:04 +08:00
										 |  |  | #  ifdef DSO_VMS
 | 
					
						
							|  |  |  | #   define SD_SHLIB     0
 | 
					
						
							|  |  |  | #   define SD_MODULE    0
 | 
					
						
							|  |  |  | #  else
 | 
					
						
							|  |  |  | #   define SD_SHLIB     (RTLD_GLOBAL|RTLD_LAZY)
 | 
					
						
							|  |  |  | #   define SD_MODULE    (RTLD_LOCAL|RTLD_NOW)
 | 
					
						
							|  |  |  | #  endif
 | 
					
						
							| 
									
										
										
										
											2020-11-25 14:56:08 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | typedef void *SD; | 
					
						
							|  |  |  | typedef void *SD_SYM; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # elif defined(DSO_WIN32)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #  include <windows.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #  define SD_INIT       0
 | 
					
						
							|  |  |  | #  define SD_SHLIB      0
 | 
					
						
							|  |  |  | #  define SD_MODULE     0
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef HINSTANCE SD; | 
					
						
							|  |  |  | typedef void *SD_SYM; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-23 14:21:04 +08:00
										 |  |  | # if defined(DSO_DLFCN) || defined(DSO_WIN32) || defined(DSO_VMS)
 | 
					
						
							| 
									
										
										
										
											2020-11-25 14:56:08 +08:00
										 |  |  | int sd_load(const char *filename, SD *sd, int type); | 
					
						
							|  |  |  | int sd_sym(SD sd, const char *symname, SD_SYM *sym); | 
					
						
							|  |  |  | int sd_close(SD lib); | 
					
						
							|  |  |  | const char *sd_error(void); | 
					
						
							| 
									
										
											  
											
												Fix simpledynamic test compilation when condigured without DSO support.
This fixes this compilation error:
In file included from test/simpledynamic.c:13:
test/simpledynamic.h:39:35: error: unknown type name 'SD'
   39 | int sd_load(const char *filename, SD *sd, int type);
      |                                   ^~
test/simpledynamic.h:40:12: error: unknown type name 'SD'
   40 | int sd_sym(SD sd, const char *symname, SD_SYM *sym);
      |            ^~
test/simpledynamic.h:40:40: error: unknown type name 'SD_SYM'
   40 | int sd_sym(SD sd, const char *symname, SD_SYM *sym);
      |                                        ^~~~~~
test/simpledynamic.h:41:14: error: unknown type name 'SD'
   41 | int sd_close(SD lib);
      |              ^~
make[1]: *** [Makefile:24670: test/moduleloadtest-bin-simpledynamic.o] Error 1
make[1]: *** Waiting for unfinished jobs....
In file included from test/moduleloadtest.c:19:
test/simpledynamic.h:39:35: error: unknown type name 'SD'
   39 | int sd_load(const char *filename, SD *sd, int type);
      |                                   ^~
test/simpledynamic.h:40:12: error: unknown type name 'SD'
   40 | int sd_sym(SD sd, const char *symname, SD_SYM *sym);
      |            ^~
test/simpledynamic.h:40:40: error: unknown type name 'SD_SYM'
   40 | int sd_sym(SD sd, const char *symname, SD_SYM *sym);
      |                                        ^~~~~~
test/simpledynamic.h:41:14: error: unknown type name 'SD'
   41 | int sd_close(SD lib);
      |              ^~
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13802)
											
										 
											2021-01-08 00:54:58 +08:00
										 |  |  | # endif
 | 
					
						
							| 
									
										
										
										
											2020-11-25 14:56:08 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | #endif
 |