OLD | NEW |
1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 * | 4 * |
5 * Host functions for signature generation. | 5 * Host functions for signature generation. |
6 */ | 6 */ |
7 | 7 |
8 /* TODO: change all 'return 0', 'return 1' into meaningful return codes */ | 8 /* TODO: change all 'return 0', 'return 1' into meaningful return codes */ |
9 | 9 |
10 #define OPENSSL_NO_SHA | 10 #define OPENSSL_NO_SHA |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 /* Sign the signature_digest into our output buffer */ | 119 /* Sign the signature_digest into our output buffer */ |
120 rv = RSA_private_encrypt(signature_digest_len, /* Input length */ | 120 rv = RSA_private_encrypt(signature_digest_len, /* Input length */ |
121 signature_digest, /* Input data */ | 121 signature_digest, /* Input data */ |
122 GetSignatureData(sig), /* Output sig */ | 122 GetSignatureData(sig), /* Output sig */ |
123 key->rsa_private_key, /* Key to use */ | 123 key->rsa_private_key, /* Key to use */ |
124 RSA_PKCS1_PADDING); /* Padding to use */ | 124 RSA_PKCS1_PADDING); /* Padding to use */ |
125 Free(signature_digest); | 125 Free(signature_digest); |
126 | 126 |
127 if (-1 == rv) { | 127 if (-1 == rv) { |
128 debug("SignatureBuf(): RSA_private_encrypt() failed.\n"); | 128 VBDEBUG(("SignatureBuf(): RSA_private_encrypt() failed.\n")); |
129 Free(sig); | 129 Free(sig); |
130 return NULL; | 130 return NULL; |
131 } | 131 } |
132 | 132 |
133 /* Return the signature */ | 133 /* Return the signature */ |
134 return sig; | 134 return sig; |
135 } | 135 } |
OLD | NEW |