History log of /external/vboot_reference/cgpt/cgpt.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
05987b159acb9737707b9ef92b818ac434ef8c3d 06-Feb-2015 David Riley <davidriley@chromium.org> Changes to compile signing tools on darwin

The following works from a Mac with these changes:
make Q= ARCH=arm HAVE_MACOS=1 `pwd`/build/futility/futility

Only vbutil_keyblock and vbutil_kernel have been exercised.

BUG=none
TEST='make Q= ARCH=arm HAVE_MACOS=1 `pwd`/build/futility/futility'
BRANCH=none

Signed-off-by: David Riley <davidriley@chromium.org>

Change-Id: Ie69cfee0c650d4ff96be6322083a2fea1543ee39
Reviewed-on: https://chromium-review.googlesource.com/246773
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: David Riley <davidriley@chromium.org>
Commit-Queue: David Riley <davidriley@chromium.org>
/external/vboot_reference/cgpt/cgpt.h
8577b5360ca4c9514d9091ed9aded2bb3193f1f0 25-Nov-2014 Nam T. Nguyen <namnguyen@chromium.org> vboot: Remove FTS code

flash_ts driver (from Android) was pulled to support Sonic. But now we
go a different route, this CL is to drop the FTS code.

BUG=chromium:436597
BRANCH=none
TEST=unittest

Change-Id: I86d6273f9f5f642b504ccb6a76e005cda12d0e78
Reviewed-on: https://chromium-review.googlesource.com/231896
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Nam Nguyen <namnguyen@chromium.org>
Tested-by: Nam Nguyen <namnguyen@chromium.org>
/external/vboot_reference/cgpt/cgpt.h
ab899591808dd3e5f955ab7693b54a83389cd35f 14-Nov-2014 Nam T. Nguyen <namnguyen@chromium.org> vboot: cgpt: Treat drive_path as the GPT storage

Previously, "cgpt" called out to "flashrom" directly to read and write
NOR area. This CL removes that dependency and always treats "drive_path"
as the storage of GPT structs. This makes it consistent that whatever
device that cgpt reads from or writes to is always the device that
stores GPT structs. We only need to pass in the size of the drive that
contains the partitions, but we do not need to access to that drive.

More information is in the bug.

BUG=chromium:432611
BRANCH=none
TEST=unittest
CQ-DEPEND=CL:228942

Change-Id: Id0139adf70463cec4f2924de8b9a4725dbec822b
Reviewed-on: https://chromium-review.googlesource.com/229736
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Nam Nguyen <namnguyen@chromium.org>
Tested-by: Nam Nguyen <namnguyen@chromium.org>
/external/vboot_reference/cgpt/cgpt.h
6ee52d9a929d00e871e7316240b54f381146fbc6 24-Oct-2014 Nam T. Nguyen <namnguyen@chromium.org> vboot: cgpt: Support writing GPT structs to NOR flash

This CL allows the GPT headers and partition entry arrays to be stored
in a NOR flash device. Instead of treating both the NOR and NAND devices
as one (in a sandwich way), this CL writes and reads the GPT structs
independently of the actual device that houses the partitions.
Therefore, the first usable LBA of the partitions will be at 0, and the
last usable LBA is at the end of the NAND.

+------------------------+
| NOR houses GPT structs |
+------------------------+
|
0 | Index into
v v
+------------------------+
| NAND houses partitions |
+------------------------+

Note that the "my_lba", "alternate_lba", "entries_lba" in the GPT headers
are no longer meaningful.

Consumers of cgptlib will have to set "stored_on_device" to either
GPT_STORED_ON_DEVICE or GPT_STORED_OFF_DEVICE, and "gpt_drive_sectors"
to the number of 512-byte sectors available to store GPT structs.

The NOR read and write operations are done by "flashrom".

BUG=chromium:425677
BRANCH=none
TEST=unittest
TEST=build with DEBUG, cgpt create/add/show on a stumpy-moblab

Change-Id: I083b3c94da3b0bb3da1a7b10c6969774080a2afd
Reviewed-on: https://chromium-review.googlesource.com/226800
Reviewed-by: Nam Nguyen <namnguyen@chromium.org>
Commit-Queue: Nam Nguyen <namnguyen@chromium.org>
Tested-by: Nam Nguyen <namnguyen@chromium.org>
/external/vboot_reference/cgpt/cgpt.h
4cb5497984642b8cbd592c14cb1912a787b2d4d7 20-Jun-2014 Bill Richardson <wfrichar@chromium.org> Remove cgpt app-specific symbols from libvboot_host.a

