mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 08:53:07 +09:00
Compatibility shim for DecodePointer
This commit is contained in:
parent
610e87ff3d
commit
bf743d6699
1 changed files with 20 additions and 5 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue