From fc234b7b52af978e0bff0c79a8f685bf9ab839b0 Mon Sep 17 00:00:00 2001 From: Nick Child Date: Wed, 2 Nov 2022 15:23:39 -0500 Subject: [PATCH] test/pkcs7: Add Windows CRLF EOF to data files Windows tests are failing pkcs7 verification due to differnt line endings. Therefore, add make instuctions for building the data files with Windows EOF instead. As a result, regenerate other data files so that verification works. Add these CRLF EOF files to the exception in check_files to ignore the line endings. Signed-off-by: Nick Child --- tests/data_files/Makefile | 8 ++++++++ tests/data_files/pkcs7_data.bin | 2 +- tests/data_files/pkcs7_data_1.bin | 2 +- .../data_files/pkcs7_data_cert_encrypted.der | Bin 452 -> 452 bytes .../pkcs7_data_cert_signed_sha1.der | Bin 1276 -> 1276 bytes .../pkcs7_data_cert_signed_sha256.der | Bin 1284 -> 1284 bytes .../pkcs7_data_cert_signed_sha512.der | Bin 1284 -> 1284 bytes .../data_files/pkcs7_data_cert_signed_v2.der | Bin 1284 -> 1284 bytes .../pkcs7_data_cert_signeddata_sha256.der | Bin 1265 -> 1265 bytes .../pkcs7_data_multiple_certs_signed.der | Bin 2504 -> 2504 bytes .../data_files/pkcs7_data_multiple_signed.der | Bin 810 -> 810 bytes .../data_files/pkcs7_data_signed_badcert.der | Bin 1284 -> 1284 bytes .../pkcs7_data_signed_badsigner.der | Bin 1284 -> 1284 bytes .../pkcs7_data_without_cert_signed.der | Bin 435 -> 435 bytes .../pkcs7_signerInfo_issuer_invalid_size.der | Bin 1284 -> 1284 bytes .../pkcs7_signerInfo_serial_invalid_size.der | Bin 1284 -> 1284 bytes tests/scripts/check_files.py | 1 + tests/suites/test_suite_pkcs7.function | 2 +- 18 files changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/data_files/Makefile b/tests/data_files/Makefile index b92944ac2..581de256f 100644 --- a/tests/data_files/Makefile +++ b/tests/data_files/Makefile @@ -1136,6 +1136,14 @@ pkcs7_test_cert_1 = pkcs7-rsa-sha256-1.crt pkcs7_test_cert_2 = pkcs7-rsa-sha256-2.crt pkcs7_test_file = pkcs7_data.bin +$(pkcs7_test_file): + echo -e "Hello\xd" > $@ +all_final += $(pkcs7_test_file) + +pkcs7_data_1.bin: + echo -e "2\xd" > $@ +all_final += pkcs7_data_1.bin + # Generate signing cert pkcs7-rsa-sha256-1.crt: $(OPENSSL) req -x509 -subj="/C=NL/O=PKCS7/CN=PKCS7 Cert 1" -sha256 -nodes -days 365 -newkey rsa:2048 -keyout pkcs7-rsa-sha256-1.key -out pkcs7-rsa-sha256-1.crt diff --git a/tests/data_files/pkcs7_data.bin b/tests/data_files/pkcs7_data.bin index e965047ad..40ee26477 100644 --- a/tests/data_files/pkcs7_data.bin +++ b/tests/data_files/pkcs7_data.bin @@ -1 +1 @@ -Hello +Hello diff --git a/tests/data_files/pkcs7_data_1.bin b/tests/data_files/pkcs7_data_1.bin index 0cfbf0888..78c6baefd 100644 --- a/tests/data_files/pkcs7_data_1.bin +++ b/tests/data_files/pkcs7_data_1.bin @@ -1 +1 @@ -2 +2 diff --git a/tests/data_files/pkcs7_data_cert_encrypted.der b/tests/data_files/pkcs7_data_cert_encrypted.der index 763057d9e5eb7be478369ddaba4f227fbe94afee..b7b1c8331d7899a34c9abbc490fa8c4ab99bdd7a 100644 GIT binary patch delta 327 zcmV-N0l5Ce1H=Q6hJPE)4$EW?YqVdyJBdo8YIJN>@8BewJ9eM(4TYQQ9aJ%WnUhyT zu0wBXZAF(k)I=bfF&5Ngz4bntvBK`xfT>mKybF-i-VB{>XNRj_cMi`4q@dCXz|Q&a zUJ|2R1i6f_!mF56I>Vux-a@^!)qyZuS-crr7VqJeUl8=F@qfv%I;dNga5n+37D`p! zlMd~E)f0Vp%djr-#fG0}hO1!^>Uiy#0a{Kx80qW57A*pdd&Wf!6j5qlP^A5wG-0f; z|D7(H$zIIf1}|8b96=X*BtwW|+GPG(DYijRe8cy@LQ7h5t>bS!?@<`yH5dmoWeU delta 327 zcmV-N0l5Ce1H=Q6hJQ-Tx?Q-lfoV9)#(TQgCqeV@4tPO1&1tm13K>?sDR&@`&2;zq zr5b(IZ;8P9uP7ZhV};5Nx$P4TQ~I`OP-JZVFRwH$$g#@GLhNsw7*u)5+$5;%u?lI* z7{f#jt%@Bd*gWd-Mfq+qY7!9F!t%(f_BmMLJc+}gPe-SXVlKe-8=>1~dR{fL1YSk2nD0zG z1e1lidjeML9yt-&lcdkej*zP>Dvpa!;p-i({!UoRGkSWHP_PS{49*_fNF&2ebMTFu za%v$Ei*vw1bh%2l|Mv>FqOyh&-GTi&S#ZbEYa0&xp0+K0aLL7Hh7cW4f# zURfNN9epg{Ht*AKLnMtAH$e)jo`R1nP)0NcVMtOkw3hYdzCOt!YerQGGW1m{oBRn zm8U~%`C1I$PK8v5^MvUh3AZkwyfqsS&?zHlgr}nOEDx;tzGEP+vx+-qhFKS`eENmc QzTmdm((B?;p`Da(~G6eTla5aa}3e+TdY?AzX>u*U!F`1s)FqsZdS94=7(pdfic4sx2 z+HcM^&8>GPpt}N0t(j|x;LDhWOzT_=ZpTR3`Oa!=)Hj8Tthf|miYG7gq!q^Ce?736 Qhj;z#gj$!seGmdI&|Q3faR2}S delta 266 zcmV+l0rmcb3WN%<1O$I{DSOp1XllPgw3T39MJwPmwNGN;P;ouNbdNB^PBn^Ydp@&y zf_~rCV`|j6%}Wt}+Mh`7P%POP@ONK^020LC{{kel`lXyGo(6rimcy{?G=e+ua}_3S zH${UO(r_Uc<@#x779iFEy4^SN3+k?bjKnKni0W`Ju)(35*=v8sVrd>Df0!p!a3_vX z2}zlrY1q><0cnL?C&6~yTt156{cE(f?74bkzc47-0=d^&nj5ZFKyrM5 zHsVVNeEG4`6a{^9F{DH3O_C}~Qr;Q{o#u}tQ>utsbBEPGsdFEx@+cgWDr6MPk12B? Q6F)b8(@@Lv8sq{YTw`H;SO5S3 diff --git a/tests/data_files/pkcs7_data_cert_signed_sha512.der b/tests/data_files/pkcs7_data_cert_signed_sha512.der index 41849a943e54d4d08d0d1fdf9926f2c362fc986b..a4aa5875876de0170637190fe7e71da8bbd73ee6 100644 GIT binary patch delta 266 zcmV+l0rmcb3WN%<1O$IWxkRl)AS@Ao`ZoC;w%Vw76Q@b>Y0K5Kn{oXNP?Z`kesT;a zS>3BVN*QzSsoHr?1a0hzYtmYDw`udB8*#cr{u_NkM3rg=X|Sx+S(J*|A5FG3oOAgX zlH33xWKdE&+j*Q=1MuH4HlHEM-1CF|CQB1y%^Cs-#q@rC7a2eEB$hG&@m*)d1L9~p0fgJ|V- zKO|i_bomi{{JOd>3kGR5rUG7x`4Ga|@9gGRv&UU!Yx*EkquOUVOYzOxLul+8bbZkT ziFpTB$xFfP$=qBrsd#NQGF+4~^!v9I(F*JY9sy0<5=oE7T*-fjZ>o1=(l$1Be=Ak% z_-J$l*M6RG>)wY-UcvnHTBRpm{*ri57_CijJ&)Wb7bfqnpxZgQJEW?^!E!T{}_UWl>h($ diff --git a/tests/data_files/pkcs7_data_cert_signed_v2.der b/tests/data_files/pkcs7_data_cert_signed_v2.der index befd17c190253d2fc76833b5f6cc60b6a2742a2c..4f4cb047e079c550dc063ef53425dce81a5e31a3 100644 GIT binary patch delta 266 zcmV+l0rmcb3WN%<1O$Iu?AURY!QTIn!c37Sn^m*$X}ls_GHfwS8c}#}{uIbCzD`TW zJi0c?c6YQvXeXQL9(>B?;p`Da(~G6eTla5aa}3e+TdY?AzX>u*U!F`1s)FqsZdS94=7(pdfic4sx2 z+HcM^&8>GPpt}N0t(j|x;LDhWOzT_=ZpTR3`Oa!=)Hj8Tthf|miYG7gq!q^Ce?736 Qhj;z#gj$!seGmdI&|Q3faR2}S delta 266 zcmV+l0rmcb3WN%<1O$I{DSOp1XllPgw3T39MJwPmwNGN;P;ouNbdNB^PBn^Ydp@&y zf_~rCV`|j6%}Wt}+Mh`7P%POP@ONK^020LC{{kel`lXyGo(6rimcy{?G=e+ua}_3S zH${UO(r_Uc<@#x779iFEy4^SN3+k?bjKnKni0W`Ju)(35*=v8sVrd>Df0!p!a3_vX z2}zlrY1q><0cnL?C&6~yTt156{cE(f?74bkzc47-0=d^&nj5ZFKyrM5 zHsVVNeEG4`6a{^9F{DH3O_C}~Qr;Q{o#u}tQ>utsbBEPGsdFEx@+cgWDr6MPk12B? Q6F)b8(@@Lv8sq{YTw`H;SO5S3 diff --git a/tests/data_files/pkcs7_data_cert_signeddata_sha256.der b/tests/data_files/pkcs7_data_cert_signeddata_sha256.der index 85ea9f9fc1f29c7a68936a17ddf3825f10e9636f..cb7d75103daf5ed7cbaf0e2201458ca7c1fad8cf 100644 GIT binary patch delta 266 zcmV+l0rmdz3GoTA@dJNb?AURY!QTIn!c37Sn^m*$X}ls_GHfwS8c}#}{uIbCzD`TW zJi0c?c6YQvXeXQL9(>B?;p`Da(~G6eTla5aa}3e+TdY?AzX>u*U!F`1s)FqsZdS94=7(pdfic4sx2 z+HcM^&8>GPpt}N0t(j|x;LDhWOzT_=ZpTR3`Oa!=)Hj8Tthf|miYG7gq!q^Ce?736 Qhj;z#gj$!seGmdI&@It`H2?qr delta 266 zcmV+l0rmdz3GoTA@dJN!DSOp1XllPgw3T39MJwPmwNGN;P;ouNbdNB^PBn^Ydp@&y zf_~rCV`|j6%}Wt}+Mh`7P%POP@ONK^020LC{{kel`lXyGo(6rimcy{?G=e+ua}_3S zH${UO(r_Uc<@#x779iFEy4^SN3+k?bjKnKni0W`Ju)(35*=v8sVrd>Df0!p!a3_vX z2}zlrY1q><0cnL?C&6~yTt156{cE(f?74bkzc47-0=d^&nj5ZFKyrM5 zHsVVNeEG4`6a{^9F{DH3O_C}~Qr;Q{o#u}tQ>utsbBEPGsdFEx@+cgWDr6MPk12B? Q6F)b8(@@Lv8sq{YTr;+Q8~^|S diff --git a/tests/data_files/pkcs7_data_multiple_certs_signed.der b/tests/data_files/pkcs7_data_multiple_certs_signed.der index 69371ae202cfa21a20a1dfdaf11e115c4daa4ffa..4a237e9d145e0f4afedd8c3bcffb3bf146f96c4a 100644 GIT binary patch delta 529 zcmV+s0`C3D6UY;=Q3rop?AURY!QTIn!c37Sn^m*$X}ls_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Va+UFC)6xlZ(!qi17hqRXncwl-vo0Cu|7 z&GF!uK&2C4>-vww6cd(|;$YQI9Xm0(^)E8sM>Ph#LuaXrFxk1)heHHv9_KC^j( ze&5w&YSg&ROA&tBpGfXdEZG?FcVC7862#yC0wlBgrJN|927R=a!?5c#f;;eY6((&r zMS~d9a3L4v`e|ntAl3o8-8baKu{#4BHj>ToZx!J(VkYk$UKX&xhgm?uk@e{yjhnpvYqYiOxq4#1Feupqxz|~m8?IGAa(sX` z;!6m8`LWUz1$}Zcq(kXVk}674-Wmp-=8q#&s)$;1ht)r+b04YlC>)b2WE9JfDRUqb zKR15UP|NcgZN{+F&q)V$;=K`E_uLJ=BpwhMP|$yp+n#k}G+}v0`4NNxU>SQKtjF zhGLsqxx*LkZB9X4AHb?>SEMlbakt^j9y0a5wBlO9B?;p`Da(~G6eTla5aa}3e+TdY?AzX>u*U!F`1s)FqsZdS94=7(pdfic4sx2 z+HcM^&8>GPpt}N0t(j|x;LDhWOzT_=ZpTR3`Oa!=)Hj8Tthf|miYG7gq!q^Ce?736 Qhj;z#gj$!seGmdI&|Q3faR2}S delta 266 zcmV+l0rmcb3WN%<1O$I{DSOp1XllPgw3T39MJwPmwNGN;P;ouNbdNB^PBn^Ydp@&y zf_~rCV`|j6%}Wt}+Mh`7P%POP@ONK^020LC{{kel`lXyGo(6rimcy{?G=e+ua}_3S zH${UO(r_Uc<@#x779iFEy4^SN3+k?bjKnKni0W`Ju)(35*=v8sVrd>Df0!p!a3_vX z2}zlrY1q><0cnL?C&6~yTt156{cE(f?74bkzc47-0=d^&nj5ZFKyrM5 zHsVVNeEG4`6a{^9F{DH3O_C}~Qr;Q{o#u}tQ>utsbBEPGsdFEx@+cgWDr6MPk12B? Q6F)b8(@@Lv8sq{YTw`H;SO5S3 diff --git a/tests/data_files/pkcs7_data_signed_badsigner.der b/tests/data_files/pkcs7_data_signed_badsigner.der index aff1448728d2d6f7dd2cf447251fe08cf7ac28e8..aa5447c44d27f7f4ccb8239e0598699a0055f9db 100644 GIT binary patch delta 266 zcmV+l0rmcb3WN%<1O$Iu?AURY!QTIn!c37Sn^m*$X}ls_GHfwS8c}#}{uIbCzD`TW zJi0c?c6YQvXeXQL9(>B?;p`Da(~G6eTla5aa}3e+TdY?AzX>u*U!F`1s)FqsZdS94=7(pdfic4sx2 z+HcM^&8>GPpt}N0t(j|x;LDhWOzT_=ZpTR3`Oa!=)Hj8Tthf|miYG7gq!q^Ce?736 Qhj;z#gj$!seGmdI&|Q3faR2}S delta 266 zcmV+l0rmcb3WN%<1O$I{DSOp1XllPgw3T39MJwPmwNGN;P;ouNbdNB^PBn^Ydp@&y zf_~rCV`|j6%}Wt}+Mh`7P%POP@ONK^020LC{{kel`lXyGo(6rimcy{?G=e+ua}_3S zH${UO(r_Uc<@#x779iFEy4^SN3+k?bjKnKni0W`Ju)(35*=v8sVrd>Df0!p!a3_vX z2}zlrY1q><0cnL?C&6~yTt156{cE(f?74bkzc47-0=d^&nj5ZFKyrM5 zHsVVNeEG4`6a{^9F{DH3O_C}~Qr;Q{o#u}tQ>utsbBEPGsdFEx@+cgWDr6MPk12B? Q6F)b8(@@Lv8sq{YTw`H;SO5S3 diff --git a/tests/data_files/pkcs7_data_without_cert_signed.der b/tests/data_files/pkcs7_data_without_cert_signed.der index dbff326ad33bb0fbedf6716cfa01f015537a8572..b47fe927e5b427158e0d5f27002e6e1ca885dd63 100644 GIT binary patch delta 265 zcmV+k0rvj01G58=vwvIc*m0G?-v5xoOpzv=RkQGEydqpOY%xq4QFw3u6v!~XPD{r; zx;DvnceFuhC!6UWeBXQ-IBMb;VsV`lqoDurfIUVDV)D(XHxz`2GE&3W1x>gVJ}U?s zI2P>)1jZ%ITknV#A(nGR1^b7L;jSpEWbXEmAH zZ_YK%t#>A%y8=wDnQMsP%b0~s>s$+N$4J@v&T4GbH-(F=xD;WECol7)6~^FyJ+PRE Pcm3>yT9?0l5CSdGJ5+y6 delta 265 zcmV+k0rvj01G58=vww6cd(|;$YQI9Xm0(^)E8sM>Ph#LuaXrFxk1)heHHv9_KC^j( ze&5w&YSg&ROA&tBpGfXdEZG?FcVC7862#yC0wlBgrJN|927R=a!?5c#f;;eY6((&r zMS~d9a3L4v`e|ntAl3o8-8baKu{#4BHj>ToZx!J(VkYk$UKX&xhgm?uk@e{yjhnpvYqYiOxq4#1Feupqxz|~m8?IGAa(sX` z;!6m8`LWUz1$}Zcq(kXVk}674-Wmp-=8q#&s)$;1ht)r+b04YlC>)b2WE9JfDRUqb PKR15UP|NcgB?;p`Da(~G6eTla5aa}3e+TdY?AzX>u*U!F`1s)FqsZdS94=7(pdfic4sx2 z+HcM^&8>GPpt}N0t(j|x;LDhWOzT_=ZpTR3`Oa!=)Hj8Tthf|miYG7gq!q^Ce?736 Qhj;z#gj$!seGmdI&|Q3faR2}S delta 266 zcmV+l0rmcb3WN%<1O$I{DSOp1XllPgw3T39MJwPmwNGN;P;ouNbdNB^PBn^Ydp@&y zf_~rCV`|j6%}Wt}+Mh`7P%POP@ONK^020LC{{kel`lXyGo(6rimcy{?G=e+ua}_3S zH${UO(r_Uc<@#x779iFEy4^SN3+k?bjKnKni0W`Ju)(35*=v8sVrd>Df0!p!a3_vX z2}zlrY1q><0cnL?C&6~yTt156{cE(f?74bkzc47-0=d^&nj5ZFKyrM5 zHsVVNeEG4`6a{^9F{DH3O_C}~Qr;Q{o#u}tQ>utsbBEPGsdFEx@+cgWDr6MPk12B? Q6F)b8(@@Lv8sq{YTw`H;SO5S3 diff --git a/tests/data_files/pkcs7_signerInfo_serial_invalid_size.der b/tests/data_files/pkcs7_signerInfo_serial_invalid_size.der index 2db359072b44bcabbecbc1d0cae2c647c2406131..f4b4e384dbfc145a6c0382f71b51c8718701eb1c 100644 GIT binary patch delta 266 zcmV+l0rmcb3WN%<1O$Iu?AURY!QTIn!c37Sn^m*$X}ls_GHfwS8c}#}{uIbCzD`TW zJi0c?c6YQvXeXQL9(>B?;p`Da(~G6eTla5aa}3e+TdY?AzX>u*U!F`1s)FqsZdS94=7(pdfic4sx2 z+HcM^&8>GPpt}N0t(j|x;LDhWOzT_=ZpTR3`Oa!=)Hj8Tthf|miYG7gq!q^Ce?736 Qhj;z#gj$!seGmdI&|Q3faR2}S delta 266 zcmV+l0rmcb3WN%<1O$I{DSOp1XllPgw3T39MJwPmwNGN;P;ouNbdNB^PBn^Ydp@&y zf_~rCV`|j6%}Wt}+Mh`7P%POP@ONK^020LC{{kel`lXyGo(6rimcy{?G=e+ua}_3S zH${UO(r_Uc<@#x779iFEy4^SN3+k?bjKnKni0W`Ju)(35*=v8sVrd>Df0!p!a3_vX z2}zlrY1q><0cnL?C&6~yTt156{cE(f?74bkzc47-0=d^&nj5ZFKyrM5 zHsVVNeEG4`6a{^9F{DH3O_C}~Qr;Q{o#u}tQ>utsbBEPGsdFEx@+cgWDr6MPk12B? Q6F)b8(@@Lv8sq{YTw`H;SO5S3 diff --git a/tests/scripts/check_files.py b/tests/scripts/check_files.py index a0f5e1f53..50af88a6b 100755 --- a/tests/scripts/check_files.py +++ b/tests/scripts/check_files.py @@ -119,6 +119,7 @@ BINARY_FILE_PATH_RE_LIST = [ r'tests/data_files/.*\.req\.[^/]+\Z', r'tests/data_files/.*malformed[^/]+\Z', r'tests/data_files/format_pkcs12\.fmt\Z', + r'tests/data_files/pkcs7_data.*\.bin\Z', ] BINARY_FILE_PATH_RE = re.compile('|'.join(BINARY_FILE_PATH_RE_LIST)) diff --git a/tests/suites/test_suite_pkcs7.function b/tests/suites/test_suite_pkcs7.function index c5094bcca..a1de9998d 100644 --- a/tests/suites/test_suite_pkcs7.function +++ b/tests/suites/test_suite_pkcs7.function @@ -150,7 +150,7 @@ void pkcs7_verify_multiple_signers( char *pkcs7_file, char *crt1, char *crt2, ch res = stat( filetobesigned, &st ); TEST_ASSERT( res == 0 ); - file = fopen( filetobesigned, "r" ); + file = fopen( filetobesigned, "rb" ); TEST_ASSERT( file != NULL ); datalen = st.st_size;