Three symbols used by the standalone cgpt executable were being referenced
in the files used to create the external libvboot_host.a needed by non-vboot
userspace applications.

This cleans things up so those symbols don't have to be explictly defined
by other repos just to link with that library.

BUG=chromium:318536
BRANCH=ToT
TEST=manual

No new functionality, just code cleanup. Tested with

make runtests runfutiltests runlongtests

Change-Id: Ibc77fb9800c89d7109ebf38d4d6729f52665722f
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/205667
Reviewed-by: Randall Spangler <rspangler@chromium.org>
/external/vboot_reference/cgpt/cgpt.h
d41000ed64bb144704fcbf2db3db840de30d069d 19-Jul-2013 Albert Chaulk <achaulk@chromium.org> Don't always enable MTD mode unless MTD device is specified

On MTD devices, don't always enable MTD mode - the installer needs to
be able to access both the GPT disk and the MTD disk, so only
enable it if we install to /dev/fts

BRANCH=none
BUG=chromium:221745
TEST=make runtests

Change-Id: I7688e6bc758ef47cfb9d468c1224ef43b2043d02
Reviewed-on: https://gerrit.chromium.org/gerrit/62662
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
Tested-by: Albert Chaulk <achaulk@chromium.org>
/external/vboot_reference/cgpt/cgpt.h
4464354b7805b7d81667d79624275f525b5a8b11 09-Jul-2013 Albert Chaulk <achaulk@chromium.org> MTD: When running on the host (as during install) use the host FTS if possible.

BUG=chromium:252331
TEST='make runtests' still passes
BRANCH=none

Change-Id: I1deb70766b811b070f0f412cb5cfa583250dd687
Reviewed-on: https://gerrit.chromium.org/gerrit/61328
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
Reviewed-by: Albert Chaulk <achaulk@chromium.org>
Tested-by: Albert Chaulk <achaulk@chromium.org>
/external/vboot_reference/cgpt/cgpt.h
92f22e7c2a1ca08034ac3ad21b2af60347c1c4fb 02-Apr-2013 Albert Chaulk <achaulk@chromium.org> Bugfixes & MTD create command

Fix some bugs in the cgpt implementation of the flash I/O functions & load
logic, it was validating too much at load time.

Implement the create command for MTD

BUG=chromium:221745
TEST=MTD version of run_cgpt_tests.sh passes
BRANCH=none

Original-Change-Id: I2f52637d82962f4d805aa827c5c37685f10e76ea
Reviewed-on: https://gerrit.chromium.org/gerrit/47172
Tested-by: Albert Chaulk <achaulk@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
(cherry picked from commit 931544744ba410dad267064b87d504b0b4c24772)

Change-Id: If9364155fb2c030645adc6ee6f3fbe5373bcc153
Reviewed-on: https://gerrit.chromium.org/gerrit/49793
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
Reviewed-by: Albert Chaulk <achaulk@chromium.org>
Tested-by: Albert Chaulk <achaulk@chromium.org>
/external/vboot_reference/cgpt/cgpt.h
a75071c25295e392a21b8deddccaf2f3f0d0f041 29-Mar-2013 Albert Chaulk <achaulk@chromium.org> Enables MTD mode via command line option.

Enables MTD mode with a command line option of
-N=<write page bytes>,<write pages per erase block>,
<erase block offset to fts partition>,<erase block size of fts partition>

The problem is that we need to know exactly where the fts store partition is
and what the layout of the flash chip is in order to be able to use it
properly. This will vary per-device however, so for flexibility and testing
purposes, this command line option allows specification of arbitrary layouts.

BUG=chromium:221745
BRANCH=none
TEST=verified during development via prints

Original-Change-Id: I88640e777d5ccd4ffd3b39e1f131dc1d362c6b2c
Reviewed-on: https://gerrit.chromium.org/gerrit/46920
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
Reviewed-by: Albert Chaulk <achaulk@chromium.org>
Tested-by: Albert Chaulk <achaulk@chromium.org>
(cherry picked from commit 2b768f99d246823f3711bbe4cf50ea9ab4588a06)

