Ad-hoc DSO_pathbyaddr for selected platforms from HEAD in FIPS context.
This commit is contained in:
parent
e0ec2d772c
commit
780b97aba6
@ -281,4 +281,32 @@ static char *dl_name_converter(DSO *dso, const char *filename)
|
|||||||
return(translated);
|
return(translated);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef OPENSSL_FIPS
|
||||||
|
static void dl_ref_point(){}
|
||||||
|
|
||||||
|
int DSO_pathbyaddr(void *addr,char *path,int sz)
|
||||||
|
{
|
||||||
|
struct shl_descriptor inf;
|
||||||
|
int i,len;
|
||||||
|
|
||||||
|
if (addr == NULL) addr = dl_ref_porint;
|
||||||
|
|
||||||
|
for (i=-1;shl_get_r(i,&inf)==0;i++)
|
||||||
|
{
|
||||||
|
if (((size_t)addr >= inf.tstart && (size_t)addr < inf.tend) ||
|
||||||
|
((size_t)addr >= inf.dstart && (size_t)addr < inf.dend))
|
||||||
|
{
|
||||||
|
len = (int)strlen(inf.filename);
|
||||||
|
if (sz <= 0) return len+1;
|
||||||
|
if (len >= sz) len=sz-1;
|
||||||
|
memcpy(path,inf.filename,len);
|
||||||
|
path[len++] = 0;
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* DSO_DL */
|
#endif /* DSO_DL */
|
||||||
|
@ -56,6 +56,10 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __linux
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "cryptlib.h"
|
#include "cryptlib.h"
|
||||||
#include <openssl/dso.h>
|
#include <openssl/dso.h>
|
||||||
@ -290,4 +294,28 @@ static char *dlfcn_name_converter(DSO *dso, const char *filename)
|
|||||||
return(translated);
|
return(translated);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef OPENSSL_FIPS
|
||||||
|
static void dlfcn_ref_point(){}
|
||||||
|
|
||||||
|
int DSO_pathbyaddr(void *addr,char *path,int sz)
|
||||||
|
{
|
||||||
|
Dl_info dli;
|
||||||
|
int len;
|
||||||
|
|
||||||
|
if (addr == NULL) addr = dlfcn_ref_point;
|
||||||
|
|
||||||
|
if (dladdr(addr,&dli))
|
||||||
|
{
|
||||||
|
len = (int)strlen(dli.dli_fname);
|
||||||
|
if (sz <= 0) return len+1;
|
||||||
|
if (len >= sz) len=sz-1;
|
||||||
|
memcpy(path,dli.dli_fname,len);
|
||||||
|
path[len++]=0;
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
ERR_add_error_data(4, "dlfcn_pathbyaddr(): ", dlerror());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif /* DSO_DLFCN */
|
#endif /* DSO_DLFCN */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user