| 1 | /******************************************************************************************** |
|---|
| 2 | * (c)2004-2011 Broadcom Corporation * |
|---|
| 3 | * * |
|---|
| 4 | * This program is the proprietary software of Broadcom Corporation and/or its licensors, * |
|---|
| 5 | * and may only be used, duplicated, modified or distributed pursuant to the terms and * |
|---|
| 6 | * conditions of a separate, written license agreement executed between you and Broadcom * |
|---|
| 7 | * (an "Authorized License"). Except as set forth in an Authorized License, Broadcom grants* |
|---|
| 8 | * no license (express or implied), right to use, or waiver of any kind with respect to the * |
|---|
| 9 | * Software, and Broadcom expressly reserves all rights in and to the Software and all * |
|---|
| 10 | * intellectual property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU * |
|---|
| 11 | * HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY * |
|---|
| 12 | * NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. * |
|---|
| 13 | * |
|---|
| 14 | * Except as expressly set forth in the Authorized License, * |
|---|
| 15 | * |
|---|
| 16 | * 1. This program, including its structure, sequence and organization, constitutes * |
|---|
| 17 | * the valuable trade secrets of Broadcom, and you shall use all reasonable efforts to * |
|---|
| 18 | * protect the confidentiality thereof,and to use this information only in connection * |
|---|
| 19 | * with your use of Broadcom integrated circuit products. * |
|---|
| 20 | * * |
|---|
| 21 | * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" * |
|---|
| 22 | * AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR * |
|---|
| 23 | * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO * |
|---|
| 24 | * THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES * |
|---|
| 25 | * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, * |
|---|
| 26 | * LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION * |
|---|
| 27 | * OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF * |
|---|
| 28 | * USE OR PERFORMANCE OF THE SOFTWARE. * |
|---|
| 29 | * * |
|---|
| 30 | * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS * |
|---|
| 31 | * LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR * |
|---|
| 32 | * EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR * |
|---|
| 33 | * USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF * |
|---|
| 34 | * THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT * |
|---|
| 35 | * ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE * |
|---|
| 36 | * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF * |
|---|
| 37 | * ANY LIMITED REMEDY. |
|---|
| 38 | * |
|---|
| 39 | * $brcm_Workfile: bcrypt.h $ |
|---|
| 40 | * $brcm_Revision: 2 $ |
|---|
| 41 | * $brcm_Date: 11/8/11 2:42p $ |
|---|
| 42 | * |
|---|
| 43 | * Module Description: |
|---|
| 44 | * |
|---|
| 45 | * Revision History: |
|---|
| 46 | * |
|---|
| 47 | * $brcm_Log: /nexus/lib/dtcp_ip/include/bcrypt.h $ |
|---|
| 48 | * |
|---|
| 49 | * 2 11/8/11 2:42p leisun |
|---|
| 50 | * SWSECURITY-86: Including original license term for bcrypt |
|---|
| 51 | * |
|---|
| 52 | * Module Description: |
|---|
| 53 | * openssl wrapper functions from bcrypt. |
|---|
| 54 | * |
|---|
| 55 | *********************************************************************************************/ |
|---|
| 56 | /*! \file bcrypt.h |
|---|
| 57 | * \brief openssl wrappers originally from bcrypt lib. |
|---|
| 58 | */ |
|---|
| 59 | #ifndef BCRYPT_H__ |
|---|
| 60 | #define BCRYPT_H__ |
|---|
| 61 | |
|---|
| 62 | #ifdef __cplusplus |
|---|
| 63 | extern "C" { |
|---|
| 64 | #endif |
|---|
| 65 | |
|---|
| 66 | #include <openssl/bn.h> |
|---|
| 67 | #include "ecc.h" |
|---|
| 68 | |
|---|
| 69 | #define BCRYPT_LINUX_USER_MODE_DRV |
|---|
| 70 | |
|---|
| 71 | /* Host Secure Module magic number used to check if opaque handle is corrupt */ |
|---|
| 72 | #define BCRYPT_P_HANDLE_MAGIC_NUMBER 0xfeedbabe |
|---|
| 73 | |
|---|
| 74 | |
|---|
| 75 | #define BCRYPT_P_CHECK_ERR_CODE_FUNC( errCode, function ) \ |
|---|
| 76 | if( (errCode = (function)) != BERR_SUCCESS ) \ |
|---|
| 77 | { \ |
|---|
| 78 | errCode = BERR_TRACE(errCode); \ |
|---|
| 79 | goto BCRYPT_P_DONE_LABEL; \ |
|---|
| 80 | } |
|---|
| 81 | |
|---|
| 82 | #define BCRYPT_P_CHECK_ERR_CODE_FUNC2( errCode, errCodeValue, function ) \ |
|---|
| 83 | if ( ( errCode = (function)) != BERR_SUCCESS ) \ |
|---|
| 84 | { \ |
|---|
| 85 | errCode = BERR_TRACE(errCodeValue); \ |
|---|
| 86 | goto BCRYPT_P_DONE_LABEL; \ |
|---|
| 87 | } |
|---|
| 88 | |
|---|
| 89 | |
|---|
| 90 | #define BCRYPT_P_CHECK_ERR_CODE_CONDITION( errCode, errCodeValue, condition ) \ |
|---|
| 91 | if( (condition) ) \ |
|---|
| 92 | { \ |
|---|
| 93 | errCode = BERR_TRACE((errCodeValue)); \ |
|---|
| 94 | goto BCRYPT_P_DONE_LABEL; \ |
|---|
| 95 | } |
|---|
| 96 | |
|---|
| 97 | /* Definitions */ |
|---|
| 98 | |
|---|
| 99 | |
|---|
| 100 | |
|---|
| 101 | |
|---|
| 102 | /* Host Secure module status codes */ |
|---|
| 103 | typedef enum BCRYPT_STATUS_e{ |
|---|
| 104 | |
|---|
| 105 | BCRYPT_STATUS_eOK, |
|---|
| 106 | BCRYPT_STATUS_eFAILED, |
|---|
| 107 | BCRYPT_STATUS_eTIME_OUT, |
|---|
| 108 | BCRYPT_STATUS_eHW_BUSY_ERR, |
|---|
| 109 | BCRYPT_STATUS_eOUT_OF_SYSTEM_MEMORY, |
|---|
| 110 | BCRYPT_STATUS_eINVALID_PARAMETER |
|---|
| 111 | |
|---|
| 112 | } BCRYPT_STATUS_eCode; |
|---|
| 113 | |
|---|
| 114 | /*************************************************************************** |
|---|
| 115 | Summary: |
|---|
| 116 | Parameters for BCRYPT handle. |
|---|
| 117 | |
|---|
| 118 | |
|---|
| 119 | Description: |
|---|
| 120 | This Structure defines the parameters for BCRYPT handle. It contains different handles |
|---|
| 121 | such as HSM handle, DMA handle, and Memory DMA handle, DMA Event handle, |
|---|
| 122 | HSM Mutex Handle, and DMA Mutex handle. Moreover, it contains bIsOpen and |
|---|
| 123 | ulMagicNumber which must be equal to BCRYPT_P_HANDLE_MAGIC_NUMBER. |
|---|
| 124 | |
|---|
| 125 | |
|---|
| 126 | See Also: |
|---|
| 127 | BCRYPT_Setting |
|---|
| 128 | |
|---|
| 129 | ****************************************************************************/ |
|---|
| 130 | typedef struct BCRYPT_P_Handle |
|---|
| 131 | { |
|---|
| 132 | unsigned long ulMagicNumber; /* Out: BCRYPT Magic Number */ |
|---|
| 133 | bool bIsOpen; /* Out: Defines if BCRYPT handle is open */ |
|---|
| 134 | |
|---|
| 135 | } BCRYPT_P_Handle; |
|---|
| 136 | /*************************************************************************** |
|---|
| 137 | Summary: |
|---|
| 138 | BCRYPT context handle. |
|---|
| 139 | |
|---|
| 140 | |
|---|
| 141 | Description: |
|---|
| 142 | This Structure defines BCRYPT_Handle which holds the context of BCRYPT. |
|---|
| 143 | The system should have only one BCRYPT_Handle. It is created by BCRYPT_Open function. |
|---|
| 144 | The caller of BCRYPT_Open is responsible to store this BCRYPT_Handle and uses it for the |
|---|
| 145 | future function calls. |
|---|
| 146 | |
|---|
| 147 | |
|---|
| 148 | See Also: |
|---|
| 149 | BCRYPT_Open |
|---|
| 150 | |
|---|
| 151 | ****************************************************************************/ |
|---|
| 152 | typedef struct BCRYPT_P_Handle * BCRYPT_Handle; |
|---|
| 153 | |
|---|
| 154 | |
|---|
| 155 | |
|---|
| 156 | BCRYPT_STATUS_eCode BCRYPT_Open( |
|---|
| 157 | BCRYPT_Handle *outp_handle); |
|---|
| 158 | |
|---|
| 159 | /***************************************************************************** |
|---|
| 160 | Summary: |
|---|
| 161 | This function frees the BCRYPT handle. |
|---|
| 162 | |
|---|
| 163 | |
|---|
| 164 | Description: |
|---|
| 165 | This function shall free the BCRYPT handle and any resources contained in the main handle. |
|---|
| 166 | This function shall try to free any resources associated with sub handles created from the |
|---|
| 167 | main handle (BCRYPT_handle). |
|---|
| 168 | Regardless of the return value, this function always attempts to free all the allocated |
|---|
| 169 | resources. |
|---|
| 170 | System shall not call any other BCRYPT functions after calling this function. |
|---|
| 171 | |
|---|
| 172 | |
|---|
| 173 | Calling Context: |
|---|
| 174 | The function shall be called from application level or from driver level, for example in Linux |
|---|
| 175 | during insmod. |
|---|
| 176 | |
|---|
| 177 | |
|---|
| 178 | Performance and Timing: |
|---|
| 179 | This is a synchronous/blocking function that will not return until it is done or failed. |
|---|
| 180 | |
|---|
| 181 | |
|---|
| 182 | Input: |
|---|
| 183 | inout_handle - BCRYPT_Handle |
|---|
| 184 | |
|---|
| 185 | |
|---|
| 186 | Returns: |
|---|
| 187 | BCRYPT_STATUS_eOK - success |
|---|
| 188 | BCRYPT_STATUS_eFAILED - failure |
|---|
| 189 | |
|---|
| 190 | |
|---|
| 191 | See Also: |
|---|
| 192 | BCRYPT_Open |
|---|
| 193 | |
|---|
| 194 | ******************************************************************************/ |
|---|
| 195 | BCRYPT_STATUS_eCode BCRYPT_Close( |
|---|
| 196 | BCRYPT_Handle inout_handle); |
|---|
| 197 | |
|---|
| 198 | |
|---|
| 199 | /*************************************************************************** |
|---|
| 200 | Summary: |
|---|
| 201 | Parameters for SHA-1 algorithm in software. |
|---|
| 202 | |
|---|
| 203 | |
|---|
| 204 | Description: |
|---|
| 205 | This Structure defines the parameters for SHA-1 algorithm in software. It contains input |
|---|
| 206 | source data, the length on input data in bytes, SHA-1 context, inital SHA-1 context, the |
|---|
| 207 | generated digest, and the length of digset in bytes. |
|---|
| 208 | |
|---|
| 209 | ****************************************************************************/ |
|---|
| 210 | typedef struct BCRYPT_Sha1Sw { |
|---|
| 211 | unsigned char *pucSrcData; /* In: A pointer to the input source data */ |
|---|
| 212 | unsigned long ulSrcDataLenInByte; /* In: Length of the input data in bytes */ |
|---|
| 213 | unsigned long ulctxnum; /*In: Sha1 context, MUST be within 0-15. */ |
|---|
| 214 | bool binitctx; /*In: Init SHA-1 context. */ |
|---|
| 215 | bool bfinal; /*In: Generate final digest. */ |
|---|
| 216 | |
|---|
| 217 | unsigned char *pucDigest; /* Out: A pointer to the output digest value */ |
|---|
| 218 | unsigned char ucDigestLenInByte; /* Out: Length of the output digest in bytes */ |
|---|
| 219 | |
|---|
| 220 | } BCRYPT_Sha1Sw_t; |
|---|
| 221 | |
|---|
| 222 | /* Basic Module Functions */ |
|---|
| 223 | |
|---|
| 224 | /***************************************************************************** |
|---|
| 225 | Summary: |
|---|
| 226 | This function implements the SHA-1 algorithm in SW. |
|---|
| 227 | |
|---|
| 228 | |
|---|
| 229 | Description: |
|---|
| 230 | This function implements the SHA-1 algorithm in software. It is |
|---|
| 231 | based on the SHA-1 implementation of the openssl code. The binaries of the openssl library is |
|---|
| 232 | already included into the build environment. |
|---|
| 233 | |
|---|
| 234 | |
|---|
| 235 | Calling Context: |
|---|
| 236 | The function shall be called from application level or from driver level, for example in Linux |
|---|
| 237 | during insmod. |
|---|
| 238 | |
|---|
| 239 | |
|---|
| 240 | Performance and Timing: |
|---|
| 241 | This is a synchronous/blocking function that will not return until it is done or failed. |
|---|
| 242 | |
|---|
| 243 | |
|---|
| 244 | Input: |
|---|
| 245 | hBcrypt - BCRYPT_Handle |
|---|
| 246 | inoutp_sha1SwIO - BCRYPT_Sha1Sw_t, a ref/pointer to the parameters |
|---|
| 247 | for the SW implementation of the SHA-1 algorithm. |
|---|
| 248 | |
|---|
| 249 | |
|---|
| 250 | Returns: |
|---|
| 251 | BCRYPT_STATUS_eOK - success |
|---|
| 252 | BCRYPT_STATUS_eFAILED - failure |
|---|
| 253 | |
|---|
| 254 | |
|---|
| 255 | ******************************************************************************/ |
|---|
| 256 | BCRYPT_STATUS_eCode BCrypt_Sha1Sw( |
|---|
| 257 | BCRYPT_Handle hBcrypt, |
|---|
| 258 | BCRYPT_Sha1Sw_t *inoutp_sha1SwIO |
|---|
| 259 | ); |
|---|
| 260 | |
|---|
| 261 | /*************************************************************************** |
|---|
| 262 | Summary: |
|---|
| 263 | Parameters for the SW AES algorithm in the CBC mode of operation. |
|---|
| 264 | |
|---|
| 265 | |
|---|
| 266 | Description: |
|---|
| 267 | This Structure defines the parameters for the SW AES algorithm for the CBC |
|---|
| 268 | mode of operation. It contains the input key, initialization vector, input and output streams, |
|---|
| 269 | and the crypto mode. |
|---|
| 270 | |
|---|
| 271 | |
|---|
| 272 | See Also: |
|---|
| 273 | BCrypt_AESCBCSw |
|---|
| 274 | |
|---|
| 275 | ****************************************************************************/ |
|---|
| 276 | typedef struct BCRYPT_S_AESCBCSwCtrl{ |
|---|
| 277 | unsigned char *pIn; /* In: A pointer to the input data steam */ |
|---|
| 278 | unsigned char *piv; /* In: A pointer to the CBC initialization vector. */ |
|---|
| 279 | unsigned char *pkey; /* In: A pointer to the encryption key */ |
|---|
| 280 | unsigned long len; /* In: Length of the input data steam */ |
|---|
| 281 | bool bEncFlag; /* In: Encrypt flag: 1: encrypt, 0: decrypt */ |
|---|
| 282 | unsigned long keybits; /* In: key length in bits. 128, 192, 256 only.*/ |
|---|
| 283 | |
|---|
| 284 | unsigned char *pOut; /* Out: A pointer to the encrypted output data */ |
|---|
| 285 | |
|---|
| 286 | } BCRYPT_S_AESCBCSwCtrl_t; |
|---|
| 287 | |
|---|
| 288 | |
|---|
| 289 | |
|---|
| 290 | |
|---|
| 291 | /* Basic Module Functions */ |
|---|
| 292 | |
|---|
| 293 | |
|---|
| 294 | /***************************************************************************** |
|---|
| 295 | Summary: |
|---|
| 296 | This function implements the AES algorithm in the CBC mode of operation in SW. |
|---|
| 297 | |
|---|
| 298 | |
|---|
| 299 | Description: |
|---|
| 300 | This function implements the AES algorithm in the CBC mode of operation in software. It is |
|---|
| 301 | based on the AES implementation of the openssl code. All key lengths of 128, 192, and 256 |
|---|
| 302 | are supported. The binaries of the openssl library is already included into the build |
|---|
| 303 | environment. Since this is a software implementation for the AES algorithm in the CBC mode |
|---|
| 304 | of operation, it can only be used with the clear key. |
|---|
| 305 | If the application requires an encrypted key, then the key must be decrypted before sending |
|---|
| 306 | in to this function call. |
|---|
| 307 | |
|---|
| 308 | |
|---|
| 309 | Calling Context: |
|---|
| 310 | The function shall be called from application level or from driver level, for example in Linux |
|---|
| 311 | during insmod. |
|---|
| 312 | |
|---|
| 313 | |
|---|
| 314 | Performance and Timing: |
|---|
| 315 | This is a synchronous/blocking function that will not return until it is done or failed. |
|---|
| 316 | |
|---|
| 317 | |
|---|
| 318 | Input: |
|---|
| 319 | hBcrypt - BCRYPT_Handle |
|---|
| 320 | inoutp_AESCBCSwCtrl - BCRYPT_S_AESCBCSwCtrl_t, a ref/pointer to the parameters |
|---|
| 321 | for the SW implementation of the AES algorithm in the CBC mode of operation. |
|---|
| 322 | |
|---|
| 323 | |
|---|
| 324 | Returns: |
|---|
| 325 | BCRYPT_STATUS_eOK - success |
|---|
| 326 | BCRYPT_STATUS_eFAILED - failure |
|---|
| 327 | |
|---|
| 328 | |
|---|
| 329 | See Also: |
|---|
| 330 | BCrypt_AESECBSw |
|---|
| 331 | |
|---|
| 332 | ******************************************************************************/ |
|---|
| 333 | BCRYPT_STATUS_eCode BCrypt_AESCBCSw( |
|---|
| 334 | BCRYPT_Handle hBcrypt, |
|---|
| 335 | BCRYPT_S_AESCBCSwCtrl_t *inoutp_AESCBCSwCtrl |
|---|
| 336 | ); |
|---|
| 337 | |
|---|
| 338 | /*************************************************************************** |
|---|
| 339 | Summary: |
|---|
| 340 | Parameters for the SW AES algorithm in the ECB mode of operation. |
|---|
| 341 | |
|---|
| 342 | |
|---|
| 343 | Description: |
|---|
| 344 | This Structure defines the parameters for the SW AES algorithm for the ECB |
|---|
| 345 | mode of operation. It contains the input key, initialization vector, input and output streams, |
|---|
| 346 | and the crypto mode. |
|---|
| 347 | |
|---|
| 348 | |
|---|
| 349 | See Also: |
|---|
| 350 | BCrypt_AESECBSw |
|---|
| 351 | |
|---|
| 352 | ****************************************************************************/ |
|---|
| 353 | typedef struct BCRYPT_S_AESECBSwCtrl{ |
|---|
| 354 | unsigned char *pIn; /* In: A pointer to the input data steam */ |
|---|
| 355 | unsigned char *pkey; /* In: A pointer to the encryption key */ |
|---|
| 356 | unsigned long len; /* In: Length of the input data steam */ |
|---|
| 357 | bool bEncFlag; /* In: Encrypt flag: 1: encrypt, 0: decrypt */ |
|---|
| 358 | unsigned long keybits; /* In: key length in bits. 128, 192, 256 only.*/ |
|---|
| 359 | |
|---|
| 360 | unsigned char *pOut; /* Out: A pointer to the encrypted output data */ |
|---|
| 361 | |
|---|
| 362 | } BCRYPT_S_AESECBSwCtrl_t; |
|---|
| 363 | |
|---|
| 364 | |
|---|
| 365 | |
|---|
| 366 | |
|---|
| 367 | /* Basic Module Functions */ |
|---|
| 368 | |
|---|
| 369 | |
|---|
| 370 | /***************************************************************************** |
|---|
| 371 | Summary: |
|---|
| 372 | This function implements the AES algorithm in the ECB mode of operation in SW. |
|---|
| 373 | |
|---|
| 374 | |
|---|
| 375 | Description: |
|---|
| 376 | This function implements the AES algorithm in the ECB mode of operation in software. It is |
|---|
| 377 | based on the AES implementation of the openssl code. All key lengths of 128, 192, and 256 |
|---|
| 378 | are supported. The binaries of the openssl library is already included into the build |
|---|
| 379 | environment. Since this is a software implementation for the AES algorithm in the ECB mode |
|---|
| 380 | of operation, it can only be used with the clear key. |
|---|
| 381 | If the application requires an encrypted key, then the key must be decrypted before sending |
|---|
| 382 | in to this function call. |
|---|
| 383 | |
|---|
| 384 | |
|---|
| 385 | Calling Context: |
|---|
| 386 | The function shall be called from application level or from driver level, for example in Linux |
|---|
| 387 | during insmod. |
|---|
| 388 | |
|---|
| 389 | |
|---|
| 390 | Performance and Timing: |
|---|
| 391 | This is a synchronous/blocking function that will not return until it is done or failed. |
|---|
| 392 | |
|---|
| 393 | |
|---|
| 394 | Input: |
|---|
| 395 | hBcrypt - BCRYPT_Handle |
|---|
| 396 | inoutp_AESECBSwCtrl - BCRYPT_S_AESECBSwCtrl_t, a ref/pointer to the parameters |
|---|
| 397 | for the SW implementation of the AES algorithm in the ECB mode of operation. |
|---|
| 398 | |
|---|
| 399 | |
|---|
| 400 | Returns: |
|---|
| 401 | BCRYPT_STATUS_eOK - success |
|---|
| 402 | BCRYPT_STATUS_eFAILED - failure |
|---|
| 403 | |
|---|
| 404 | |
|---|
| 405 | See Also: |
|---|
| 406 | BCrypt_AESECBSw |
|---|
| 407 | |
|---|
| 408 | ******************************************************************************/ |
|---|
| 409 | BCRYPT_STATUS_eCode BCrypt_AESECBSw( |
|---|
| 410 | BCRYPT_Handle hBcrypt, |
|---|
| 411 | BCRYPT_S_AESECBSwCtrl_t *inoutp_AESECBSwCtrl |
|---|
| 412 | ); |
|---|
| 413 | |
|---|
| 414 | /*************************************************************************** |
|---|
| 415 | Summary: |
|---|
| 416 | Parameters for Elliptic Curve. |
|---|
| 417 | |
|---|
| 418 | |
|---|
| 419 | Description: |
|---|
| 420 | This Structure defines the parameters for Elliptic Curve. It contains modulus P, elliptic curve |
|---|
| 421 | coefficient A and B, the base point G with components X and Y, and the order of base point |
|---|
| 422 | G. |
|---|
| 423 | |
|---|
| 424 | |
|---|
| 425 | See Also: |
|---|
| 426 | BCRYPT_ECCPoint |
|---|
| 427 | |
|---|
| 428 | ****************************************************************************/ |
|---|
| 429 | typedef struct BCRYPT_ECCParam |
|---|
| 430 | { |
|---|
| 431 | char *P; /* In: Modulus */ |
|---|
| 432 | char *A; /* In: Elliptic curve coefficient a */ |
|---|
| 433 | char *B; /* In: Elliptic curve coefficient b */ |
|---|
| 434 | char *G_x; /* In: Base point, X component */ |
|---|
| 435 | char *G_y; /* In: Base point, Y component */ |
|---|
| 436 | char *N; /* In: Order of base point G */ |
|---|
| 437 | } BCRYPT_ECCParam_t; |
|---|
| 438 | |
|---|
| 439 | |
|---|
| 440 | /*************************************************************************** |
|---|
| 441 | Summary: |
|---|
| 442 | Parameters for a point on an EC curve. |
|---|
| 443 | |
|---|
| 444 | |
|---|
| 445 | Description: |
|---|
| 446 | This Structure defines the parameters a point on an EC curve. It contains the components |
|---|
| 447 | x and y of the point on an EC curve. |
|---|
| 448 | |
|---|
| 449 | |
|---|
| 450 | See Also: |
|---|
| 451 | BCRYPT_ECCParam |
|---|
| 452 | |
|---|
| 453 | ****************************************************************************/ |
|---|
| 454 | typedef struct BCRYPT_ECCPoint |
|---|
| 455 | { |
|---|
| 456 | char *x; /* In: Component x of the point in EC curve*/ |
|---|
| 457 | char *y; /* In: Component y of the point in EC curve*/ |
|---|
| 458 | } BCRYPT_ECCPoint_t; |
|---|
| 459 | |
|---|
| 460 | |
|---|
| 461 | /* |
|---|
| 462 | * Signature |
|---|
| 463 | */ |
|---|
| 464 | typedef enum |
|---|
| 465 | { |
|---|
| 466 | BCRYPT_ECCSig_Format_Decimal = 0, |
|---|
| 467 | BCRYPT_ECCSig_Format_Hex |
|---|
| 468 | } BCRYPT_ECCSig_Format_t; |
|---|
| 469 | |
|---|
| 470 | |
|---|
| 471 | /*************************************************************************** |
|---|
| 472 | Summary: |
|---|
| 473 | Parameters for a ECC signature. |
|---|
| 474 | |
|---|
| 475 | |
|---|
| 476 | Description: |
|---|
| 477 | This Structure defines the parameters for ECC signature. It contains r, s (signature) and the |
|---|
| 478 | signature format. |
|---|
| 479 | |
|---|
| 480 | |
|---|
| 481 | See Also: |
|---|
| 482 | BCRYPT_ECCParam, BCRYPT_ECCPoint |
|---|
| 483 | |
|---|
| 484 | ****************************************************************************/ |
|---|
| 485 | typedef struct BCRYPT_ECCSig |
|---|
| 486 | { |
|---|
| 487 | char *r; /* In: Component r of ECC signature*/ |
|---|
| 488 | char *s; /* In: Component s of ECC signature*/ |
|---|
| 489 | BCRYPT_ECCSig_Format_t format; /* In: Signature format*/ |
|---|
| 490 | } BCRYPT_ECCSig_t; |
|---|
| 491 | |
|---|
| 492 | |
|---|
| 493 | /* |
|---|
| 494 | * Public key |
|---|
| 495 | */ |
|---|
| 496 | typedef BCRYPT_ECCPoint_t BCRYPT_ECCPublicKey_t; |
|---|
| 497 | |
|---|
| 498 | |
|---|
| 499 | |
|---|
| 500 | /*************************************************************************** |
|---|
| 501 | Summary: |
|---|
| 502 | Parameters for a ECDSA Verify. |
|---|
| 503 | |
|---|
| 504 | |
|---|
| 505 | Description: |
|---|
| 506 | This Structure defines the parameters for ECDSA Verify. It contains EC curve parameters, |
|---|
| 507 | signature, public key, hash string and its length, and a flag indicating if signature is valid. |
|---|
| 508 | |
|---|
| 509 | |
|---|
| 510 | See Also: |
|---|
| 511 | BCRYPT_ECCParam, BCRYPT_ECCPoint, BCRYPT_ECCSig |
|---|
| 512 | BCRYPT_ECDSASw_Sign, BCRYPT_ECDSASw_Multiply |
|---|
| 513 | |
|---|
| 514 | ****************************************************************************/ |
|---|
| 515 | typedef struct BCRYPT_ECDSASw_Verify |
|---|
| 516 | { |
|---|
| 517 | BCRYPT_ECCParam_t eccParm; /* In: EC curve parameters */ |
|---|
| 518 | BCRYPT_ECCSig_t sig; /* In: ECC Signature */ |
|---|
| 519 | BCRYPT_ECCPublicKey_t publicKey; /* In: Public key */ |
|---|
| 520 | unsigned char *hash; /* In: A pointer to hash string */ |
|---|
| 521 | unsigned char hashLen; /* In: Length of hash */ |
|---|
| 522 | bool sigIsValid; /* Out: A flag indicating signature is valid */ |
|---|
| 523 | } BCRYPT_ECDSASw_Verify_t; |
|---|
| 524 | |
|---|
| 525 | |
|---|
| 526 | |
|---|
| 527 | /*************************************************************************** |
|---|
| 528 | Summary: |
|---|
| 529 | Parameters for a ECDSA Sign. |
|---|
| 530 | |
|---|
| 531 | |
|---|
| 532 | Description: |
|---|
| 533 | This Structure defines the parameters for ECDSA Sign. It contains EC curve parameters, |
|---|
| 534 | signature, private key, hash string and its length, and a random integer. |
|---|
| 535 | |
|---|
| 536 | |
|---|
| 537 | See Also: |
|---|
| 538 | BCRYPT_ECCParam, BCRYPT_ECCPoint, BCRYPT_ECCSig |
|---|
| 539 | BCRYPT_ECDSASw_Verify, BCRYPT_ECDSASw_Multiply |
|---|
| 540 | |
|---|
| 541 | ****************************************************************************/ |
|---|
| 542 | typedef struct BCRYPT_ECDSASw_Sign |
|---|
| 543 | { |
|---|
| 544 | BCRYPT_ECCParam_t eccParm; /* In: EC curve parameters */ |
|---|
| 545 | BCRYPT_ECCSig_t sig; /* In: ECC Signature */ |
|---|
| 546 | unsigned char *hash; /* In: A pointer to hash string */ |
|---|
| 547 | unsigned char hashLen; /* In: Length of hash */ |
|---|
| 548 | char *k; /* In: A random integer k */ |
|---|
| 549 | char *privateKey; /* In: Private key */ |
|---|
| 550 | } BCRYPT_ECDSASw_Sign_t; |
|---|
| 551 | |
|---|
| 552 | |
|---|
| 553 | |
|---|
| 554 | /*************************************************************************** |
|---|
| 555 | Summary: |
|---|
| 556 | Parameters for a EC Scalar Multiplication. |
|---|
| 557 | |
|---|
| 558 | |
|---|
| 559 | Description: |
|---|
| 560 | This Structure defines the parameters for EC Scalar Multiplication. It contains EC curve parameters, |
|---|
| 561 | scalar, input point, and the output point. |
|---|
| 562 | |
|---|
| 563 | See Also: |
|---|
| 564 | BCRYPT_ECCParam, BCRYPT_ECCPoint, BCRYPT_ECCSig |
|---|
| 565 | BCRYPT_ECDSASw_Sign, BCRYPT_ECDSASw_Verify |
|---|
| 566 | |
|---|
| 567 | ****************************************************************************/ |
|---|
| 568 | typedef struct BCRYPT_ECDSASw_Multiply |
|---|
| 569 | { |
|---|
| 570 | BCRYPT_ECCParam_t eccParm; /* In: EC curve parameters */ |
|---|
| 571 | char *scalar; /* In: Scalar value */ |
|---|
| 572 | BCRYPT_ECCPoint_t inPoint; /* In: Input point */ |
|---|
| 573 | BCRYPT_ECCPoint_t outPoint; /* Out: output point, result of Scalar Multiplication */ |
|---|
| 574 | } BCRYPT_ECDSASw_Multiply_t; |
|---|
| 575 | |
|---|
| 576 | |
|---|
| 577 | |
|---|
| 578 | |
|---|
| 579 | /* ECDSA functions */ |
|---|
| 580 | |
|---|
| 581 | |
|---|
| 582 | /***************************************************************************** |
|---|
| 583 | Summary: |
|---|
| 584 | This function implements the ECDSA Verify algorithm in SW. |
|---|
| 585 | |
|---|
| 586 | |
|---|
| 587 | Description: |
|---|
| 588 | This function implements the ECDSA Verify algorithm in software. It is based on the ECDSA |
|---|
| 589 | implementation of the openssl code. The binaries of the openssl library is already included |
|---|
| 590 | into the build environment. |
|---|
| 591 | |
|---|
| 592 | |
|---|
| 593 | Calling Context: |
|---|
| 594 | The function shall be called from application level or from driver level, for example in Linux |
|---|
| 595 | during insmod. |
|---|
| 596 | |
|---|
| 597 | |
|---|
| 598 | Performance and Timing: |
|---|
| 599 | This is a synchronous/blocking function that will not return until it is done or failed. |
|---|
| 600 | |
|---|
| 601 | |
|---|
| 602 | Input: |
|---|
| 603 | hBcrypt - BCRYPT_Handle |
|---|
| 604 | inoutp_ecdsaSwIO - BCRYPT_ECDSASw_Verify_t, a ref/pointer to the parameters |
|---|
| 605 | for the SW implementation of the ECDSA Verify algorithm. |
|---|
| 606 | |
|---|
| 607 | |
|---|
| 608 | Returns: |
|---|
| 609 | BCRYPT_STATUS_eOK - success |
|---|
| 610 | BCRYPT_STATUS_eFAILED - failure |
|---|
| 611 | |
|---|
| 612 | |
|---|
| 613 | See Also: |
|---|
| 614 | BCrypt_ECDSASignSw, BCrypt_ECDSAMultiplySw |
|---|
| 615 | |
|---|
| 616 | ******************************************************************************/ |
|---|
| 617 | BCRYPT_STATUS_eCode BCrypt_ECDSAVerifySw( |
|---|
| 618 | BCRYPT_Handle hBcrypt, |
|---|
| 619 | BCRYPT_ECDSASw_Verify_t *inoutp_ecdsaSwIO |
|---|
| 620 | ); |
|---|
| 621 | |
|---|
| 622 | |
|---|
| 623 | |
|---|
| 624 | /***************************************************************************** |
|---|
| 625 | Summary: |
|---|
| 626 | This function implements the ECDSA Sign algorithm in SW. |
|---|
| 627 | |
|---|
| 628 | |
|---|
| 629 | Description: |
|---|
| 630 | This function implements the ECDSA Sign algorithm in software. It is based on the ECDSA |
|---|
| 631 | implementation of the openssl code. The binaries of the openssl library is already included |
|---|
| 632 | into the build environment. |
|---|
| 633 | |
|---|
| 634 | |
|---|
| 635 | Calling Context: |
|---|
| 636 | The function shall be called from application level or from driver level, for example in Linux |
|---|
| 637 | during insmod. |
|---|
| 638 | |
|---|
| 639 | |
|---|
| 640 | Performance and Timing: |
|---|
| 641 | This is a synchronous/blocking function that will not return until it is done or failed. |
|---|
| 642 | |
|---|
| 643 | |
|---|
| 644 | Input: |
|---|
| 645 | hBcrypt - BCRYPT_Handle |
|---|
| 646 | inoutp_ecdsaSwIO - BCRYPT_ECDSASw_Sign_t, a ref/pointer to the parameters |
|---|
| 647 | for the SW implementation of the ECDSA Sign algorithm. |
|---|
| 648 | |
|---|
| 649 | |
|---|
| 650 | Returns: |
|---|
| 651 | BCRYPT_STATUS_eOK - success |
|---|
| 652 | BCRYPT_STATUS_eFAILED - failure |
|---|
| 653 | |
|---|
| 654 | |
|---|
| 655 | See Also: |
|---|
| 656 | BCrypt_ECDSAVerifySw, BCrypt_ECDSAMultiplySw |
|---|
| 657 | |
|---|
| 658 | ******************************************************************************/ |
|---|
| 659 | BCRYPT_STATUS_eCode BCrypt_ECDSASignSw( |
|---|
| 660 | BCRYPT_Handle hBcrypt, |
|---|
| 661 | BCRYPT_ECDSASw_Sign_t *inoutp_ecdsaSwIO |
|---|
| 662 | ); |
|---|
| 663 | |
|---|
| 664 | |
|---|
| 665 | /***************************************************************************** |
|---|
| 666 | Summary: |
|---|
| 667 | This function cleans up the ECDSA paramter allocated by OpenSSL. |
|---|
| 668 | |
|---|
| 669 | |
|---|
| 670 | Description: |
|---|
| 671 | This function cleans the ECDSA paramter allocated by OpenSSL. Specifically, during the |
|---|
| 672 | call to ECDSASignSw the function allocates memory for the sig.r or sig.s |
|---|
| 673 | using the BN_bn2dec or BN_bn2hex these needs to be freed by calling the OPNESSL_free once. |
|---|
| 674 | Thius function allows the user of the ECDSASignSw to free up these memory |
|---|
| 675 | once it has done using them. |
|---|
| 676 | |
|---|
| 677 | Calling Context: |
|---|
| 678 | The function shall be called from application level or from driver level, for example in Linux |
|---|
| 679 | during insmod. |
|---|
| 680 | |
|---|
| 681 | Performance and Timing: |
|---|
| 682 | This is a synchronous/blocking function that will not return until it is done or failed. |
|---|
| 683 | |
|---|
| 684 | |
|---|
| 685 | Input: |
|---|
| 686 | hBcrypt - BCRYPT_Handle |
|---|
| 687 | inoutp_ecdsaSwIO - BCRYPT_ECDSASw_Sign_t, a ref/pointer to the parameters |
|---|
| 688 | for the SW implementation of the ECDSA Sign algorithm. |
|---|
| 689 | |
|---|
| 690 | |
|---|
| 691 | Returns: |
|---|
| 692 | BCRYPT_STATUS_eOK - success |
|---|
| 693 | BCRYPT_STATUS_eFAILED - failure |
|---|
| 694 | |
|---|
| 695 | |
|---|
| 696 | See Also: |
|---|
| 697 | BCrypt_ECDSAVerifySw, BCrypt_ECDSAMultiplySw |
|---|
| 698 | |
|---|
| 699 | ******************************************************************************/ |
|---|
| 700 | BCRYPT_STATUS_eCode BCrypt_Sign_ECDSAClean( |
|---|
| 701 | BCRYPT_Handle hBcrypt, |
|---|
| 702 | BCRYPT_ECDSASw_Sign_t *inoutp_ecdsaSwIO |
|---|
| 703 | ); |
|---|
| 704 | |
|---|
| 705 | |
|---|
| 706 | |
|---|
| 707 | /***************************************************************************** |
|---|
| 708 | Summary: |
|---|
| 709 | This function cleans up the ECDSA paramter allocated by OpenSSL. |
|---|
| 710 | |
|---|
| 711 | |
|---|
| 712 | Description: |
|---|
| 713 | This function cleans the ECDSA paramter allocated by OpenSSL. Specifically, during the |
|---|
| 714 | call to ECDSAMultiplySw the function allocates memory for the sig.r or sig.s |
|---|
| 715 | using the BN_bn2dec or BN_bn2hex these needs to be freed by calling the OPNESSL_free once. |
|---|
| 716 | Thius function allows the user of the ECDSAMultiplySw to free up these memory |
|---|
| 717 | once it has done using them. |
|---|
| 718 | |
|---|
| 719 | Calling Context: |
|---|
| 720 | The function shall be called from application level or from driver level, for example in Linux |
|---|
| 721 | during insmod. |
|---|
| 722 | |
|---|
| 723 | Performance and Timing: |
|---|
| 724 | This is a synchronous/blocking function that will not return until it is done or failed. |
|---|
| 725 | |
|---|
| 726 | |
|---|
| 727 | Input: |
|---|
| 728 | hBcrypt - BCRYPT_Handle |
|---|
| 729 | inoutp_ecdsaSwIO - BCRYPT_ECDSASw_Multiply_t, a ref/pointer to the parameters |
|---|
| 730 | for the SW implementation of the ECDSA Sign algorithm. |
|---|
| 731 | |
|---|
| 732 | |
|---|
| 733 | Returns: |
|---|
| 734 | BCRYPT_STATUS_eOK - success |
|---|
| 735 | BCRYPT_STATUS_eFAILED - failure |
|---|
| 736 | |
|---|
| 737 | |
|---|
| 738 | See Also: |
|---|
| 739 | BCrypt_Sign_ECDSAClean |
|---|
| 740 | |
|---|
| 741 | ******************************************************************************/ |
|---|
| 742 | BCRYPT_STATUS_eCode BCrypt_Multiply_ECDSAClean( |
|---|
| 743 | BCRYPT_Handle hBcrypt, |
|---|
| 744 | BCRYPT_ECDSASw_Multiply_t *inoutp_ecdsaSwIO |
|---|
| 745 | ); |
|---|
| 746 | |
|---|
| 747 | |
|---|
| 748 | |
|---|
| 749 | |
|---|
| 750 | /***************************************************************************** |
|---|
| 751 | Summary: |
|---|
| 752 | This function implements the EC Scalar Multiplication algorithm in SW. |
|---|
| 753 | |
|---|
| 754 | |
|---|
| 755 | Description: |
|---|
| 756 | This function implements theEC Scalar Multiplication algorithm in software. It is based on the |
|---|
| 757 | EC Scalar Multiplication implementation of the openssl code. The binaries of the openssl library |
|---|
| 758 | is already included into the build environment. |
|---|
| 759 | |
|---|
| 760 | |
|---|
| 761 | Calling Context: |
|---|
| 762 | The function shall be called from application level or from driver level, for example in Linux |
|---|
| 763 | during insmod. |
|---|
| 764 | |
|---|
| 765 | |
|---|
| 766 | Performance and Timing: |
|---|
| 767 | This is a synchronous/blocking function that will not return until it is done or failed. |
|---|
| 768 | |
|---|
| 769 | |
|---|
| 770 | Input: |
|---|
| 771 | hBcrypt - BCRYPT_Handle |
|---|
| 772 | inoutp_ecdsaSwIO - BCRYPT_ECDSASw_Multiply_t, a ref/pointer to the parameters |
|---|
| 773 | for the SW implementation of the EC Scalar Multiplication algorithm. |
|---|
| 774 | |
|---|
| 775 | |
|---|
| 776 | Returns: |
|---|
| 777 | BCRYPT_STATUS_eOK - success |
|---|
| 778 | BCRYPT_STATUS_eFAILED - failure |
|---|
| 779 | |
|---|
| 780 | |
|---|
| 781 | See Also: |
|---|
| 782 | BCrypt_ECDSASignSw, BCrypt_ECDSAVerifySw |
|---|
| 783 | |
|---|
| 784 | ******************************************************************************/ |
|---|
| 785 | BCRYPT_STATUS_eCode BCrypt_ECDSAMultiplySw( |
|---|
| 786 | BCRYPT_Handle hBcrypt, |
|---|
| 787 | BCRYPT_ECDSASw_Multiply_t *inoutp_ecdsaSwIO |
|---|
| 788 | ); |
|---|
| 789 | |
|---|
| 790 | |
|---|
| 791 | |
|---|
| 792 | /* Number conversion utility functions */ |
|---|
| 793 | typedef enum |
|---|
| 794 | { |
|---|
| 795 | BCRYPT_String_Format_Decimal = 0, |
|---|
| 796 | BCRYPT_String_Format_Hex |
|---|
| 797 | } BCRYPT_String_Format_t; |
|---|
| 798 | |
|---|
| 799 | |
|---|
| 800 | |
|---|
| 801 | /***************************************************************************** |
|---|
| 802 | Summary: |
|---|
| 803 | This function Converts Binary to String. |
|---|
| 804 | |
|---|
| 805 | |
|---|
| 806 | Description: |
|---|
| 807 | This function Converts Binary to String. It is based on the implementation of the openssl code. |
|---|
| 808 | The binaries of the openssl library is already included into the build environment. |
|---|
| 809 | |
|---|
| 810 | |
|---|
| 811 | Calling Context: |
|---|
| 812 | The function shall be called from application level or from driver level, for example in Linux |
|---|
| 813 | during insmod. |
|---|
| 814 | |
|---|
| 815 | |
|---|
| 816 | Performance and Timing: |
|---|
| 817 | This is a synchronous/blocking function that will not return until it is done or failed. |
|---|
| 818 | |
|---|
| 819 | |
|---|
| 820 | Input: |
|---|
| 821 | hBcrypt - BCRYPT_Handle |
|---|
| 822 | data - unsigned char, a ref/pointer to data to be converted . |
|---|
| 823 | byteLen - unsigned long, length of data in bytes. |
|---|
| 824 | format - BCRYPT_String_Format_t, format of input string. |
|---|
| 825 | |
|---|
| 826 | |
|---|
| 827 | Output: |
|---|
| 828 | outStr - char, a ref/pointer to output string. |
|---|
| 829 | |
|---|
| 830 | |
|---|
| 831 | Returns: |
|---|
| 832 | BCRYPT_STATUS_eOK - success |
|---|
| 833 | BCRYPT_STATUS_eFAILED - failure |
|---|
| 834 | |
|---|
| 835 | |
|---|
| 836 | See Also: |
|---|
| 837 | BCrypt_ConvStrToBin |
|---|
| 838 | |
|---|
| 839 | ******************************************************************************/ |
|---|
| 840 | BCRYPT_STATUS_eCode BCrypt_ConvBinToStr( |
|---|
| 841 | BCRYPT_Handle hBcrypt, |
|---|
| 842 | unsigned char *data, |
|---|
| 843 | unsigned long byteLen, |
|---|
| 844 | BCRYPT_String_Format_t format, |
|---|
| 845 | char *outStr |
|---|
| 846 | ); |
|---|
| 847 | |
|---|
| 848 | |
|---|
| 849 | /***************************************************************************** |
|---|
| 850 | Summary: |
|---|
| 851 | This function Converts String to Binary. |
|---|
| 852 | |
|---|
| 853 | |
|---|
| 854 | Description: |
|---|
| 855 | This function Converts String to Binary. It is based on the implementation of the openssl code. |
|---|
| 856 | The binaries of the openssl library is already included into the build environment. |
|---|
| 857 | |
|---|
| 858 | |
|---|
| 859 | Calling Context: |
|---|
| 860 | The function shall be called from application level or from driver level, for example in Linux |
|---|
| 861 | during insmod. |
|---|
| 862 | |
|---|
| 863 | |
|---|
| 864 | Performance and Timing: |
|---|
| 865 | This is a synchronous/blocking function that will not return until it is done or failed. |
|---|
| 866 | |
|---|
| 867 | |
|---|
| 868 | Input: |
|---|
| 869 | hBcrypt - BCRYPT_Handle |
|---|
| 870 | inStr - char, a ref/pointer to input string. |
|---|
| 871 | format - BCRYPT_String_Format_t, format of input string. |
|---|
| 872 | |
|---|
| 873 | |
|---|
| 874 | Output: |
|---|
| 875 | data - unsigned char, a ref/pointer to binary data. |
|---|
| 876 | byteLen - unsigned long, a ref/pointer to the length of data in bytes. |
|---|
| 877 | |
|---|
| 878 | |
|---|
| 879 | Returns: |
|---|
| 880 | BCRYPT_STATUS_eOK - success |
|---|
| 881 | BCRYPT_STATUS_eFAILED - failure |
|---|
| 882 | |
|---|
| 883 | |
|---|
| 884 | See Also: |
|---|
| 885 | BCrypt_ConvBinToStr |
|---|
| 886 | |
|---|
| 887 | ******************************************************************************/ |
|---|
| 888 | BCRYPT_STATUS_eCode BCrypt_ConvStrToBin( |
|---|
| 889 | BCRYPT_Handle hBcrypt, |
|---|
| 890 | char *inStr, |
|---|
| 891 | BCRYPT_String_Format_t format, |
|---|
| 892 | unsigned char *data, |
|---|
| 893 | unsigned long *byteLen |
|---|
| 894 | ); |
|---|
| 895 | |
|---|
| 896 | |
|---|
| 897 | #ifdef __cplusplus |
|---|
| 898 | } |
|---|
| 899 | #endif |
|---|
| 900 | |
|---|
| 901 | #endif /* BCRYPT_H__ */ |
|---|
| 902 | |
|---|
| 903 | |
|---|
| 904 | |
|---|
| 905 | |
|---|
| 906 | |
|---|
| 907 | |
|---|
| 908 | |
|---|