Change-Id: I35591d4fbec13c3887beef11fdefc84fc90b8e05
Reviewed-on: https://gerrit.chromium.org/gerrit/49792
Reviewed-by: Albert Chaulk <achaulk@chromium.org>
Tested-by: Albert Chaulk <achaulk@chromium.org>
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
/external/vboot_reference/cgpt/cgpt.h
b334e651a597a10d562bc882613f0b482b24e3ca 28-Mar-2013 Albert Chaulk <achaulk@chromium.org> Provide MTD version of common functions

Provide an MTD implementation of several common functions in cgpt_common.c

BUG=chromium:221745
BRANCH=none
TEST=none

Original-Change-Id: Ib3248c283ca31e33a91b9ea0c14b2f72ea7c5850
Reviewed-on: https://gerrit.chromium.org/gerrit/47029
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
Tested-by: Albert Chaulk <achaulk@chromium.org>
(cherry picked from commit b0bd7e4cf8dd15cc3c371dac157093c7e7c7a874)

Change-Id: I243c2bf98a88d0019c332b274868459b5f1b8ea1
Reviewed-on: https://gerrit.chromium.org/gerrit/49791
Reviewed-by: Albert Chaulk <achaulk@chromium.org>
Tested-by: Albert Chaulk <achaulk@chromium.org>
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
/external/vboot_reference/cgpt/cgpt.h
534723a6519267461855441279b321e6fc1e4e90 20-Mar-2013 Albert Chaulk <achaulk@chromium.org> Integrate the flash key-value store code into cgpt.

Integrates the FTS driver into cgpt. This driver is binary-format compatible
with the linux driver for interoperabiilty. The cgpt changes load & store a
hex-encoded mtd partition table in the FTS; we need some sort of encoding
because FTS only stores NUL-terminated strings.

Currently, the mtd code paths aren't executed in cgpt, only in the tests. It's
also not hooked up to the vboot code yet, we will need to do that eventually.

BUG=chromium:221745
TEST=new unit test added
BRANCH=none

Change-Id: I94eb0389d29aca0beb9d9a644465c7d86161b3c2
Original-Change-Id: I9fe2fa91b666572563426adb8fa9d426f9b60bbf
Reviewed-on: https://gerrit.chromium.org/gerrit/46796
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
Reviewed-by: Albert Chaulk <achaulk@chromium.org>
Tested-by: Albert Chaulk <achaulk@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49789
/external/vboot_reference/cgpt/cgpt.h
fa6b35c1ffa33833b3250a6515869ccd4cb59121 26-Mar-2013 Albert Chaulk <achaulk@chromium.org> Refactor CgptAdd and CgptPrioitize to remove gpt-specific code

- Refactor cgpt_prioitize.c to completely remove gpt-specific code.
- Refactor cgpt_add.c to isolate gpt-dependence to one helper function
and the backup/restore logic
- Change several common apis to take a struct drive* rather than a GptData*,
this provides a path to cleanly implement mtd versions

BUG=chromium:221745
TEST=no functional changes, existing tests cover this
BRANCH=none

Change-Id: I27ed166aae390aa5dc83062f62939e45122edc76
Original-Change-Id: I1b0a73509efbf22411c4ae5cf044feede0a49a33
Reviewed-on: https://gerrit.chromium.org/gerrit/46548
Tested-by: Albert Chaulk <achaulk@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49788
/external/vboot_reference/cgpt/cgpt.h
0c3ba249abb1dc60f5ebabccf84ff13206440b83 29-Mar-2013 Bill Richardson <wfrichar@chromium.org> Massive refactoring of external header files.

This reduces the number of exported header files to the minimum needed by
the existing userspace utilities and firmware implementations.

BUG=chromium:221544
BRANCH=none
TEST=manual, trybots
CQ-DEPEND=CL:47019,CL:47022,CL:47023

sudo FEATURES=test emerge vboot_reference
FEATURES=test emerge-$BOARD \
vboot_reference \
chromeos-cryptohome \
chromeos-installer \
chromeos-u-boot \
peach-u-boot \
depthcharge

Change-Id: I2946cc2dbaf5459a6c5eca92ca57d546498e6d85
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47021
Reviewed-by: Randall Spangler <rspangler@chromium.org>
/external/vboot_reference/cgpt/cgpt.h
3f806a2abf07d7b801852a4a6f3a9080a4b5c427 20-Mar-2013 Bill Richardson <wfrichar@chromium.org> Apply consistent naming scheme for hostlib functions.

The chromeos-installer uses several functions from the vboot_reference
userspace library, but the names of those functions are inconsistent:

IsZero
MapFile
VbGetSystemPropertyString
cgpt_add
cgpt_boot
cgpt_create
cgpt_get_boot_partition_number
cgpt_get_num_non_empty_partitions
cgpt_get_partition_details
cgpt_prioritize
cgpt_set_attributes
find_kernel_config

The Google C++ style guide says types and functions should use CamelCase,
while variables use lower_case_with_underscores.

Kernel style (which vboot_reference tries to be more-or-less compatible
with) uses lower_case_with_underscores for everything, but that really only
has to apply to firmware stuff. For userspace, we can use the Google style.

BUG=chromium:221544
BRANCH=none
TEST=buildbot
CQ-DEPEND=CL:46045

Renaming/cleanup only; no functional changes.

Change-Id: I9c82c9ff8909be88586194c8ffdb435fc771195f
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46044
/external/vboot_reference/cgpt/cgpt.h
b7b865cfee68190babd971ab9a897bdabbab075f 24-Aug-2012 Stefan Reinauer <reinauer@chromium.org> Support alternative GPT header signature

In order to dual boot Windows and ChromeOS, Windows must
not find a GPT partition table on the disk. So change
ChromeOS to cope with an alternative signature "CHROMEOS"
instead of the standard "EFI PART"

BUG=chrome-os-partner:6108
TEST=rebuild chromeos, install it,
run cgpt legacy /dev/sda
dd if=/dev/sda of=/tmp/x bs=1k
hexdump -C /tmp/X
see the string CHROMEOS
BRANCH=link
Signed-off-by: Stefan Reinauer <reinauer@chromium.org>

Change-Id: Ia88eff33b9880bd73a78c1b8e026c1f8298c4557
Reviewed-on: https://gerrit.chromium.org/gerrit/31264
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Stefan Reinauer <reinauer@chromium.org>
/external/vboot_reference/cgpt/cgpt.h
23429d3d782f7506fb4747356974294cce08ac47 30-Apr-2012 Bill Richardson <wfrichar@chromium.org> Let cgpt open devices in read-only mode when possible.

BUG=chromium-os:12430
TEST=manual

Running "make; make runtests" in src/platform/vboot_refererence will test
this change. Tests for use on a Chromebook are described in the bug report,
but will require a USB or SD card that has a physical write-protect switch.

Change-Id: I16a67bad3b59bec0981f4064f51fb1a29da65a90
Reviewed-on: https://gerrit.chromium.org/gerrit/21474
Tested-by: Bill Richardson <wfrichar@chromium.org>
Commit-Ready: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
/external/vboot_reference/cgpt/cgpt.h
5fac757abef456bf66d9dd96b316ec61fe04b48e 23-Feb-2012 Jay Srinivasan <jaysri@chromium.org> Enable building of Cgpt C++ Library for 32-bit.

The existing library had a bunch of dependencies which are too many to
build for the 32-bit platform. So this checkin prunes the dependency
list by building only things that are absolutely required for the
functionality used in 32-bit Post-Installer.

Made the use of libuuid restricted only to cgpt and unit tests so that
libcgpt-cc.a doesn't depend on it.

BUG=chromium-os:25374
TEST=Built 32-bit and 64-bit. Tested 32-bit post-install.
Change-Id: Idd0826fdf507a95728fee8adac9520e26f05d469
Reviewed-on: https://gerrit.chromium.org/gerrit/16433
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
/external/vboot_reference/cgpt/cgpt.h
250549d3e742cddaf72b4f53d5739e54faf5db96 17-Feb-2012 Jay Srinivasan <jaysri@chromium.org> Implementation of CgptManager C++ library and unit tests.

CgptManager exposes the cgpt commands via a C++ library so that
the post-installer for 32- to 64-bit upgrade can link directly
against a library and thus avoid any shell dependency.

The default make target will not build libcgpt-cc.a since it
requires some dependencies that are available only in chroot.
A separate follow-up checkin to the vboot_reference
ebuild will enable emerging the libcgpt-cc.a by default.

BUG=chromium-os:25374
TEST=Tested with the new unit tests for CgptManager,
ran existing cgpt unit tests, as well as running the
cgpt commands manually. Built on both amd64 and x86.
Tested that vboot_reference is also buildable outside of chroot.
Tested that vboot_reference-firmware and vboot_reference-tests
also build fine with these changes.
CQ-DEPEND=I99f6c321e09c2425eaa8171d78685d2d731954c8
Change-Id: I59a896255b8ea2fc8b1b2150ae7c4ff9d0769699
Reviewed-on: https://gerrit.chromium.org/gerrit/15730
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
/external/vboot_reference/cgpt/cgpt.h
93cf15e9a1c29962d6f08be6102d2ea7876d969f 08-Jul-2011 Gabe Black <gabeblack@chromium.org> Introduce GUID type for Chrome OS read/write firmware.

