Skip to content

Commit 7ae2ecc

Browse files
committed
fixup! Implement OCSP responder
1 parent 3be004f commit 7ae2ecc

1 file changed

Lines changed: 26 additions & 25 deletions

File tree

wolfcrypt/src/asn.c

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -39152,7 +39152,7 @@ WC_MAYBE_UNUSED static int EncodeCertID(OcspEntry* entry, byte* out,
3915239152
#else
3915339153
DECL_ASNSETDATA(dataASN, certidasn_Length);
3915439154
int ret = 0;
39155-
int sz = 0;
39155+
word32 sz = 0;
3915639156
word32 digestSz = 0;
3915739157

3915839158
if (entry == NULL || entry->status == NULL ||
@@ -39182,11 +39182,12 @@ WC_MAYBE_UNUSED static int EncodeCertID(OcspEntry* entry, byte* out,
3918239182
ret = SizeASN_Items(certIDASNItems, dataASN, certidasn_Length, &sz);
3918339183
}
3918439184
/* Check buffer big enough for encoding if supplied. */
39185-
if (ret == 0 && out != NULL && sz > (int)*outSz) {
39185+
if (ret == 0 && out != NULL && sz > *outSz) {
3918639186
ret = BUFFER_E;
3918739187
}
3918839188
if (ret == 0 && out != NULL)
39189-
if (SetASN_Items(certIDASNItems, dataASN, certidasn_Length, out) != sz)
39189+
if (SetASN_Items(certIDASNItems, dataASN, certidasn_Length, out) !=
39190+
(int)sz)
3919039191
ret = ASN_PARSE_E;
3919139192
if (ret == 0)
3919239193
*outSz = sz;
@@ -39322,7 +39323,7 @@ WC_MAYBE_UNUSED static int EncodeSingleResponse(OcspEntry* single, byte* out,
3932239323
#else
3932339324
DECL_ASNSETDATA(dataASN, singleResponseASN_Length);
3932439325
int ret = 0;
39325-
int sz = 0;
39326+
word32 sz = 0;
3932639327
word32 cidSz = 0;
3932739328

3932839329
if (single == NULL ||
@@ -39414,11 +39415,11 @@ WC_MAYBE_UNUSED static int EncodeSingleResponse(OcspEntry* single, byte* out,
3941439415
singleResponseASN_Length, &sz);
3941539416
}
3941639417
/* Check buffer big enough for encoding if supplied. */
39417-
if (ret == 0 && out != NULL && sz > (int)*outSz)
39418+
if (ret == 0 && out != NULL && sz > *outSz)
3941839419
ret = BUFFER_E;
3941939420
if (ret == 0 && out != NULL) {
39420-
if (SetASN_Items(singleResponseASN, dataASN, singleResponseASN_Length,
39421-
out) != sz)
39421+
if (SetASN_Items(singleResponseASN, dataASN,
39422+
singleResponseASN_Length, out) != (int)sz)
3942239423
ret = ASN_PARSE_E;
3942339424
if (ret == 0) {
3942439425
ret = EncodeCertID(single,
@@ -39885,7 +39886,7 @@ WC_MAYBE_UNUSED static int EncodeOcspRespExtensions(OcspResponse* resp,
3988539886
return NOT_COMPILED_IN;
3988639887
#else
3988739888
DECL_ASNSETDATA(dataASN, ocspNonceExtASN_Length);
39888-
int sz = 0;
39889+
word32 sz = 0;
3988939890
int ret = 0;
3989039891

3989139892
if (resp == NULL || outSz == NULL) {
@@ -39904,12 +39905,12 @@ WC_MAYBE_UNUSED static int EncodeOcspRespExtensions(OcspResponse* resp,
3990439905
ocspNonceExtASN_Length, &sz);
3990539906
}
3990639907
/* Check buffer big enough for encoding if supplied. */
39907-
if (ret == 0 && out != NULL && sz > (int)*outSz) {
39908+
if (ret == 0 && out != NULL && sz > *outSz) {
3990839909
ret = BUFFER_E;
3990939910
}
3991039911
if (ret == 0 && out != NULL) {
39911-
if (SetASN_Items(ocspNonceExtASN, dataASN, ocspNonceExtASN_Length,
39912-
out) != sz)
39912+
if (SetASN_Items(ocspNonceExtASN, dataASN,
39913+
ocspNonceExtASN_Length, out) != (int)sz)
3991339914
ret = ASN_PARSE_E;
3991439915
}
3991539916
if (ret == 0)
@@ -39971,7 +39972,7 @@ WC_MAYBE_UNUSED static int EncodeResponseData(OcspResponse* resp, byte* out,
3997139972
#else
3997239973
DECL_ASNSETDATA(dataASN, ocspRespDataASN_Length);
3997339974
int ret = 0;
39974-
int sz = 0;
39975+
word32 sz = 0;
3997539976
word32 respListSz = 0;
3997639977
word32 respExtSz = 0;
3997739978
OcspEntry* single = NULL;
@@ -40044,12 +40045,12 @@ WC_MAYBE_UNUSED static int EncodeResponseData(OcspResponse* resp, byte* out,
4004440045
&sz);
4004540046
}
4004640047
/* Check buffer big enough for encoding if supplied. */
40047-
if (ret == 0 && out != NULL && sz > (int)*outSz)
40048+
if (ret == 0 && out != NULL && sz > *outSz)
4004840049
ret = BUFFER_E;
4004940050
if (ret == 0 && out != NULL) {
4005040051
byte* respList = NULL;
40051-
if (SetASN_Items(ocspRespDataASN, dataASN, ocspRespDataASN_Length, out)
40052-
!= sz)
40052+
if (SetASN_Items(ocspRespDataASN, dataASN,
40053+
ocspRespDataASN_Length, out) != (int)sz)
4005340054
ret = ASN_PARSE_E;
4005440055
respList = (byte*)dataASN[OCSPRESPDATAASN_IDX_RESP].data.buffer.data;
4005540056
for (single = resp->single; ret == 0 && single != NULL;
@@ -40563,7 +40564,7 @@ WC_MAYBE_UNUSED static int EncodeBasicOcspResponse(OcspResponse* resp,
4056340564
#else
4056440565
DECL_ASNSETDATA(dataASN, ocspBasicRespASN_Length);
4056540566
int ret = 0;
40566-
int sz = 0;
40567+
word32 sz = 0;
4056740568
word32 respDataSz = 0;
4056840569
word32 sigSz = 0;
4056940570

@@ -40656,8 +40657,8 @@ WC_MAYBE_UNUSED static int EncodeBasicOcspResponse(OcspResponse* resp,
4065640657
ocspBasicRespASN_Length, &sz);
4065740658
}
4065840659
if (ret == 0) {
40659-
if (SetASN_Items(ocspBasicRespASN, dataASN, ocspBasicRespASN_Length,
40660-
out) != sz)
40660+
if (SetASN_Items(ocspBasicRespASN, dataASN,
40661+
ocspBasicRespASN_Length, out) != (int)sz)
4066140662
ret = ASN_PARSE_E;
4066240663
}
4066340664
}
@@ -40981,7 +40982,7 @@ int OcspResponseEncode(OcspResponse* resp, byte* out, word32* outSz,
4098140982
#else
4098240983
DECL_ASNSETDATA(dataASN, ocspResponseASN_Length);
4098340984
int ret = 0;
40984-
int sz = 0;
40985+
word32 sz = 0;
4098540986
word32 basicRespSz = 0;
4098640987

4098740988
WOLFSSL_ENTER("OcspResponseEncode");
@@ -41025,11 +41026,11 @@ int OcspResponseEncode(OcspResponse* resp, byte* out, word32* outSz,
4102541026
ret = SizeASN_Items(ocspResponseASN, dataASN,
4102641027
ocspResponseASN_Length, &sz);
4102741028
}
41028-
if (ret == 0 && sz > (int)*outSz)
41029+
if (ret == 0 && sz > *outSz)
4102941030
ret = BUFFER_E;
4103041031
if (ret == 0) {
4103141032
if (SetASN_Items(ocspResponseASN, dataASN,
41032-
ocspResponseASN_Length, out) != sz)
41033+
ocspResponseASN_Length, out) != (int)sz)
4103341034
ret = ASN_PARSE_E;
4103441035
}
4103541036
}
@@ -41041,17 +41042,17 @@ int OcspResponseEncode(OcspResponse* resp, byte* out, word32* outSz,
4104141042
ocspResponseASN_Length);
4104241043
ret = SizeASN_Items(ocspResponseASN, dataASN, ocspResponseASN_Length,
4104341044
&sz);
41044-
if (ret == 0 && out != NULL && sz > (int)*outSz)
41045+
if (ret == 0 && out != NULL && sz > *outSz)
4104541046
ret = BUFFER_E;
4104641047
if (ret == 0 && out != NULL) {
41047-
if (SetASN_Items(ocspResponseASN, dataASN, ocspResponseASN_Length,
41048-
out) != sz)
41048+
if (SetASN_Items(ocspResponseASN, dataASN,
41049+
ocspResponseASN_Length, out) != (int)sz)
4104941050
ret = ASN_PARSE_E;
4105041051
}
4105141052
}
4105241053

4105341054
if (ret == 0)
41054-
*outSz = (word32)sz;
41055+
*outSz = sz;
4105541056
FREE_ASNSETDATA(dataASN, resp->heap);
4105641057
return ret;
4105741058
#endif

0 commit comments

Comments
 (0)