10 Apr, 2015

1 commit


30 Jan, 2015

3 commits

  • Tom Rini
     
  • Currently the hash functions used in RSA are called directly from the sha1
    and sha256 libraries. Change the RSA checksum library to use the progressive
    hash API's registered with struct hash_algo. This will allow the checksum
    library to use the hardware accelerated progressive hash API's once available.

    Signed-off-by: Ruchika Gupta
    CC: Simon Glass
    Acked-by: Simon Glass
    Signed-off-by: Simon Glass
    (Fixed build error in am335x_boneblack_vboot due to duplicate CONFIG_DM)

    Change-Id: Ic44279432f88d4e8594c6e94feb1cfcae2443a54

    Ruchika Gupta
     
  • The dumpimage is able to extract components contained in a FIT image:

    $ ./dumpimage -T flat_dt -i CONTAINER.ITB -p INDEX FILE

    The CONTAINER.ITB is a regular FIT container file. The INDEX is the poisition
    of the sub-image to be retrieved, and FILE is the file (path+name) to save the
    extracted sub-image.

    For example, given the following kernel.its to build a kernel.itb:

    /dts-v1/;
    / {
    ...
    images {
    kernel@1 {
    description = "Kernel 2.6.32-34";
    data = /incbin/("/boot/vmlinuz-2.6.32-34-generic");
    type = "kernel";
    arch = "ppc";
    os = "linux";
    compression = "gzip";
    load = ;
    entry = ;
    hash@1 {
    algo = "md5";
    };
    };
    ...
    };
    ...
    };

    The dumpimage can extract the 'kernel@1' node through the following command:

    $ ./dumpimage -T flat_dt -i kernel.itb -p 0 kernel
    Extracted:
    Image 0 (kernel@1)
    Description: Kernel 2.6.32-34
    Created: Wed Oct 22 15:50:26 2014
    Type: Kernel Image
    Compression: gzip compressed
    Data Size: 4040128 Bytes = 3945.44 kB = 3.85 MB
    Architecture: PowerPC
    OS: Linux
    Load Address: 0x00000000
    Entry Point: 0x00000000
    Hash algo: md5
    Hash value: 22352ad39bdc03e2e50f9cc28c1c3652

    Which results in the file 'kernel' being exactly the same as '/boot/vmlinuz-2.6.32-34-generic'.

    Signed-off-by: Guilherme Maciel Ferreira

    Guilherme Maciel Ferreira
     

15 Jan, 2015

1 commit


21 Nov, 2014

1 commit


29 Oct, 2014

1 commit


22 Oct, 2014

1 commit


06 Oct, 2014

1 commit

  • Like many platforms, the Altera socfpga platform requires that the
    preloader be "signed" in a certain way or the built-in boot ROM will
    not boot the code.

    This change automatically creates an appropriately signed preloader
    from an SPL image.

    The signed image includes a CRC which must, of course, be generated
    with a CRC generator that the SoCFPGA boot ROM agrees with otherwise
    the boot ROM will reject the image.

    Unfortunately the CRC used in this boot ROM is not the same as the
    Adler CRC in lib/crc32.c. Indeed the Adler code is not technically a
    CRC but is more correctly described as a checksum.

    Thus, the appropriate CRC generator is added to lib/ as crc32_alt.c.

    Signed-off-by: Charles Manning
    Signed-off-by: Marek Vasut
    Cc: Chin Liang See
    Cc: Dinh Nguyen
    Cc: Albert Aribaud
    Cc: Tom Rini
    Cc: Wolfgang Denk
    Cc: Pavel Machek
    Acked-by: Pavel Machek

    V2: - Zap unused constant
    - Explicitly print an error message in case of error
    - Rework the hdr_checksum() function to take the *header directly
    instead of a plan buffer pointer

    Charles Manning
     

29 Aug, 2014

1 commit

  • Commit e3a5bbce broke the FIT image tests by not loading a ramdisk even if
    a load address is provided in the FIT. The rationale was that a load address
    of 0 should be considered to mean 'do not load'.

    Add a new load operation which supports this feature, so that the ramdisk
    will be loaded if a non-zero load address is provided.

    Signed-off-by: Simon Glass

    Simon Glass
     

22 Aug, 2014

1 commit

  • Commit b3dd64f5d537 "bootm: use genimg_get_kernel_addr()" introduced
    a bug for booting FIT image. It's because calling fit_parse_config()
    twice will give us wrong value in img_addr.

    Add a new function genimg_get_kernel_addr_fit() whichl will always
    return fit_uname_config and fit_uname_kernel for CONFIG_FIT.
    genimg_get_kernel_addr() will ignore those to parameters.

    Reported-by: York Sun
    Signed-off-by: Bryan Wu

    Bryan Wu
     

09 Aug, 2014

