提交 d096b524 编写于 作者: D Dr. Stephen Henson

Add support for 'other' PKCS#7 content types.

上级 c9b51693
...@@ -4,6 +4,12 @@ ...@@ -4,6 +4,12 @@
Changes between 0.9.5a and 0.9.6 [xx XXX 2000] Changes between 0.9.5a and 0.9.6 [xx XXX 2000]
*) Unrecognized PKCS#7 content types are now handled via a
catch all ASN1_TYPE structure. This allows unsupported
types to be stored as a "blob" and an application can
encode and decode it manually.
[Steve Henson]
*) Fix various signed/unsigned issues to make a_strex,c *) Fix various signed/unsigned issues to make a_strex,c
compile under VC++. compile under VC++.
[Oscar Jacobsson <oscar.jacobsson@celocom.com>] [Oscar Jacobsson <oscar.jacobsson@celocom.com>]
......
...@@ -104,6 +104,7 @@ int i2d_PKCS7(PKCS7 *a, unsigned char **pp) ...@@ -104,6 +104,7 @@ int i2d_PKCS7(PKCS7 *a, unsigned char **pp)
M_ASN1_I2D_len(a->d.encrypted,i2d_PKCS7_ENCRYPT); M_ASN1_I2D_len(a->d.encrypted,i2d_PKCS7_ENCRYPT);
break; break;
default: default:
M_ASN1_I2D_len(a->d.other,i2d_ASN1_TYPE);
break; break;
} }
} }
...@@ -138,6 +139,7 @@ int i2d_PKCS7(PKCS7 *a, unsigned char **pp) ...@@ -138,6 +139,7 @@ int i2d_PKCS7(PKCS7 *a, unsigned char **pp)
M_ASN1_I2D_put(a->d.encrypted,i2d_PKCS7_ENCRYPT); M_ASN1_I2D_put(a->d.encrypted,i2d_PKCS7_ENCRYPT);
break; break;
default: default:
M_ASN1_I2D_put(a->d.other,i2d_ASN1_TYPE);
break; break;
} }
M_ASN1_I2D_INF_seq_end(); M_ASN1_I2D_INF_seq_end();
...@@ -189,6 +191,7 @@ int i2d_PKCS7(PKCS7 *a, unsigned char **pp) ...@@ -189,6 +191,7 @@ int i2d_PKCS7(PKCS7 *a, unsigned char **pp)
M_ASN1_I2D_len(a->d.encrypted,i2d_PKCS7_ENCRYPT); M_ASN1_I2D_len(a->d.encrypted,i2d_PKCS7_ENCRYPT);
break; break;
default: default:
M_ASN1_I2D_len(a->d.other,i2d_ASN1_TYPE);
break; break;
} }
/* Work out explicit tag content size */ /* Work out explicit tag content size */
...@@ -228,6 +231,7 @@ int i2d_PKCS7(PKCS7 *a, unsigned char **pp) ...@@ -228,6 +231,7 @@ int i2d_PKCS7(PKCS7 *a, unsigned char **pp)
M_ASN1_I2D_put(a->d.encrypted,i2d_PKCS7_ENCRYPT); M_ASN1_I2D_put(a->d.encrypted,i2d_PKCS7_ENCRYPT);
break; break;
default: default:
M_ASN1_I2D_put(a->d.other,i2d_ASN1_TYPE);
break; break;
} }
} }
...@@ -298,10 +302,8 @@ PKCS7 *d2i_PKCS7(PKCS7 **a, unsigned char **pp, long length) ...@@ -298,10 +302,8 @@ PKCS7 *d2i_PKCS7(PKCS7 **a, unsigned char **pp, long length)
M_ASN1_D2I_get(ret->d.encrypted,d2i_PKCS7_ENCRYPT); M_ASN1_D2I_get(ret->d.encrypted,d2i_PKCS7_ENCRYPT);
break; break;
default: default:
c.error=ASN1_R_BAD_PKCS7_TYPE; M_ASN1_D2I_get(ret->d.other,d2i_ASN1_TYPE);
c.line=__LINE__; break;
goto err;
/* break; */
} }
if (Tinf == (1|V_ASN1_CONSTRUCTED)) if (Tinf == (1|V_ASN1_CONSTRUCTED))
{ {
...@@ -378,7 +380,7 @@ void PKCS7_content_free(PKCS7 *a) ...@@ -378,7 +380,7 @@ void PKCS7_content_free(PKCS7 *a)
PKCS7_ENCRYPT_free(a->d.encrypted); PKCS7_ENCRYPT_free(a->d.encrypted);
break; break;
default: default:
/* MEMORY LEAK */ ASN1_TYPE_free(a->d.other);
break; break;
} }
} }
......
...@@ -210,6 +210,9 @@ typedef struct pkcs7_st ...@@ -210,6 +210,9 @@ typedef struct pkcs7_st
/* NID_pkcs7_encrypted */ /* NID_pkcs7_encrypted */
PKCS7_ENCRYPT *encrypted; PKCS7_ENCRYPT *encrypted;
/* Anything else */
ASN1_TYPE *other;
} d; } d;
} PKCS7; } PKCS7;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册