Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 1 | /** |
| 2 | * \file pkcs11.c |
| 3 | * |
| 4 | * \brief Wrapper for PKCS#11 library libpkcs11-helper |
| 5 | * |
| 6 | * \author Adriaan de Jong <dejong@fox-it.com> |
| 7 | * |
Bence Szépkúti | 44bfbe3 | 2020-08-19 16:54:51 +0200 | [diff] [blame] | 8 | * Copyright The Mbed TLS Contributors |
Bence Szépkúti | 4e9f712 | 2020-06-05 13:02:18 +0200 | [diff] [blame] | 9 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later |
| 10 | * |
| 11 | * This file is provided under the Apache License 2.0, or the |
| 12 | * GNU General Public License v2.0 or later. |
| 13 | * |
| 14 | * ********** |
| 15 | * Apache License 2.0: |
Manuel Pégourié-Gonnard | 37ff140 | 2015-09-04 14:21:07 +0200 | [diff] [blame] | 16 | * |
| 17 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 18 | * not use this file except in compliance with the License. |
| 19 | * You may obtain a copy of the License at |
| 20 | * |
| 21 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 22 | * |
| 23 | * Unless required by applicable law or agreed to in writing, software |
| 24 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 25 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 26 | * See the License for the specific language governing permissions and |
| 27 | * limitations under the License. |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 28 | * |
Bence Szépkúti | 4e9f712 | 2020-06-05 13:02:18 +0200 | [diff] [blame] | 29 | * ********** |
| 30 | * |
| 31 | * ********** |
| 32 | * GNU General Public License v2.0 or later: |
| 33 | * |
| 34 | * This program is free software; you can redistribute it and/or modify |
| 35 | * it under the terms of the GNU General Public License as published by |
| 36 | * the Free Software Foundation; either version 2 of the License, or |
| 37 | * (at your option) any later version. |
| 38 | * |
| 39 | * This program is distributed in the hope that it will be useful, |
| 40 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 41 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 42 | * GNU General Public License for more details. |
| 43 | * |
| 44 | * You should have received a copy of the GNU General Public License along |
| 45 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 46 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 47 | * |
| 48 | * ********** |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 49 | */ |
| 50 | |
Manuel Pégourié-Gonnard | 7f80997 | 2015-03-09 17:05:11 +0000 | [diff] [blame] | 51 | #include "mbedtls/pkcs11.h" |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 52 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 53 | #if defined(MBEDTLS_PKCS11_C) |
Rich Evans | 00ab470 | 2015-02-06 13:43:58 +0000 | [diff] [blame] | 54 | |
Manuel Pégourié-Gonnard | 7f80997 | 2015-03-09 17:05:11 +0000 | [diff] [blame] | 55 | #include "mbedtls/md.h" |
| 56 | #include "mbedtls/oid.h" |
| 57 | #include "mbedtls/x509_crt.h" |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 58 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 59 | #if defined(MBEDTLS_PLATFORM_C) |
Manuel Pégourié-Gonnard | 7f80997 | 2015-03-09 17:05:11 +0000 | [diff] [blame] | 60 | #include "mbedtls/platform.h" |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 61 | #else |
Paul Bakker | 7dc4c44 | 2014-02-01 22:50:26 +0100 | [diff] [blame] | 62 | #include <stdlib.h> |
Manuel Pégourié-Gonnard | 7551cb9 | 2015-05-26 16:04:06 +0200 | [diff] [blame] | 63 | #define mbedtls_calloc calloc |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 64 | #define mbedtls_free free |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 65 | #endif |
| 66 | |
Manuel Pégourié-Gonnard | 3a89559 | 2015-05-27 17:09:21 +0200 | [diff] [blame] | 67 | #include <string.h> |
| 68 | |
Manuel Pégourié-Gonnard | eab147c | 2015-04-29 01:10:10 +0200 | [diff] [blame] | 69 | void mbedtls_pkcs11_init( mbedtls_pkcs11_context *ctx ) |
| 70 | { |
| 71 | memset( ctx, 0, sizeof( mbedtls_pkcs11_context ) ); |
| 72 | } |
| 73 | |
| 74 | int mbedtls_pkcs11_x509_cert_bind( mbedtls_x509_crt *cert, pkcs11h_certificate_t pkcs11_cert ) |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 75 | { |
| 76 | int ret = 1; |
| 77 | unsigned char *cert_blob = NULL; |
| 78 | size_t cert_blob_size = 0; |
| 79 | |
| 80 | if( cert == NULL ) |
| 81 | { |
| 82 | ret = 2; |
| 83 | goto cleanup; |
| 84 | } |
| 85 | |
Paul Bakker | b9e4e2c | 2014-05-01 14:18:25 +0200 | [diff] [blame] | 86 | if( pkcs11h_certificate_getCertificateBlob( pkcs11_cert, NULL, |
| 87 | &cert_blob_size ) != CKR_OK ) |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 88 | { |
| 89 | ret = 3; |
| 90 | goto cleanup; |
| 91 | } |
| 92 | |
Manuel Pégourié-Gonnard | 7551cb9 | 2015-05-26 16:04:06 +0200 | [diff] [blame] | 93 | cert_blob = mbedtls_calloc( 1, cert_blob_size ); |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 94 | if( NULL == cert_blob ) |
| 95 | { |
| 96 | ret = 4; |
| 97 | goto cleanup; |
| 98 | } |
| 99 | |
Paul Bakker | b9e4e2c | 2014-05-01 14:18:25 +0200 | [diff] [blame] | 100 | if( pkcs11h_certificate_getCertificateBlob( pkcs11_cert, cert_blob, |
| 101 | &cert_blob_size ) != CKR_OK ) |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 102 | { |
| 103 | ret = 5; |
| 104 | goto cleanup; |
| 105 | } |
| 106 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 107 | if( 0 != mbedtls_x509_crt_parse( cert, cert_blob, cert_blob_size ) ) |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 108 | { |
| 109 | ret = 6; |
| 110 | goto cleanup; |
| 111 | } |
| 112 | |
| 113 | ret = 0; |
| 114 | |
| 115 | cleanup: |
| 116 | if( NULL != cert_blob ) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 117 | mbedtls_free( cert_blob ); |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 118 | |
Paul Bakker | d8bb826 | 2014-06-17 14:06:49 +0200 | [diff] [blame] | 119 | return( ret ); |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 120 | } |
| 121 | |
| 122 | |
Manuel Pégourié-Gonnard | eab147c | 2015-04-29 01:10:10 +0200 | [diff] [blame] | 123 | int mbedtls_pkcs11_priv_key_bind( mbedtls_pkcs11_context *priv_key, |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 124 | pkcs11h_certificate_t pkcs11_cert ) |
| 125 | { |
| 126 | int ret = 1; |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 127 | mbedtls_x509_crt cert; |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 128 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 129 | mbedtls_x509_crt_init( &cert ); |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 130 | |
| 131 | if( priv_key == NULL ) |
| 132 | goto cleanup; |
| 133 | |
Manuel Pégourié-Gonnard | 3a89559 | 2015-05-27 17:09:21 +0200 | [diff] [blame] | 134 | if( 0 != mbedtls_pkcs11_x509_cert_bind( &cert, pkcs11_cert ) ) |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 135 | goto cleanup; |
| 136 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 137 | priv_key->len = mbedtls_pk_get_len( &cert.pk ); |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 138 | priv_key->pkcs11h_cert = pkcs11_cert; |
| 139 | |
| 140 | ret = 0; |
| 141 | |
| 142 | cleanup: |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 143 | mbedtls_x509_crt_free( &cert ); |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 144 | |
Paul Bakker | d8bb826 | 2014-06-17 14:06:49 +0200 | [diff] [blame] | 145 | return( ret ); |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 146 | } |
| 147 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 148 | void mbedtls_pkcs11_priv_key_free( mbedtls_pkcs11_context *priv_key ) |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 149 | { |
| 150 | if( NULL != priv_key ) |
| 151 | pkcs11h_certificate_freeCertificate( priv_key->pkcs11h_cert ); |
| 152 | } |
| 153 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 154 | int mbedtls_pkcs11_decrypt( mbedtls_pkcs11_context *ctx, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 155 | int mode, size_t *olen, |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 156 | const unsigned char *input, |
| 157 | unsigned char *output, |
Paul Bakker | 9a73632 | 2012-11-14 12:39:52 +0000 | [diff] [blame] | 158 | size_t output_max_len ) |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 159 | { |
| 160 | size_t input_len, output_len; |
| 161 | |
| 162 | if( NULL == ctx ) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 163 | return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA ); |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 164 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 165 | if( MBEDTLS_RSA_PRIVATE != mode ) |
| 166 | return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA ); |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 167 | |
| 168 | output_len = input_len = ctx->len; |
| 169 | |
| 170 | if( input_len < 16 || input_len > output_max_len ) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 171 | return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA ); |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 172 | |
| 173 | /* Determine size of output buffer */ |
| 174 | if( pkcs11h_certificate_decryptAny( ctx->pkcs11h_cert, CKM_RSA_PKCS, input, |
| 175 | input_len, NULL, &output_len ) != CKR_OK ) |
| 176 | { |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 177 | return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA ); |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 178 | } |
| 179 | |
| 180 | if( output_len > output_max_len ) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 181 | return( MBEDTLS_ERR_RSA_OUTPUT_TOO_LARGE ); |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 182 | |
| 183 | if( pkcs11h_certificate_decryptAny( ctx->pkcs11h_cert, CKM_RSA_PKCS, input, |
| 184 | input_len, output, &output_len ) != CKR_OK ) |
| 185 | { |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 186 | return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA ); |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 187 | } |
| 188 | *olen = output_len; |
| 189 | return( 0 ); |
| 190 | } |
| 191 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 192 | int mbedtls_pkcs11_sign( mbedtls_pkcs11_context *ctx, |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 193 | int mode, |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 194 | mbedtls_md_type_t md_alg, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 195 | unsigned int hashlen, |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 196 | const unsigned char *hash, |
| 197 | unsigned char *sig ) |
| 198 | { |
Paul Bakker | db1f059 | 2014-03-26 14:53:47 +0100 | [diff] [blame] | 199 | size_t sig_len = 0, asn_len = 0, oid_size = 0; |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 200 | unsigned char *p = sig; |
Steffan Karger | 28d81a0 | 2013-11-13 16:57:58 +0100 | [diff] [blame] | 201 | const char *oid; |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 202 | |
| 203 | if( NULL == ctx ) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 204 | return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA ); |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 205 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 206 | if( MBEDTLS_RSA_PRIVATE != mode ) |
| 207 | return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA ); |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 208 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 209 | if( md_alg != MBEDTLS_MD_NONE ) |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 210 | { |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 211 | const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type( md_alg ); |
Steffan Karger | 28d81a0 | 2013-11-13 16:57:58 +0100 | [diff] [blame] | 212 | if( md_info == NULL ) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 213 | return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA ); |
Steffan Karger | 28d81a0 | 2013-11-13 16:57:58 +0100 | [diff] [blame] | 214 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 215 | if( mbedtls_oid_get_oid_by_md( md_alg, &oid, &oid_size ) != 0 ) |
| 216 | return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA ); |
Steffan Karger | 28d81a0 | 2013-11-13 16:57:58 +0100 | [diff] [blame] | 217 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 218 | hashlen = mbedtls_md_get_size( md_info ); |
Paul Bakker | db1f059 | 2014-03-26 14:53:47 +0100 | [diff] [blame] | 219 | asn_len = 10 + oid_size; |
Steffan Karger | 28d81a0 | 2013-11-13 16:57:58 +0100 | [diff] [blame] | 220 | } |
| 221 | |
Paul Bakker | db1f059 | 2014-03-26 14:53:47 +0100 | [diff] [blame] | 222 | sig_len = ctx->len; |
Paul Bakker | 66d5d07 | 2014-06-17 16:39:18 +0200 | [diff] [blame] | 223 | if( hashlen > sig_len || asn_len > sig_len || |
| 224 | hashlen + asn_len > sig_len ) |
Steffan Karger | 28d81a0 | 2013-11-13 16:57:58 +0100 | [diff] [blame] | 225 | { |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 226 | return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA ); |
Steffan Karger | 28d81a0 | 2013-11-13 16:57:58 +0100 | [diff] [blame] | 227 | } |
Paul Bakker | db1f059 | 2014-03-26 14:53:47 +0100 | [diff] [blame] | 228 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 229 | if( md_alg != MBEDTLS_MD_NONE ) |
Steffan Karger | 28d81a0 | 2013-11-13 16:57:58 +0100 | [diff] [blame] | 230 | { |
| 231 | /* |
| 232 | * DigestInfo ::= SEQUENCE { |
| 233 | * digestAlgorithm DigestAlgorithmIdentifier, |
| 234 | * digest Digest } |
| 235 | * |
| 236 | * DigestAlgorithmIdentifier ::= AlgorithmIdentifier |
| 237 | * |
| 238 | * Digest ::= OCTET STRING |
| 239 | */ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 240 | *p++ = MBEDTLS_ASN1_SEQUENCE | MBEDTLS_ASN1_CONSTRUCTED; |
Steffan Karger | 28d81a0 | 2013-11-13 16:57:58 +0100 | [diff] [blame] | 241 | *p++ = (unsigned char) ( 0x08 + oid_size + hashlen ); |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 242 | *p++ = MBEDTLS_ASN1_SEQUENCE | MBEDTLS_ASN1_CONSTRUCTED; |
Steffan Karger | 28d81a0 | 2013-11-13 16:57:58 +0100 | [diff] [blame] | 243 | *p++ = (unsigned char) ( 0x04 + oid_size ); |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 244 | *p++ = MBEDTLS_ASN1_OID; |
Steffan Karger | 28d81a0 | 2013-11-13 16:57:58 +0100 | [diff] [blame] | 245 | *p++ = oid_size & 0xFF; |
| 246 | memcpy( p, oid, oid_size ); |
| 247 | p += oid_size; |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 248 | *p++ = MBEDTLS_ASN1_NULL; |
Steffan Karger | 28d81a0 | 2013-11-13 16:57:58 +0100 | [diff] [blame] | 249 | *p++ = 0x00; |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 250 | *p++ = MBEDTLS_ASN1_OCTET_STRING; |
Steffan Karger | 28d81a0 | 2013-11-13 16:57:58 +0100 | [diff] [blame] | 251 | *p++ = hashlen; |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 252 | } |
| 253 | |
Paul Bakker | db1f059 | 2014-03-26 14:53:47 +0100 | [diff] [blame] | 254 | memcpy( p, hash, hashlen ); |
| 255 | |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 256 | if( pkcs11h_certificate_signAny( ctx->pkcs11h_cert, CKM_RSA_PKCS, sig, |
Paul Bakker | db1f059 | 2014-03-26 14:53:47 +0100 | [diff] [blame] | 257 | asn_len + hashlen, sig, &sig_len ) != CKR_OK ) |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 258 | { |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 259 | return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA ); |
Paul Bakker | 43b7e35 | 2011-01-18 15:27:19 +0000 | [diff] [blame] | 260 | } |
| 261 | |
| 262 | return( 0 ); |
| 263 | } |
| 264 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 265 | #endif /* defined(MBEDTLS_PKCS11_C) */ |