1 commit

  • Kernel address is normally stored as a string argument of bootm or bootz.
    This function is taken out from boot_get_kernel() of bootm.c, which can be
    reused by others.

    Signed-off-by: Bryan Wu
    [trini: Fix warnings with CONFIG_FIT]
    Signed-off-by: Tom Rini

    Bryan Wu
     

08 Jul, 2014

1 commit


19 Jun, 2014

3 commits


06 Jun, 2014

2 commits

  • Due to the FIT_MAX_HASH_LEN constant not having been updated
    to support SHA256 signatures one will always see a buffer
    overflow in fit_image_process_hash when signing images that
    use this larger hash. This is exposed by vboot_test.sh.

    Signed-off-by: Michael van der Westhuizen
    Acked-by: Simon Glass
    [trini: Rework a bit so move the exportable parts of hash.h outside of
    !USE_HOSTCC and only need that as a new include to image.h]
    Signed-off-by: Tom Rini

    Michael van der Westhuizen
     
  • make the use of legacy image format configurable through
    the config define CONFIG_IMAGE_FORMAT_LEGACY.

    When relying on signed FIT images with required signature check
    the legacy image format should be disabled. Therefore introduce
    this new define and enable legacy image format if CONFIG_FIT_SIGNATURE
    is not set. If CONFIG_FIT_SIGNATURE is set disable per default
    the legacy image format.

    Signed-off-by: Heiko Schocher
    Cc: Simon Glass
    Cc: Lars Steubesand
    Cc: Mike Pearce
    Cc: Wolfgang Denk
    Cc: Tom Rini
    Cc: Michal Simek
    Acked-by: Simon Glass

    Heiko Schocher
     

27 May, 2014

1 commit

  • The new atmelimage converts a machine code BLOB to bootable ROM image. Atmel
    ROM has no sophisticated image format, it only checks the first 7 ARM vectors.
    The vectors can contain valid B or LDR opcodes, the 6'th vector contains the
    image size to load.

    Additionally the PMECC header can be written by the atmelimage target. The
    parameters must be given via the -n switch as a coma separated list. For
    example:

    mkimage -T atmelimage \
    -n usePmecc=1,sectorPerPage=4,sectorSize=512,spareSize=64,eccBits=4,eccOffset=36 \
    -d spl/u-boot-spl.bin boot.bin

    A provided image can be checked for correct header setup. It prints out the
    PMECC header parameters if it has one and the 6'th interrupt vector content.

    ---88---

    A SPL binary modified with the atmelimage mkimage target was succesfully
    booted on a sama5d34ek via MMC and NAND.

    Signed-off-by: Andreas Bießmann
    Cc: Bo Shen
    Cc: Heiko Schocher
    Tested-by: Bo Shen

    Andreas Bießmann
     

23 May, 2014

1 commit


09 May, 2014

1 commit


08 May, 2014

1 commit

  • This patch adds support for the Android boot-image format. The header
    file is from the Android project and got slightly alterted so the struct +
    its defines are not generic but have something like a namespace. The
    header file is from bootloader/legacy/include/boot/bootimg.h. The header
    parsing has been written from scratch and I looked at
    bootloader/legacy/usbloader/usbloader.c for some details.
    The image contains the physical address (load address) of the kernel and
    ramdisk. This address is considered only for the kernel image.
    The "second image" defined in the image header is currently not
    supported. I haven't found anything that is creating this.

    v3 (Rob Herring):
    This is based on http://patchwork.ozlabs.org/patch/126797/ with the
    following changes:
    - Rebased to current mainline
    - Moved android image handling to separate functions in
    common/image-android.c
    - s/u8/char/ in header to fix string function warnings
    - Use SPDX identifiers for licenses
    - Cleaned-up file source information:
    android_image.h is from file include/boot/bootimg.h in repository:
    https://android.googlesource.com/platform/bootable/bootloader/legacy
    The git commit hash is 4205b865141ff2e255fe1d3bd16de18e217ef06a
    usbloader.c would be from the same commit, but it does not appear
    to have been used for any actual code.
    v4:
    - s/andriod/android/
    - Use a separate flag ep_found to track if the entry point has been set
    rather than using a magic value.

    Cc: Wolfgang Denk
    Signed-off-by: Sebastian Andrzej Siewior
    Signed-off-by: Rob Herring
    Reviewed-by: Tom Rini
    Reviewed-by: Lukasz Majewski

    Sebastian Siewior
     

18 Apr, 2014

1 commit


22 Mar, 2014

