| OLD | NEW |
| 1 #!/bin/bash -e | 1 #!/bin/bash -e |
| 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 # | 5 # |
| 6 | 6 |
| 7 # Check args first. | 7 # Check args first. |
| 8 if [ "$#" -lt "1" ]; then | 8 if [ "$#" -lt "1" ]; then |
| 9 cat <<EOF 1>&2 | 9 cat <<EOF 1>&2 |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 local base=$1 | 46 local base=$1 |
| 47 local alg=$2 | 47 local alg=$2 |
| 48 local len=$(alg_to_keylen $alg) | 48 local len=$(alg_to_keylen $alg) |
| 49 | 49 |
| 50 # make the RSA keypair | 50 # make the RSA keypair |
| 51 openssl genrsa -F4 -out "${base}_${len}.pem" $len | 51 openssl genrsa -F4 -out "${base}_${len}.pem" $len |
| 52 # create a self-signed certificate | 52 # create a self-signed certificate |
| 53 openssl req -batch -new -x509 -key "${base}_${len}.pem" \ | 53 openssl req -batch -new -x509 -key "${base}_${len}.pem" \ |
| 54 -out "${base}_${len}.crt" | 54 -out "${base}_${len}.crt" |
| 55 # generate pre-processed RSA public key | 55 # generate pre-processed RSA public key |
| 56 dumpRSAPublicKey "${base}_${len}.crt" > "${base}_${len}.keyb" | 56 dumpRSAPublicKey -cert "${base}_${len}.crt" > "${base}_${len}.keyb" |
| 57 | 57 |
| 58 # wrap the public key | 58 # wrap the public key |
| 59 vbutil_key \ | 59 vbutil_key \ |
| 60 --pack "${base}.vbpubk" \ | 60 --pack "${base}.vbpubk" \ |
| 61 --key "${base}_${len}.keyb" \ | 61 --key "${base}_${len}.keyb" \ |
| 62 --version 1 \ | 62 --version 1 \ |
| 63 --algorithm $alg | 63 --algorithm $alg |
| 64 | 64 |
| 65 # wrap the private key | 65 # wrap the private key |
| 66 vbutil_key \ | 66 vbutil_key \ |
| 67 --pack "${base}.vbprivk" \ | 67 --pack "${base}.vbprivk" \ |
| 68 --key "${base}_${len}.pem" \ | 68 --key "${base}_${len}.pem" \ |
| 69 --algorithm $alg | 69 --algorithm $alg |
| 70 | 70 |
| 71 # remove intermediate files | 71 # remove intermediate files |
| 72 rm -f "${base}_${len}.pem" "${base}_${len}.crt" "${base}_${len}.keyb" | 72 rm -f "${base}_${len}.pem" "${base}_${len}.crt" "${base}_${len}.keyb" |
| 73 } | 73 } |
| 74 | 74 |
| 75 # First create the .vbpubk and .vbprivk pair. | 75 # First create the .vbpubk and .vbprivk pair. |
| 76 make_pair "$1" "${2:-4}" | 76 make_pair "$1" "${2:-4}" |
| 77 | 77 |
| 78 # Now create a .keyblock to hold our .vbpubk. Since it's for developer use, it | 78 # Now create a .keyblock to hold our .vbpubk. Since it's for developer use, it |
| 79 # won't be signed, just checksummed. Developer kernels can only be run in | 79 # won't be signed, just checksummed. Developer kernels can only be run in |
| 80 # non-recovery mode with the developer switch enabled, but it won't hurt us to | 80 # non-recovery mode with the developer switch enabled, but it won't hurt us to |
| 81 # turn on all the flags bits anyway. | 81 # turn on all the flags bits anyway. |
| 82 vbutil_keyblock --pack "$1.keyblock" --datapubkey "$1.vbpubk" --flags 15 | 82 vbutil_keyblock --pack "$1.keyblock" --datapubkey "$1.vbpubk" --flags 15 |
| OLD | NEW |