Lines Matching refs:bufUsed

191 static int handleConvertKey(uint8_t **pbuf, uint32_t bufUsed, FILE *out, struct RsaData *rsa)  in handleConvertKey()  argument
203 c = getHexEncodedByte(buf, &pos, bufUsed); in handleConvertKey()
226 static int handleVerify(uint8_t **pbuf, uint32_t bufUsed, struct RsaData *rsa, bool verbose, bool b… in handleVerify() argument
242 if (bufUsed < (sizeof(*image) + sizeof(*secHdr))) { in handleVerify()
249 secHdr->appDataLen, bufUsed, bufUsed - secHdr->appDataLen); in handleVerify()
255 sigData = bufUsed - (secHdr->appDataLen + sizeof(*image) + sizeof(*secHdr)); in handleVerify()
262 sha2processBytes(&shaState, buf, bufUsed - sigData); in handleVerify()
264 sigPack = buf + bufUsed - sigData; in handleVerify()
286 uint8_t *sigPack = buf + bufUsed - SIGNATURE_BLOCK_SIZE; in handleVerify()
289 if (bufUsed > SIGNATURE_BLOCK_SIZE) { in handleVerify()
291 sha2processBytes(&shaState, buf, bufUsed - SIGNATURE_BLOCK_SIZE); in handleVerify()
316 static int handleSign(uint8_t **pbuf, uint32_t bufUsed, FILE *out, struct RsaData *rsa, bool verbos… in handleSign() argument
331 buf = reallocOrDie(buf, bufUsed + grow); in handleSign()
338 memmove((uint8_t*)&image[1] + grow, &image[1], bufUsed - sizeof(*image)); in handleSign()
339 secHdr->appDataLen = bufUsed - sizeof(*image); in handleSign()
340 bufUsed += grow; in handleSign()
343 sha2processBytes(&shaState, buf, bufUsed); in handleSign()
345 int sigSz = bufUsed - sizeof(*image) - sizeof(*secHdr) - secHdr->appDataLen; in handleSign()
355 sha2processBytes(&shaState, buf + bufUsed- RSA_BYTES, RSA_BYTES); in handleSign()
361 sha2processBytes(&shaState, buf, bufUsed); in handleSign()
393 fwrite(buf, 1, bufUsed, out); in handleSign()
423 uint32_t bufUsed = 0; in main() local
518 buf = loadFile(posArg[0], &bufUsed); in main()
519 fprintf(stderr, "Read %" PRIu32 " bytes\n", bufUsed); in main()
523 if (bufUsed >= sizeof(*image) && in main()
542 ret = handleSign(&buf, bufUsed, out, &rsa, verbose, bareData); in main()
544 ret = handleVerify(&buf, bufUsed, &rsa, verbose, bareData); in main()
546 ret = handleConvertKey(&buf, bufUsed, out, &rsa); in main()