OLD | NEW |
1 /* Software-Based Trusted Platform Module (TPM) Emulator for Linux | 1 /* Software-based Trusted Platform Module (TPM) Emulator |
2 * Copyright (C) 2004 Mario Strasser <mast@gmx.net>, | 2 * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net> |
3 * | 3 * |
4 * This module is free software; you can redistribute it and/or modify | 4 * This module is free software; you can redistribute it and/or modify |
5 * it under the terms of the GNU General Public License as published | 5 * it under the terms of the GNU General Public License as published |
6 * by the Free Software Foundation; either version 2 of the License, | 6 * by the Free Software Foundation; either version 2 of the License, |
7 * or (at your option) any later version. | 7 * or (at your option) any later version. |
8 * | 8 * |
9 * This module is distributed in the hope that it will be useful, | 9 * This module is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * $Id$ | 14 * $Id: rsa.c 364 2010-02-11 10:24:45Z mast $ |
15 */ | 15 */ |
16 | 16 |
17 #include "rsa.h" | 17 #include "rsa.h" |
18 #include "sha1.h" | 18 #include "sha1.h" |
19 #include "tpm/tpm_commands.h" | 19 #include "tpm/tpm_commands.h" |
20 | 20 |
21 static int rsa_public(tpm_rsa_public_key_t *key, | 21 static int rsa_public(tpm_rsa_public_key_t *key, |
22 const uint8_t *in, size_t in_len, uint8_t *out) | 22 const uint8_t *in, size_t in_len, uint8_t *out) |
23 { | 23 { |
24 size_t t; | 24 size_t t; |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 uint8_t *out, size_t *out_len) | 554 uint8_t *out, size_t *out_len) |
555 { | 555 { |
556 *out_len = key->size >> 3; | 556 *out_len = key->size >> 3; |
557 /* encode message */ | 557 /* encode message */ |
558 if (encode_message(type, in, in_len, out, *out_len) != 0) return -1; | 558 if (encode_message(type, in, in_len, out, *out_len) != 0) return -1; |
559 /* encrypt encoded message */ | 559 /* encrypt encoded message */ |
560 if (rsa_public(key, out, *out_len, out) != 0) return -1; | 560 if (rsa_public(key, out, *out_len, out) != 0) return -1; |
561 return 0; | 561 return 0; |
562 } | 562 } |
563 | 563 |
OLD | NEW |