4 commits

  • add host tool "fit_check_sign" which verifies, if a fit image is
    signed correct.

    Signed-off-by: Heiko Schocher
    Cc: Simon Glass

    Heiko Schocher
     
  • Add support for sha256,rsa4096 signatures in u-boot.

    Signed-off-by: Heiko Schocher
    Acked-by: Simon Glass
    Cc: andreas@oetken.name

    Heiko Schocher
     
  • based on patch from andreas@oetken.name:

    http://patchwork.ozlabs.org/patch/294318/
    commit message:
    I currently need support for rsa-sha256 signatures in u-boot and found out that
    the code for signatures is not very generic. Thus adding of different
    hash-algorithms for rsa-signatures is not easy to do without copy-pasting the
    rsa-code. I attached a patch for how I think it could be better and included
    support for rsa-sha256. This is a fast first shot.

    aditionally work:
    - removed checkpatch warnings
    - removed compiler warnings
    - rebased against current head

    Signed-off-by: Heiko Schocher
    Cc: andreas@oetken.name
    Cc: Simon Glass

    Heiko Schocher
     
  • add sha256 support to fit images

    Signed-off-by: Heiko Schocher
    Acked-by: Simon Glass

    Heiko Schocher
     

19 Feb, 2014

1 commit


07 Feb, 2014

1 commit


09 Jan, 2014

1 commit


31 Aug, 2013

1 commit

  • Add mkimage support for generating and verifying MXS bootstream.
    The implementation here is mostly a glue code between MXSSB v0.4
    and mkimage, but the long-term goal is to rectify this and merge
    MXSSB with mkimage more tightly. Once this code is properly in
    U-Boot, MXSSB shall be deprecated in favor of mkimage-mxsimage
    support.

    Note that the mxsimage generator needs libcrypto from OpenSSL, I
    therefore enabled the libcrypto/libssl unconditionally.

    MXSSB: http://git.denx.de/?p=mxssb.git;a=summary

    The code is based on research presented at:
    http://www.rockbox.org/wiki/SbFileFormat

    Signed-off-by: Marek Vasut
    Cc: Tom Rini
    Cc: Fabio Estevam
    Cc: Stefano Babic
    Cc: Otavio Salvador

    Marek Vasut
     

24 Jul, 2013

1 commit


12 Jul, 2013

1 commit

  • If a specific configuraion is selected by the bootm command, e.g. with
    'bootm 84000000#recoveryconf' we must honour this for not just the kernel,
    but also the ramdisk and FDT.

    In the conversion to using a common fit_image_load() function for loading
    images from FITs (commits a51ec63 and 53f375f) this feature was lost.
    Reinstate it by passing the selected configuration back from
    fit_image_load() to boot_get_kernel(), then use this configuration
    (which is stored in images->fit_uname_cfg) in both boot_get_ramdisk()
    and boot_get_fdt().

    Signed-off-by: Simon Glass

    Simon Glass
     

10 Jul, 2013

1 commit


29 Jun, 2013

1 commit

  • At present mkimage is set up to always build with image signing support.
    This means that the SSL libraries (e.g. libssl-dev) are always required.

    Adjust things so that mkimage can be built with and without image signing,
    controlled by the presence of CONFIG_FIT_SIGNATURE in the board config file.

    If CONFIG_FIT_SIGNATURE is not enabled, then mkimage will report a warning
    that signing is not supported. If the option is enabled, but libraries are
    not available, then a build error similar to this will be shown:

    lib/rsa/rsa-sign.c:26:25: fatal error: openssl/rsa.h: No such file or directory

    Signed-off-by: Simon Glass

    Simon Glass
     

26 Jun, 2013

5 commits

  • While signing images is useful, it does not provide complete protection
    against several types of attack. For example, it it possible to create a
    FIT with the same signed images, but with the configuration changed such
    that a different one is selected (mix and match attack). It is also possible
    to substitute a signed image from an older FIT version into a newer FIT
    (roll-back attack).

    Add support for signing of FIT configurations using the libfdt's region
    support.

    Please see doc/uImage.FIT/signature.txt for more information.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • Add support for signing images using a new signature node. The process
    is handled by fdt_add_verification_data() which now takes parameters to
    provide the keys and related information.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • Add a structure to describe an algorithm which can sign and (later) verify
    images.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • For tracing it is useful to run as much of U-Boot as possible so as to get
    a complete picture. Quite a bit of work happens in bootm, and we don't want
    to have to stop tracing before bootm starts.

    Add a way of doing a 'fake' boot of the OS - which does everything up to
    the point where U-Boot is about to jump to the OS image. This allows
    tracing to record right until the end.

    This requires arch support to work.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • At present the bootm code is mostly duplicated for the plain 'bootm'
    command and its sub-command variant. This makes the code harder to
    maintain and means that changes must be made to several places.

    Introduce do_bootm_states() which performs selected portions of the bootm
    work, so that both plain 'bootm' and 'bootm ' can use the
    same code.

    Additional duplication exists in bootz, so tidy that up as well. This
    is not intended to change behaviour, apart from minor fixes where the
    previously-duplicated code missed some chunks of code.

    Signed-off-by: Simon Glass

    Simon Glass