forked from wolfSSL/wolfssl
initial AuthEnvelopedData stream and add debug messages
This commit is contained in:
committed by
David Garske
parent
d69a3c1092
commit
5d8f59d83b
File diff suppressed because it is too large
Load Diff
@ -19380,6 +19380,7 @@ static int pkcs7enveloped_run_vectors(byte* rsaCert, word32 rsaCertSz,
|
||||
decodedSz = wc_PKCS7_DecodeEnvelopedData(pkcs7, enveloped, envelopedSz,
|
||||
decoded, sizeof(decoded));
|
||||
if (decodedSz <= 0) {
|
||||
printf("ret = %d\n", decodedSz);
|
||||
wc_PKCS7_Free(pkcs7);
|
||||
return -9325;
|
||||
}
|
||||
@ -19985,7 +19986,25 @@ static int pkcs7authenveloped_run_vectors(byte* rsaCert, word32 rsaCertSz,
|
||||
wc_PKCS7_Free(pkcs7);
|
||||
return -9385;
|
||||
}
|
||||
|
||||
#ifndef NO_PKCS7_STREAM
|
||||
{ /* test reading byte by byte */
|
||||
int z;
|
||||
for (z = 0; z < envelopedSz; z++) {
|
||||
decodedSz = wc_PKCS7_DecodeAuthEnvelopedData(pkcs7,
|
||||
enveloped + z, 1, decoded, sizeof(decoded));
|
||||
if (decodedSz <= 0 && decodedSz != WC_PKCS7_WANT_READ_E) {
|
||||
printf("unexpected error %d\n", decodedSz);
|
||||
return -9386;
|
||||
}
|
||||
}
|
||||
/* test decode result */
|
||||
if (XMEMCMP(decoded, data, sizeof(data)) != 0) {
|
||||
printf("stream read compare failed\n");
|
||||
wc_PKCS7_Free(pkcs7);
|
||||
return -9387;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* decode envelopedData */
|
||||
decodedSz = wc_PKCS7_DecodeAuthEnvelopedData(pkcs7, enveloped,
|
||||
envelopedSz, decoded,
|
||||
|
@ -88,11 +88,44 @@ enum PKCS7_TYPES {
|
||||
|
||||
enum PKCS7_STATE {
|
||||
WC_PKCS7_START = 0,
|
||||
|
||||
/* decode encrypted */
|
||||
WC_PKCS7_STAGE2,
|
||||
WC_PKCS7_STAGE3,
|
||||
WC_PKCS7_STAGE4,
|
||||
WC_PKCS7_STAGE5,
|
||||
WC_PKCS7_STAGE6
|
||||
WC_PKCS7_STAGE6,
|
||||
|
||||
/* parse info set */
|
||||
WC_PKCS7_INFOSET_START,
|
||||
WC_PKCS7_INFOSET_BER,
|
||||
WC_PKCS7_INFOSET_STAGE1,
|
||||
WC_PKCS7_INFOSET_STAGE2,
|
||||
WC_PKCS7_INFOSET_END,
|
||||
|
||||
/* decode auth enveloped */
|
||||
WC_PKCS7_AUTHENV_2,
|
||||
WC_PKCS7_AUTHENV_3,
|
||||
WC_PKCS7_AUTHENV_4,
|
||||
WC_PKCS7_AUTHENV_5,
|
||||
WC_PKCS7_AUTHENV_6,
|
||||
WC_PKCS7_AUTHENV_ATRB,
|
||||
WC_PKCS7_AUTHENV_ATRBEND,
|
||||
WC_PKCS7_AUTHENV_7,
|
||||
|
||||
/* decryption state types */
|
||||
WC_PKCS7_DECRYPT_KTRI,
|
||||
WC_PKCS7_DECRYPT_KTRI_2,
|
||||
WC_PKCS7_DECRYPT_KTRI_3,
|
||||
|
||||
|
||||
WC_PKCS7_DECRYPT_KARI,
|
||||
WC_PKCS7_DECRYPT_KEKRI,
|
||||
WC_PKCS7_DECRYPT_PWRI,
|
||||
WC_PKCS7_DECRYPT_ORI,
|
||||
|
||||
WC_PKCS7_DECRYPT_DONE,
|
||||
|
||||
};
|
||||
|
||||
enum Pkcs7_Misc {
|
||||
@ -235,7 +268,7 @@ typedef struct PKCS7 {
|
||||
#ifndef NO_PKCS7_STREAM
|
||||
PKCS7State* stream;
|
||||
#endif
|
||||
enum PKCS7_STATE state;
|
||||
word32 state;
|
||||
|
||||
/* !! NEW DATA MEMBERS MUST BE ADDED AT END !! */
|
||||
} PKCS7;
|
||||
|
Reference in New Issue
Block a user