Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/platform/vboot_reference/crypto/genpadding.sh

Issue 1585007: combined patch for: (Closed)
Patch Set: Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/platform/vboot_reference/crypto/padding.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # Script to generate padding.c containing PKCS 1.5 padding byte arrays for 7 # Script to generate padding.c containing PKCS 1.5 padding byte arrays for
8 # various combinations of RSA key lengths and message digest algorithms. 8 # various combinations of RSA key lengths and message digest algorithms.
9 9
10 Pad_Preamble="0x00,0x01" 10 Pad_Preamble="0x00,0x01"
(...skipping 30 matching lines...) Expand all
41 /* 41 /*
42 * DO NOT MODIFY THIS FILE DIRECTLY. 42 * DO NOT MODIFY THIS FILE DIRECTLY.
43 * 43 *
44 * This file is automatically generated by genpadding.sh and contains padding 44 * This file is automatically generated by genpadding.sh and contains padding
45 * arrays corresponding to various combinations of algorithms for RSA signatures . 45 * arrays corresponding to various combinations of algorithms for RSA signatures .
46 */ 46 */
47 47
48 EOF 48 EOF
49 49
50 50
51 echo '#include "rsa.h"' 51 echo '#include "cryptolib.h"'
52 echo '#include "sha.h"'
53 echo 52 echo
54 echo 53 echo
55 cat <<EOF 54 cat <<EOF
56 /* 55 /*
57 * PKCS 1.5 padding (from the RSA PKCS#1 v2.1 standard) 56 * PKCS 1.5 padding (from the RSA PKCS#1 v2.1 standard)
58 * 57 *
59 * Depending on the RSA key size and hash function, the padding is calculated 58 * Depending on the RSA key size and hash function, the padding is calculated
60 * as follows: 59 * as follows:
61 * 60 *
62 * 0x00 || 0x01 || PS || 0x00 || T 61 * 0x00 || 0x01 || PS || 0x00 || T
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 for rsaalgo in ${RSAAlgos[@]} 164 for rsaalgo in ${RSAAlgos[@]}
166 do 165 do
167 for hashalgo in ${HashAlgos[@]} 166 for hashalgo in ${HashAlgos[@]}
168 do 167 do
169 echo ${rsaalgo}NUMBYTES - ${hashalgo}_DIGEST_SIZE, 168 echo ${rsaalgo}NUMBYTES - ${hashalgo}_DIGEST_SIZE,
170 done 169 done
171 done 170 done
172 echo "};" 171 echo "};"
173 echo 172 echo
174 173
174 # Generate signature algorithm to messge digest algorithm map.
175 echo "const int hash_type_map[] = {"
176 for rsaalgo in ${RSAAlgos[@]}
177 do
178 for hashalgo in ${HashAlgos[@]}
179 do
180 echo ${hashalgo}_DIGEST_ALGORITHM,
181 done
182 done
183 echo "};"
184 echo
185
175 # Generate algorithm to message digest's output size map. 186 # Generate algorithm to message digest's output size map.
176 echo "const int hash_size_map[NUMALGORITHMS] = {" 187 echo "const int hash_size_map[NUMALGORITHMS] = {"
177 for rsaalgo in ${RSAAlgos[@]} 188 for rsaalgo in ${RSAAlgos[@]}
178 do 189 do
179 for hashalgo in ${HashAlgos[@]} 190 for hashalgo in ${HashAlgos[@]}
180 do 191 do
181 echo ${hashalgo}_DIGEST_SIZE, 192 echo ${hashalgo}_DIGEST_SIZE,
182 done 193 done
183 done 194 done
184 echo "};" 195 echo "};"
(...skipping 30 matching lines...) Expand all
215 do 226 do
216 for hashalgo in ${HashAlgos[@]} 227 for hashalgo in ${HashAlgos[@]}
217 do 228 do
218 echo \"${rsaalgo} ${hashalgo}\", 229 echo \"${rsaalgo} ${hashalgo}\",
219 done 230 done
220 done 231 done
221 echo "};" 232 echo "};"
222 echo 233 echo
223 234
224 #echo "#endif /* VBOOT_REFERENCE_PADDING_H_ */" 235 #echo "#endif /* VBOOT_REFERENCE_PADDING_H_ */"
OLDNEW
« no previous file with comments | « no previous file | src/platform/vboot_reference/crypto/padding.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698