summaryrefslogtreecommitdiff
path: root/common/base32.c
Commit message (Collapse)AuthorAgeFilesLines
* common: Sort header filesJeremy Bettis2022-11-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | Sort all includes in common with the clang-format rules used by the zephyr project. BRANCH=None BUG=b:247100970 TEST=zmake build -a TEST=./twister --clobber -v -i TEST=make -j72 buildall_only runtests TEST=zmake compare-builds -a Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I70c2ed7bb2ce50c968f3e2dbdc274de3a455129a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4049889 Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Tomasz Michalec <tmichalec@google.com> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* Update license boilerplate text in source code filesMike Frysinger2022-09-121-1/+1
| | | | | | | | | | | | | | | Normally we don't do this, but enough changes have accumulated that we're doing a tree-wide one-off update of the name & style. BRANCH=none BUG=chromium:1098010 TEST=`repo upload` works Change-Id: Icd3a1723c20595356af83d190b2c6a9078b3013b Signed-off-by: Mike Frysinger <vapier@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891203 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* common/base32.c: Format with clang-formatJack Rosenthal2022-06-281-15/+12
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I0ecfcd0b4a83b5feb010e80af70231807716899f Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3729607 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* Avoid passing char values to ctype functionsSimon Glass2021-02-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With Zephyr's newlib we get a warning when trying to do this, since it includes the following note in: /opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi/include/ctype.h "These macros are intentionally written in a manner that will trigger a gcc -Wall warning if the user mistakenly passes a 'char' instead of an int containing an 'unsigned char'." Presumably this is so characters above ASCII 127 are handled correctly, even if these are seldom used. Update the few affected call sites to ensure the value is cast to an unsigned char so that it will not fall afoul of the newlib warning. Note that the ECOS version of the ctype functions does not make use of an array, so does not suffer from failure if negative values are passed. Still, it is harmless to fix it. BUG=b:180023514 BRANCH=none TEST=build zephyr volteer with CONFIG_NEWLIB_LIBC and see no warnings Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ieae2fab8c20b75baa46d01dd8cdb393c6bb5c2c2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2691413 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* common: Substitute modified CRC8 with CRC-5-USBSam Hurst2017-09-121-15/+13
| | | | | | | | | | | | | | | | | | | | The modified CRC8 implementation didn't detect some errors. For example, using the modified CRC8: CC5QQLALU and DC5QQLALU calculates to the same value. BUG=b:37952913 BRANCH=none TEST=make buildall Used online CRC-5-USB calculator to test several values against this implementation. Signed-off-by: Sam Hurst <shurst@chromium.org> Change-Id: I5a17941e25691872a25b41525f65f36e2ed1d4fa Reviewed-on: https://chromium-review.googlesource.com/660812 Commit-Ready: Sam Hurst <shurst@google.com> Tested-by: Sam Hurst <shurst@google.com> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Michael Tang <ntang@chromium.org>
* common: Add base32 encodingRandall Spangler2017-06-281-0/+177
Base32 encoding is used to turn the RMA reset binary challenge/response into less-typo-prone text, at 5 bits per character. BUG=b:37952913 BRANCH=none TEST=make runtests Change-Id: I474750a20204ba353cea1e91982aa03e8071c0c2 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/544177 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>