diff --git a/security/nss/lib/util/quickder.c b/security/nss/lib/util/quickder.c index 70ae42b270..9722f99d33 100644 --- a/security/nss/lib/util/quickder.c +++ b/security/nss/lib/util/quickder.c @@ -8,7 +8,22 @@ #include "secerr.h" #include "secasn1.h" /* for SEC_ASN1GetSubtemplate */ -#include "secitem.h" + +/* +* Windows NT4 / 2000 / XP‑RTM do not provide EncodePointer / DecodePointer. +* On down‑level systems, the correct behaviour is to return the pointer unchanged. +*/ + +static __inline void* CompatDecodePointer(void* p) +{ + return p; +} + +static __inline void* CompatEncodePointer(void* p) +{ + return p; +} + /* * simple definite-length ASN.1 decoder @@ -402,7 +417,7 @@ DecodeInline(void* dest, } static SECStatus -DecodePointer(void* dest, +CompatDecodePointer(void* dest, const SEC_ASN1Template* templateEntry, SECItem* src, PLArenaPool* arena, PRBool checkTag) { @@ -428,7 +443,7 @@ DecodeImplicit(void* dest, SECItem* src, PLArenaPool* arena) { if (templateEntry->kind & SEC_ASN1_POINTER) { - return DecodePointer((void*)((char*)dest), + return CompatDecodePointer((void*)((char*)dest), templateEntry, src, arena, PR_FALSE); } else { return DecodeInline((void*)((char*)dest), @@ -569,7 +584,7 @@ DecodeExplicit(void* dest, if (SECSuccess == rv) { if (templateEntry->kind & SEC_ASN1_POINTER) { - rv = DecodePointer(dest, templateEntry, &subItem, arena, PR_TRUE); + rv = CompatDecodePointer(dest, templateEntry, &subItem, arena, PR_TRUE); } else { rv = DecodeInline(dest, templateEntry, &subItem, arena, PR_TRUE); } @@ -696,7 +711,7 @@ DecodeItem(void* dest, /* decode implicitly tagged components */ rv = DecodeImplicit(dest, templateEntry, &temp, arena); } else if (kind & SEC_ASN1_POINTER) { - rv = DecodePointer(dest, templateEntry, &temp, arena, PR_TRUE); + rv = CompatDecodePointer(dest, templateEntry, &temp, arena, PR_TRUE); } else if (kind & SEC_ASN1_CHOICE) { rv = DecodeChoice(dest, templateEntry, &temp, arena); } else if (kind & SEC_ASN1_ANY) {