This change teaches cgpt a new GUID type to be used for the Chrome OS
read/write firmware. The GUID is CAB6E88E-ABF3-4102-A07A-D4BB9BE3C1D3.

BUG=chrome-os-partner:4843
TEST=Built and installed on my host, used a separate change to repurpose
partition 11 for the R/W firmware using cgpt and the "firmware" type, inspected
the image using cgpt. Built and installed an image and used cgpt on the device
to inspect it's GPT.

Signed-off-by: Gabe Black <gabeblack@google.com>

Change-Id: I3b2801b2e1f71b3275bbddbc45fb63bde5bce5a7
Reviewed-on: http://gerrit.chromium.org/gerrit/3763
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
/external/vboot_reference/cgpt/cgpt.h
3430b32667937a75c7a3afc83f8f7a601a8187f7 29-Nov-2010 Bill Richardson <wfrichar@chromium.org> Add 'prioritize' command to cgpt tool.

This lets us reorder the priority of all the kernel partitions with a single
command, instead of a bunch of complicated and error-prone shell script
logic.

Change-Id: I21d39763ec5a748488d5319a987bcfe7c34ce4d0

BUG=chromium-os:9167
TEST=manual

In the chroot, do this:

cd ~/trunk/src/platform/vboot_reference
make
make runtests
make clean

Everything should pass.

Review URL: http://codereview.chromium.org/5352005
/external/vboot_reference/cgpt/cgpt.h
500b3c2369e1a8370041ea276bc40b81c6e7a713 22-Nov-2010 Louis Yung-Chieh Lo <yjlou@chromium.org> Fix for un-initialized code point variable.

The original CL is http://codereview.chromium.org/5025003/, but it was reverted
because the compiler complains code_point variable is not initialized. This CL
just initializes it.

This CL also adds few lines of code to make code more robust.

Change-Id: Ib1329bcaeb4a1bd9abfe9e766b61bd0e52d2c260

BUG=chromium-os:7542
TEST=RUNTESTS=1 emerge-x86-generic vboot_reference
Manually tested the following commands (intentionally mix Chinese and ASCII):
export C=.../cgpt
export D=/tmp/hda

$C add $D -i 1 -l 批P踢T踢T許C夕C餐
$C find $D -l 批P踢T踢T許C夕C餐
$C show $D
$C add $D -i 1 -l abc012
$C add $D -i 1 -l 是否看過坊間常見的許茹芸淚海慶功宴吃蓋飯第四集
$C add $D -i 1 -l 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ # ok and truncated
$C add $D -i 1 -l `printf "\xf4\x91\x81\x81"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xf4\x8f\xbf\xbf"`
$C add $D -i 1 -l `printf "\xf4\x8f\x44\x44"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xf4\x8f\xbf"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xf0\xbf\xbf\xbf"`
$C add $D -i 1 -l `printf "\xf0\xbf\xbf\x44"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xf0\x80\x80\x80"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xf0\x80\x84\x80"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xf0\x80\x90\x80"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xf0\x88\x80\x80"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xed\x80\x80"`
$C add $D -i 1 -l `printf "\xed\xa0\x80"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xe0\xbf\xbf"`
$C add $D -i 1 -l `printf "\xe0\xbf\x44"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xe0\x80\x80"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xe0\x90\x80"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xe0\xbf"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xd0\x80"`
$C add $D -i 1 -l `printf "\xd0\x11"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xd0"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xc0\xaf"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\x80"` # (EXPECT: failed)

Review URL: http://codereview.chromium.org/5104009
/external/vboot_reference/cgpt/cgpt.h
e417185ff654ead6b8c1c6eafe5fc67a89a4210d 19-Nov-2010 Chris Sosa <sosa@chromium.org> Revert "The right implementation of CGPT label conversion between UTF8 and UTF16."

This reverts commit 6965cbfed3352754f0ff9a270e3b330223b7154c.

TBR=Change broke tree

Change-Id: I5323799bf0bc2f9a1f2815f0c44fc90ca9a7bd77
/external/vboot_reference/cgpt/cgpt.h
6965cbfed3352754f0ff9a270e3b330223b7154c 19-Nov-2010 Louis Yung-Chieh Lo <yjlou@chromium.org> The right implementation of CGPT label conversion between UTF8 and UTF16.

