Julian,

Note that e_os.h defines macros for memmove and strtoul:

#if defined(sun) && !defined(__svr4__) && !defined(__SVR4)
  /* bcopy can handle overlapping moves according to SunOS 4.1.4 manpage */
# define memmove(s1,s2,n) bcopy((s2),(s1),(n))
# define strtoul(s,e,b) ((unsigned long int)strtol((s),(e),(b)))
extern char *sys_errlist[]; extern int sys_nerr;
# define strerror(errnum) \
        (((errnum)<0 || (errnum)>=sys_nerr) ? NULL : sys_errlist[errnum])
#endif

Frank

> -----Original Message-----
> From: J.P. King [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, October 04, 2000 4:15 AM
> To: [EMAIL PROTECTED]
> Subject: SunOS
> 
> 
> 
> I don't know how much you'll care, but I've been compiling OpenSSL on
> SunOS (as part of getting OpenSSH working on as many platforms as I
> could), and there are a few small issues.
> 
> memmove()
> 
> This function doesn't exist, but is used in:
> 
> crypto/bio/bss_mem.c
> crypto/bio/bss_rtcp.c
> crypto/evp/bio_ok.c
> crypto/stack/stack.c
> ssl/s3_pkt.c
> 
> I used bcopy instead.  Based on my reading of the memcopy code in
> FreeBSD, and the manual page for memcopy, I believe that:
> 
> void * memmove(dst0, src0, length)
>         void *dst0;
>         const void *src0;
>         register int length;
> {
> bcopy (src0, dst0, length);
> return dst0;
> }
> 
> is correct.  Certainly the code compiles, and it passes the tests
> successfully.
> 
> Also you use strtoul in crypto/asn1/a_strnid.c - I did 
> consider replacing it
> with strtol(), but I wasn't sure that this would be safe, and 
> certainly my
> reading of the code didn't lead me to think that it would be 
> in all cases
> where strtoul was safe.  Again I used FreeBSD's code:
> 
> /* JPK Hack */
> #include <errno.h>
> #include <limits.h>
> /*
>  * Convert a string to an unsigned long integer.
>  *
>  * Ignores `locale' stuff.  Assumes that the upper and lower case
>  * alphabets and digits are each contiguous.
>  */
> unsigned long
> strtoul(nptr, endptr, base)
>         const char *nptr;
>         char **endptr;
>         register int base;
> {
>         register const char *s = nptr;
>         register unsigned long acc;
>         register unsigned char c;
>         register unsigned long cutoff;
>         register int neg = 0, any, cutlim;
> 
>         /*
>          * See strtol for comments as to the logic used.
>          */
>         do {
>                 c = *s++;
>         } while (isspace(c));
>         if (c == '-') {
>                 neg = 1;
>                 c = *s++;
>         } else if (c == '+')
>                 c = *s++;
>         if ((base == 0 || base == 16) &&
>             c == '0' && (*s == 'x' || *s == 'X')) {
>                 c = s[1];
>                 s += 2;
>                 base = 16;
>         }
>         if (base == 0)
>                 base = c == '0' ? 8 : 10;
>         cutoff = (unsigned long)ULONG_MAX / (unsigned long)base;
>         cutlim = (unsigned long)ULONG_MAX % (unsigned long)base;
>         for (acc = 0, any = 0;; c = *s++) {
>                 if (!isascii(c))
>                         break;
>                 if (isdigit(c))
>                         c -= '0';
>                 else if (isalpha(c))
>                         c -= isupper(c) ? 'A' - 10 : 'a' - 10;
>                 else
>                         break;
>                 if (c >= base)
>                         break;
>                 if (any < 0 || acc > cutoff || (acc == cutoff 
> && c > cutlim))
>                         any = -1;
>                 else {  
>                         any = 1;
>                         acc *= base;
>                         acc += c;
>                 }
>         }
>         if (any < 0) {
>                 acc = ULONG_MAX;
>                 errno = ERANGE;
>         } else if (neg)
>                 acc = -acc;
>         if (endptr != 0)
>                 *endptr = (char *)(any ? s - 1 : nptr);
>         return (acc);
> }
> 
> Again, this compiles, and appears to work in OpenSSH.
> 
> 
> Lastly, in crypto/err/err.c you use strerror(), which doesn't
> exist in the header files you refer to.  However it was in
> the Xos.h header file on the machine, so I stole that (rather
> than including the header file)
> 
> /* JPK HACK */
> extern char *sys_errlist[];
> extern int sys_nerr;
> #define strerror(n) \
>     (((n) >= 0 && (n) < sys_nerr) ? sys_errlist[n] : "unknown error")
> 
> 
> Again, this compiles, and appears to work in OpenSSH.
> 
> 
> The information that your README requests is:
> 
> [julianl@mrgreedy openssl-0.9.5a]$ /tmp/openssl/bin/openssl version -a
> OpenSSL 0.9.5a 1 Apr 2000
> built on: Mon Oct  2 18:14:23 BST 2000
> platform: sunos-gcc
> options:  bn(64,32) md2(int) rc4(ptr,char) 
> des(ptr,risc1,16,long) idea(int) blowfish(idx)
> compiler: gcc -O3 -mv8 -Dssize_t=int
> 
> OpenSSL self-test report:
> 
> OpenSSL version:  0.9.5a
> Last change:      Make sure _lrotl and _lrotr are only used 
> with MSVC....
> Options:          --prefix=/tmp/openssl
> OS (uname):       SunOS mrgreedy 4.1.3_U1 1 sun4c
> OS (config):      sun4c-sun-sunos4
> Target (default): sunos-gcc
> Target:           sunos-gcc
> Compiler:         gcc version 2.7.0
> 
> Test passed.
> 
> 
> Julian
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> Development Mailing List                       [EMAIL PROTECTED]
> Automated List Manager                           [EMAIL PROTECTED]
> 
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]
  • SunOS J.P. King
    • Frank Balluffi

Reply via email to