Skip to content

Commit

Permalink
"Overload" SunOS 4.x memcmp, which ruins ASN1_OBJECT table lookups.
Browse files Browse the repository at this point in the history
PR: 1196
Submitted by: Russel Ruby
  • Loading branch information
Andy Polyakov committed Sep 20, 2005
1 parent 6f9afa6 commit 7a06050
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions crypto/asn1/tasn_enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

#include <stddef.h>
#include <string.h>
#include "cryptlib.h"
#include <openssl/asn1.h>
#include <openssl/asn1t.h>
#include <openssl/objects.h>
Expand Down
9 changes: 9 additions & 0 deletions crypto/o_str.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,12 @@ int OPENSSL_strcasecmp(const char *str1, const char *str2)
#endif
}

int OPENSSL_memcmp(const void *v1,const void *v2,size_t n)
{
const unsigned char *c1=v1,*c2=v2;
int ret=0;

while(n && (ret=*c1-*c2)==0) n--,c1++,c2++;

return ret;
}
1 change: 1 addition & 0 deletions crypto/o_str.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,6 @@

int OPENSSL_strcasecmp(const char *str1, const char *str2);
int OPENSSL_strncasecmp(const char *str1, const char *str2, size_t n);
int OPENSSL_memcmp(const void *p1,const void *p2,size_t n);

#endif
3 changes: 3 additions & 0 deletions e_os.h
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,9 @@ extern HINSTANCE _hInstance;
extern char *sys_errlist[]; extern int sys_nerr;
# define strerror(errnum) \
(((errnum)<0 || (errnum)>=sys_nerr) ? NULL : sys_errlist[errnum])
/* Being signed SunOS 4.x memcpy breaks ASN1_OBJECT table lookup */
#include "o_str.h"
# define memcmp OPENSSL_memcmp
#endif

#ifndef OPENSSL_EXIT
Expand Down

0 comments on commit 7a06050

Please sign in to comment.