On 6/9/2016 8:32 AM, Corinna Vinschen wrote:
Can you please define crypt, encrypt and setkey explicitely in unistd.h per POSIX, rather than including crypt.h? This would not only be target independent, it would also be more correct. As a side effect I will have to come up with a new version of the crypt package, because our crypt.h is using a wrong prototypes for setkey (const is missing).
setkey is supposed to be in stdlib.h rather than unistd.h, so I've done that.
One minor question about encrypt: The Posix prototype has 'char block[64]' as the first argument, but Cygwin's crypt.h simply has 'char *block'. FreeBSD and glibc also use 'char *block', so I did the same. Or would you rather follow Posix here?
Thanks a lot and sorry again,
No problem. Revised patch attached. Ken
From e6ab8bbf44d1042df3dd9e989967a649523d193d Mon Sep 17 00:00:00 2001 From: Ken Brown <kbr...@cornell.edu> Date: Wed, 8 Jun 2016 17:04:06 -0400 Subject: [PATCH] Declare crypt, encrypt, and setkey per Posix --- newlib/libc/include/stdlib.h | 3 +++ newlib/libc/include/sys/unistd.h | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h index 3194d6b..3d1b8a9 100644 --- a/newlib/libc/include/stdlib.h +++ b/newlib/libc/include/stdlib.h @@ -144,6 +144,9 @@ char * _EXFUN(realpath, (const char *__restrict path, char *__restrict resolved_ #if __BSD_VISIBLE int _EXFUN(rpmatch, (const char *response)); #endif +#if __XSI_VISIBLE +_VOID _EXFUN(setkey, (const char *__key)); +#endif _VOID _EXFUN(srand,(unsigned __seed)); double _EXFUN(strtod,(const char *__restrict __n, char **__restrict __end_PTR)); double _EXFUN(_strtod_r,(struct _reent *,const char *__restrict __n, char **__restrict __end_PTR)); diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h index ef00575..05b4f9d 100644 --- a/newlib/libc/include/sys/unistd.h +++ b/newlib/libc/include/sys/unistd.h @@ -31,6 +31,9 @@ int _EXFUN(close, (int __fildes )); #if __POSIX_VISIBLE >= 199209 size_t _EXFUN(confstr, (int __name, char *__buf, size_t __len)); #endif +#if __XSI_VISIBLE +char * _EXFUN(crypt, (const char *__key, const char *__salt)); +#endif #if __XSI_VISIBLE && __XSI_VISIBLE < 700 char * _EXFUN(ctermid, (char *__s )); #endif @@ -46,6 +49,9 @@ int _EXFUN(dup2, (int __fildes, int __fildes2 )); int _EXFUN(dup3, (int __fildes, int __fildes2, int flags)); int _EXFUN(eaccess, (const char *__path, int __mode)); #endif +#if __XSI_VISIBLE +void _EXFUN(encrypt, (char *__block, int __edflag)); +#endif #if __BSD_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 500) void _EXFUN(endusershell, (void)); #endif -- 2.8.3