Lines Matching refs:boot

57 StartDecryption(struct boot_data *boot)  in StartDecryption()  argument
59 boot->Cryptor = CRYPT_STARTTERM; in StartDecryption()
70 DecryptBuf(struct boot_data *boot, int cnt) in DecryptBuf() argument
72 uchar *bufp = boot->buf.BootBuf; in DecryptBuf()
75 boot->Cryptor = (boot->Cryptor >> 1) ^ ((boot->Cryptor & 1U) ? CRYPT_FEEDTERM : 0); in DecryptBuf()
76 *bufp++ ^= (uchar) boot->Cryptor; in DecryptBuf()
87 struct boot_data *boot = card->boot; /* pointer to boot specific data */ in pof_handle_data() local
93 switch (boot->pof_recid) { in pof_handle_data()
97 hysdn_addlog(card, "POF created %s", boot->buf.PofTime.DateTimeText); in pof_handle_data()
101 DecryptBuf(boot, datlen); /* we need to encrypt the buffer */ in pof_handle_data()
105 (boot->pof_recid == TAG_CBOOTDTA) ? "CBOOTDATA" : "BOOTDTA", in pof_handle_data()
106 datlen, boot->pof_recoffset); in pof_handle_data()
108 if (boot->pof_reclen != POF_BOOT_LOADER_TOTAL_SIZE) { in pof_handle_data()
109 boot->last_error = EPOF_BAD_IMG_SIZE; /* invalid length */ in pof_handle_data()
110 return (boot->last_error); in pof_handle_data()
112 imgp = boot->buf.BootBuf; /* start of buffer */ in pof_handle_data()
116 (boot->pof_recoffset & (POF_BOOT_LOADER_PAGE_SIZE - 1)); in pof_handle_data()
131 if ((boot->last_error = in pof_handle_data()
133 (boot->pof_recoffset > POF_BOOT_LOADER_PAGE_SIZE) ? 2 : 0)) < 0) in pof_handle_data()
134 return (boot->last_error); in pof_handle_data()
139 DecryptBuf(boot, datlen); /* we need to encrypt the buffer */ in pof_handle_data()
143 (boot->pof_recid == TAG_CABSDATA) ? "CABSDATA" : "ABSDATA", in pof_handle_data()
144 datlen, boot->pof_recoffset); in pof_handle_data()
146 if ((boot->last_error = card->writebootseq(card, boot->buf.BootBuf, datlen)) < 0) in pof_handle_data()
147 return (boot->last_error); /* error writing data */ in pof_handle_data()
149 if (boot->pof_recoffset + datlen >= boot->pof_reclen) in pof_handle_data()
156 hysdn_addlog(card, "POF got data(id=0x%lx) len=%d offs=0x%lx", boot->pof_recid, in pof_handle_data()
157 datlen, boot->pof_recoffset); in pof_handle_data()
176 struct boot_data *boot = card->boot; /* pointer to boot specific data */ in pof_write_buffer() local
178 if (!boot) in pof_write_buffer()
180 if (boot->last_error < 0) in pof_write_buffer()
181 return (boot->last_error); /* repeated error */ in pof_write_buffer()
186 switch (boot->pof_state) { in pof_write_buffer()
192 boot->last_error = -EPOF_INTERNAL; in pof_write_buffer()
195 if (boot->buf.PofFileHdr.Magic != TAGFILEMAGIC) { in pof_write_buffer()
196 boot->last_error = -EPOF_BAD_MAGIC; in pof_write_buffer()
200 boot->Nrecs = (word) (boot->buf.PofFileHdr.N_PofRecs); /* limited to 65535 */ in pof_write_buffer()
201 boot->pof_state = POF_READ_TAG_HEAD; /* now start with single tags */ in pof_write_buffer()
202 boot->last_error = sizeof(tPofRecHdr); /* new length */ in pof_write_buffer()
210 boot->last_error = -EPOF_INTERNAL; in pof_write_buffer()
213 boot->pof_recid = boot->buf.PofRecHdr.PofRecId; /* actual pof recid */ in pof_write_buffer()
214 boot->pof_reclen = boot->buf.PofRecHdr.PofRecDataLen; /* total length */ in pof_write_buffer()
215 boot->pof_recoffset = 0; /* no starting offset */ in pof_write_buffer()
219 boot->pof_recid, boot->pof_reclen); in pof_write_buffer()
221 boot->pof_state = POF_READ_TAG_DATA; /* now start with tag data */ in pof_write_buffer()
222 if (boot->pof_reclen < BOOT_BUF_SIZE) in pof_write_buffer()
223 boot->last_error = boot->pof_reclen; /* limit size */ in pof_write_buffer()
225 boot->last_error = BOOT_BUF_SIZE; /* maximum */ in pof_write_buffer()
227 if (!boot->last_error) { /* no data inside record */ in pof_write_buffer()
228 boot->pof_state = POF_READ_TAG_HEAD; /* now start with single tags */ in pof_write_buffer()
229 boot->last_error = sizeof(tPofRecHdr); /* new length */ in pof_write_buffer()
237 if (datlen != boot->last_error) { in pof_write_buffer()
238 boot->last_error = -EPOF_INTERNAL; in pof_write_buffer()
241 if ((boot->last_error = pof_handle_data(card, datlen)) < 0) in pof_write_buffer()
242 return (boot->last_error); /* an error occurred */ in pof_write_buffer()
243 boot->pof_recoffset += datlen; in pof_write_buffer()
244 if (boot->pof_recoffset >= boot->pof_reclen) { in pof_write_buffer()
245 boot->pof_state = POF_READ_TAG_HEAD; /* now start with single tags */ in pof_write_buffer()
246 boot->last_error = sizeof(tPofRecHdr); /* new length */ in pof_write_buffer()
248 if (boot->pof_reclen - boot->pof_recoffset < BOOT_BUF_SIZE) in pof_write_buffer()
249 boot->last_error = boot->pof_reclen - boot->pof_recoffset; /* limit size */ in pof_write_buffer()
251 boot->last_error = BOOT_BUF_SIZE; /* maximum */ in pof_write_buffer()
256 boot->last_error = -EPOF_INTERNAL; /* unknown state */ in pof_write_buffer()
260 return (boot->last_error); in pof_write_buffer()
273 struct boot_data *boot; /* pointer to boot specific data */ in pof_write_open() local
275 if (card->boot) { in pof_write_open()
281 if (!(boot = kmalloc(sizeof(struct boot_data), GFP_KERNEL))) { in pof_write_open()
286 card->boot = boot; in pof_write_open()
288 memset(boot, 0, sizeof(struct boot_data)); in pof_write_open()
294 boot->last_error = -ERR_BOARD_DPRAM; in pof_write_open()
296 return (boot->last_error); in pof_write_open()
298 boot->BufSize = 0; /* Buffer is empty */ in pof_write_open()
299 boot->pof_state = POF_READ_FILE_HEAD; /* read file header */ in pof_write_open()
300 StartDecryption(boot); /* if POF File should be encrypted */ in pof_write_open()
305 *bufp = boot->buf.BootBuf; /* point to buffer */ in pof_write_open()
316 struct boot_data *boot = card->boot; /* pointer to boot specific data */ in pof_write_close() local
318 if (!boot) in pof_write_close()
321 card->boot = NULL; /* no boot active */ in pof_write_close()
322 kfree(boot); in pof_write_close()