[mainline update] Populate RSA key attributes in mbedtls context (#1288)

* Populate RSA key attributes in mbedtls context

* Fix formatting

---------

Co-authored-by: Rahul Kar <karahulx@amazon.com>
pull/1291/head
Dakshit Babbar 3 months ago committed by GitHub
parent 349d8a87d4
commit 86d6312da0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1062,24 +1062,22 @@ static CK_RV p11_rsa_ctx_init( mbedtls_pk_context * pk,
xResult = CKR_FUNCTION_FAILED; xResult = CKR_FUNCTION_FAILED;
} }
/* CK_ATTRIBUTE pxAttrs[ 8 ] =
* TODO: corePKCS11 does not allow exporting RSA public attributes. {
* This function should be updated to properly initialize the { .type = CKA_MODULUS, .ulValueLen = sizeof( mbedtls_mpi ), .pValue = &( pxMbedRsaCtx->N ) },
* mbedtls_rsa_context when this is addressed. { .type = CKA_PUBLIC_EXPONENT, .ulValueLen = sizeof( mbedtls_mpi ), .pValue = &( pxMbedRsaCtx->E ) },
*/ { .type = CKA_PRIME_1, .ulValueLen = sizeof( mbedtls_mpi ), .pValue = &( pxMbedRsaCtx->P ) },
{ .type = CKA_PRIME_2, .ulValueLen = sizeof( mbedtls_mpi ), .pValue = &( pxMbedRsaCtx->Q ) },
/* CK_ATTRIBUTE pxAttrs[ 2 ] = */ { .type = CKA_PRIVATE_EXPONENT, .ulValueLen = sizeof( mbedtls_mpi ), .pValue = &( pxMbedRsaCtx->D ) },
/* { */ { .type = CKA_EXPONENT_1, .ulValueLen = sizeof( mbedtls_mpi ), .pValue = &( pxMbedRsaCtx->DP ) },
/* { .type = CKA_MODULUS, .ulValueLen = 0, .pValue = NULL }, */ { .type = CKA_EXPONENT_2, .ulValueLen = sizeof( mbedtls_mpi ), .pValue = &( pxMbedRsaCtx->DQ ) },
/* { .type = CKA_PUBLIC_EXPONENT, .ulValueLen = 0, .pValue = NULL }, */ { .type = CKA_COEFFICIENT, .ulValueLen = sizeof( mbedtls_mpi ), .pValue = &( pxMbedRsaCtx->QP ) },
/* { .type = CKA_PRIME_1, .ulValueLen = 0, .pValue = NULL }, */ };
/* { .type = CKA_PRIME_2, .ulValueLen = 0, .pValue = NULL }, */
/* { .type = CKA_EXPONENT_1, .ulValueLen = 0, .pValue = NULL }, */ xResult = pxFunctionList->C_GetAttributeValue( xSessionHandle,
/* { .type = CKA_EXPONENT_2, .ulValueLen = 0, .pValue = NULL }, */ xPkHandle,
/* { .type = CKA_COEFFICIENT, .ulValueLen = 0, .pValue = NULL }, */ pxAttrs,
/* }; */ sizeof( pxAttrs ) / sizeof( CK_ATTRIBUTE ) );
( void ) pxMbedRsaCtx;
if( xResult == CKR_OK ) if( xResult == CKR_OK )
{ {

Loading…
Cancel
Save