Home
last modified time | relevance | path

Searched refs:bufUsed (Results 1 – 4 of 4) sorted by relevance

/device/google/contexthub/util/nanoapp_encr/
Dnanoapp_encr.c56 static int handleEncrypt(uint8_t **pbuf, uint32_t bufUsed, FILE *out, uint64_t keyId, uint32_t *key) in handleEncrypt() argument
82 if (bufUsed <= sizeof(*image)) { in handleEncrypt()
87 encr.dataLen = bufUsed; in handleEncrypt()
89 if (((bufUsed - sizeof(*image)) % AES_BLOCK_SIZE) != 0) in handleEncrypt()
90 padLen = AES_BLOCK_SIZE - ((bufUsed - sizeof(*image)) % AES_BLOCK_SIZE); in handleEncrypt()
93 reallocOrDie(buf, bufUsed + padLen); in handleEncrypt()
94 rand_bytes(buf + bufUsed, padLen); in handleEncrypt()
95 bufUsed += padLen; in handleEncrypt()
96 fprintf(stderr, "Padded to %" PRIu32 " bytes\n", bufUsed); in handleEncrypt()
102 if (bufUsed >= sizeof(*image) && image->aosp.magic == NANOAPP_AOSP_MAGIC && in handleEncrypt()
[all …]
/device/google/contexthub/util/nanoapp_sign/
Dnanoapp_sign.c191 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()
[all …]
/device/google/contexthub/util/nanoapp_postprocess/
Dpostprocess_elf.c229 static int finalizeAndWrite(uint8_t *buf, uint32_t bufUsed, uint32_t bufSz, FILE *out, uint32_t lay… in finalizeAndWrite() argument
257 assertMem(bufUsed + hdrDiff, bufSz); in finalizeAndWrite()
259 memmove(buf + dataOffset, buf + sizeof(*bin), bufUsed - sizeof(*bin)); in finalizeAndWrite()
260 bufUsed += hdrDiff; in finalizeAndWrite()
266 if (bufUsed) { in finalizeAndWrite()
272 fprintf(stderr,"Final binary size %" PRIu32 " bytes\n", bufUsed); in finalizeAndWrite()
284 ret = fwrite(buf, bufUsed, 1, out) == 1 ? 0 : 2; in finalizeAndWrite()
291 static int handleApp(uint8_t **pbuf, uint32_t bufUsed, FILE *out, uint32_t layoutFlags, uint64_t ap… in handleApp() argument
303 uint32_t bufSz = bufUsed * 3 /2; in handleApp()
311 if (bufUsed < sizeof(*bin)) { in handleApp()
[all …]
Dpostprocess.c403 static int handleApp(uint8_t **pbuf, uint32_t bufUsed, FILE *out, uint32_t layoutFlags, uint64_t ap… in handleApp() argument
410 uint32_t bufSz = bufUsed * 3 /2; in handleApp()
419 if (bufUsed < sizeof(*bin)) { in handleApp()
420 ERR("File size too small: %" PRIu32, bufUsed); in handleApp()
447 app.symtabSize = (struct SymtabEntry*)(buf + bufUsed) - app.symtab; in handleApp()
450 app.dataSizeUsed = bufUsed; in handleApp()
462 if (app.symtabSize * sizeof(struct SymtabEntry) + sect->rel_end != bufUsed + FLASH_BASE) { in handleApp()
573 static int handleKey(uint8_t **pbuf, uint32_t bufUsed, FILE *out, uint32_t layoutFlags, uint64_t ap… in handleKey() argument
595 good = good && fwrite(buf, bufUsed, 1, out) == 1; in handleKey()
600 static int handleOs(uint8_t **pbuf, uint32_t bufUsed, FILE *out, uint32_t layoutFlags, bool bare) in handleOs() argument
[all …]