For security quick fix, the original UTF8/UTF16 conversion only supports
ASCII area. This CL extends the library to support multiple code units
conversion between UTF8 and UTF16. The UTF8/UTF16 encoded byte(s) would be
decoded to code point first, then be encoded to UTF16/UTF8 correspondingly.

Bill, please kindly review the UTF8/UTF16 conversion.
Peter, please kindly comment if any security concern.

Thanks.

Change-Id: I99c558ff27556e0b8635ba2b8d9925d042e75cb2

BUG=chromium-os:7542
TEST=RUNTESTS=1 emerge-x86-generic vboot_reference
Manually tested the following commands (intentionally mix Chinese and ASCII):
export C=.../cgpt
export D=/tmp/hda

$C add $D -i 1 -l 批P踢T踢T許C夕C餐
$C find $D -l 批P踢T踢T許C夕C餐
$C show $D
$C add $D -i 1 -l 批P踢T踢T許C夕C餐
$C find $D -l 批P踢T踢T許C夕C餐
$C add $D -i 1 -l abc012
$C add $D -i 1 -l 是否看過坊間常見的許茹芸淚海慶功宴吃蓋飯第四集
$C add $D -i 1 -l 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ # ok and truncated
$C add $D -i 1 -l `printf "\xf4\x91\x81\x81"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xf4\x8f\xbf\xbf"`
$C add $D -i 1 -l `printf "\xf4\x8f\x44\x44"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xf4\x8f\xbf"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xf0\xbf\xbf\xbf"`
$C add $D -i 1 -l `printf "\xf0\xbf\xbf\x44"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xf0\x80\x80\x80"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xf0\x80\x84\x80"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xf0\x80\x90\x80"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xf0\x88\x80\x80"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xed\x80\x80"`
$C add $D -i 1 -l `printf "\xed\xa0\x80"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xe0\xbf\xbf"`
$C add $D -i 1 -l `printf "\xe0\xbf\x44"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xe0\x80\x80"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xe0\x90\x80"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xe0\xbf"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xd0\x80"`
$C add $D -i 1 -l `printf "\xd0\x11"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xd0"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\xc0\xaf"` # (EXPECT: failed)
$C add $D -i 1 -l `printf "\x80"` # (EXPECT: failed)

Review URL: http://codereview.chromium.org/5025003
/external/vboot_reference/cgpt/cgpt.h
c4e92af85ac2bfd90ab82c0b13bb0041595a0aff 12-Oct-2010 Bill Richardson <wfrichar@chromium.org> Address some security concerns in the cgpt tool.

1. Check for potential integer overflow in sector_bytes * sector_count.
2. Added O_NOFOLLOW to open() call - Is this enough?
3. Passing buffer length to GuidToStr(), PMBRToStr().
4. Use unsigned int in GetEntry() to determine stride.
5. Address conversion between UTF16 and UTF8.

Note: The UTF conversion is complex and troublesome, and needs careful
consideration to get right. For now, I've just forced the interpretation of
the partition name to 7-bit ASCII. That's sufficient for the needs of Chrome
OS, and I can file a new issue to handle UTF correctly.

BUG=chrome-os-partner:705
TEST=manual

Running "make runtests" invokes the tests/run_cgpt_tests.sh script, which checks the behavior and output of the cgpt tool.

Review URL: http://codereview.chromium.org/3594010

Change-Id: I5fd29796d8c929527e0cfbc6d5ccbcdc77502c6b
/external/vboot_reference/cgpt/cgpt.h
4a2093129f226b4b2b4684f2aebe2f4368f85fac 02-Jul-2010 Bill Richardson <wfrichar@chromium.org> Add 'find' command to cgpt, to search for partitions by UUID.

Review URL: http://codereview.chromium.org/2849040
/external/vboot_reference/cgpt/cgpt.h
f1372d9109d638fbb1a177a89ebaf64e7ee0637e 11-Jun-2010 Bill Richardson <wfrichar@chromium.org> Nearly complete rewrite of cgpt tool.

This fixes a number of bugs, adds a bunch of commands, and essentially makes
cgpt ready to use as a replacement for gpt. Still to do is to add commands
and options that will let it generated intentionally bad partitions, for use
in testing.

Review URL: http://codereview.chromium.org/2719008
/external/vboot_reference/cgpt/cgpt.h