comparison libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_decode.c @ 1435:f849a5ca2efc

update to libtomcrypt 1.17 (with Dropbear changes)
author Matt Johnston <matt@ucc.asn.au>
date Sat, 24 Jun 2017 17:50:50 +0800
parents 0cbe8f6dbf9e
children 6dba84798cd5
comparison
equal deleted inserted replaced
1434:27b9ddb06b09 1435:f849a5ca2efc
4 * algorithms in a highly modular and flexible manner. 4 * algorithms in a highly modular and flexible manner.
5 * 5 *
6 * The library is free for all purposes without any express 6 * The library is free for all purposes without any express
7 * guarantee it works. 7 * guarantee it works.
8 * 8 *
9 * Tom St Denis, [email protected], http://libtomcrypt.com 9 * Tom St Denis, [email protected], http://libtom.org
10 */ 10 */
11 #include "tomcrypt.h" 11 #include "tomcrypt.h"
12 12
13 /** @file pkcs_1_v1_5_decode.c 13 /** @file pkcs_1_v1_5_decode.c
14 * 14 *
15 * PKCS #1 v1.5 Padding. (Andreas Lange) 15 * LTC_PKCS #1 v1.5 Padding. (Andreas Lange)
16 */ 16 */
17 17
18 #ifdef PKCS_1 18 #ifdef LTC_PKCS_1
19 19
20 /** @brief PKCS #1 v1.5 decode. 20 /** @brief LTC_PKCS #1 v1.5 decode.
21 * 21 *
22 * @param msg The encoded data to decode 22 * @param msg The encoded data to decode
23 * @param msglen The length of the encoded data (octets) 23 * @param msglen The length of the encoded data (octets)
24 * @param block_type Block type to use in padding (\sa ltc_pkcs_1_v1_5_blocks) 24 * @param block_type Block type to use in padding (\sa ltc_pkcs_1_v1_5_blocks)
25 * @param modulus_bitlen The bit length of the RSA modulus 25 * @param modulus_bitlen The bit length of the RSA modulus
56 if ((msg[0] != 0x00) || (msg[1] != (unsigned char)block_type)) { 56 if ((msg[0] != 0x00) || (msg[1] != (unsigned char)block_type)) {
57 result = CRYPT_INVALID_PACKET; 57 result = CRYPT_INVALID_PACKET;
58 goto bail; 58 goto bail;
59 } 59 }
60 60
61 if (block_type == LTC_PKCS_1_EME) { 61 if (block_type == LTC_LTC_PKCS_1_EME) {
62 for (i = 2; i < modulus_len; i++) { 62 for (i = 2; i < modulus_len; i++) {
63 /* separator */ 63 /* separator */
64 if (msg[i] == 0x00) { break; } 64 if (msg[i] == 0x00) { break; }
65 } 65 }
66 ps_len = i++ - 2; 66 ps_len = i++ - 2;
101 result = CRYPT_OK; 101 result = CRYPT_OK;
102 bail: 102 bail:
103 return result; 103 return result;
104 } /* pkcs_1_v1_5_decode */ 104 } /* pkcs_1_v1_5_decode */
105 105
106 #endif /* #ifdef PKCS_1 */ 106 #endif /* #ifdef LTC_PKCS_1 */
107 107
108 /* $Source: /cvs/libtom/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_decode.c,v $ */ 108 /* $Source$ */
109 /* $Revision: 1.5 $ */ 109 /* $Revision$ */
110 /* $Date: 2006/12/16 17:41:21 $ */ 110 /* $Date$ */