On 2010-07-30 20:53 PDT, Wan-Teh Chang wrote:

> Here is Hanno's code modified to use a PointerTo template:
> 
> SEC_ASN1_MKSUB(SECOID_AlgorithmIDTemplate)
> 
> const SEC_ASN1Template MY_PointerToAlgorithmIDTemplate[] = {
>     { SEC_ASN1_POINTER, 0, SEC_ASN1_SUB(SECOID_AlgorithmIDTemplate) }
> };
> 
> const SEC_ASN1Template MY_RSAPSSParamsTemplate[] =
> {
>    { SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SECKEYRSAPSSParams) },
>    { SEC_ASN1_OPTIONAL | SEC_ASN1_CONSTRUCTED | SEC_ASN1_EXPLICIT |
>          SEC_ASN1_XTRN | SEC_ASN1_CONTEXT_SPECIFIC | 0,
>          offsetof(SECKEYRSAPSSParams, hashAlg),
>          MY_PointerToAlgorithmIDTemplate },
>    { 0 }
> };

This doesn't work (crashes) on windows.  It probably does on Unix.
The XTRN flag is wrong there.  On WIndows, it tells the en/decoder that
the template pointer is actually a pointer to a "chooser" function,
but the chooser function got moved up to the PointerTo template.
So, I moved the XTRN flag up to the PointerTo template, and that
didn't crash, but it failed.  I'm debugging it now.
-- 
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to