add Gnuk specific change to rsa

This commit is contained in:
NIIBE Yutaka 2013-03-19 14:19:11 +09:00
parent eabcef995c
commit 46eb059e50
2 changed files with 13 additions and 5 deletions

View File

@ -490,7 +490,7 @@ int rsa_rsassa_pss_sign( rsa_context *ctx,
int hash_id, int hash_id,
unsigned int hashlen, unsigned int hashlen,
const unsigned char *hash, const unsigned char *hash,
unsigned char *sig ); const unsigned char *sig );
/** /**
* \brief Generic wrapper to perform a PKCS#1 verification using the * \brief Generic wrapper to perform a PKCS#1 verification using the
@ -521,7 +521,7 @@ int rsa_pkcs1_verify( rsa_context *ctx,
int hash_id, int hash_id,
unsigned int hashlen, unsigned int hashlen,
const unsigned char *hash, const unsigned char *hash,
unsigned char *sig ); const unsigned char *sig );
/** /**
* \brief Perform a PKCS#1 v1.5 verification (RSASSA-PKCS1-v1_5-VERIFY) * \brief Perform a PKCS#1 v1.5 verification (RSASSA-PKCS1-v1_5-VERIFY)
@ -544,7 +544,7 @@ int rsa_rsassa_pkcs1_v15_verify( rsa_context *ctx,
int hash_id, int hash_id,
unsigned int hashlen, unsigned int hashlen,
const unsigned char *hash, const unsigned char *hash,
unsigned char *sig ); const unsigned char *sig );
/** /**
* \brief Perform a PKCS#1 v2.1 PSS verification (RSASSA-PSS-VERIFY) * \brief Perform a PKCS#1 v2.1 PSS verification (RSASSA-PSS-VERIFY)

View File

@ -132,6 +132,7 @@ cleanup:
#endif #endif
#if 0
/* /*
* Check a public RSA key * Check a public RSA key
*/ */
@ -216,6 +217,7 @@ cleanup:
return( 0 ); return( 0 );
} }
#endif
/* /*
* Do an RSA public key operation * Do an RSA public key operation
@ -267,11 +269,13 @@ int rsa_private( rsa_context *ctx,
MPI_CHK( mpi_read_binary( &T, input, ctx->len ) ); MPI_CHK( mpi_read_binary( &T, input, ctx->len ) );
#if 0
if( mpi_cmp_mpi( &T, &ctx->N ) >= 0 ) if( mpi_cmp_mpi( &T, &ctx->N ) >= 0 )
{ {
mpi_free( &T ); mpi_free( &T );
return( POLARSSL_ERR_RSA_BAD_INPUT_DATA ); return( POLARSSL_ERR_RSA_BAD_INPUT_DATA );
} }
#endif
#if defined(POLARSSL_RSA_NO_CRT) #if defined(POLARSSL_RSA_NO_CRT)
MPI_CHK( mpi_exp_mod( &T, &T, &ctx->D, &ctx->N, &ctx->RN ) ); MPI_CHK( mpi_exp_mod( &T, &T, &ctx->D, &ctx->N, &ctx->RN ) );
@ -974,6 +978,7 @@ int rsa_rsassa_pkcs1_v15_sign( rsa_context *ctx,
: rsa_private( ctx, sig, sig ) ); : rsa_private( ctx, sig, sig ) );
} }
#if 0
/* /*
* Do an RSA operation to sign the message digest * Do an RSA operation to sign the message digest
*/ */
@ -1002,6 +1007,7 @@ int rsa_pkcs1_sign( rsa_context *ctx,
return( POLARSSL_ERR_RSA_INVALID_PADDING ); return( POLARSSL_ERR_RSA_INVALID_PADDING );
} }
} }
#endif
#if defined(POLARSSL_PKCS1_V21) #if defined(POLARSSL_PKCS1_V21)
/* /*
@ -1143,7 +1149,7 @@ int rsa_rsassa_pkcs1_v15_verify( rsa_context *ctx,
int hash_id, int hash_id,
unsigned int hashlen, unsigned int hashlen,
const unsigned char *hash, const unsigned char *hash,
unsigned char *sig ) const unsigned char *sig )
{ {
int ret; int ret;
size_t len, siglen; size_t len, siglen;
@ -1243,6 +1249,7 @@ int rsa_rsassa_pkcs1_v15_verify( rsa_context *ctx,
return( POLARSSL_ERR_RSA_INVALID_PADDING ); return( POLARSSL_ERR_RSA_INVALID_PADDING );
} }
#if 0
/* /*
* Do an RSA operation and check the message digest * Do an RSA operation and check the message digest
*/ */
@ -1251,7 +1258,7 @@ int rsa_pkcs1_verify( rsa_context *ctx,
int hash_id, int hash_id,
unsigned int hashlen, unsigned int hashlen,
const unsigned char *hash, const unsigned char *hash,
unsigned char *sig ) const unsigned char *sig )
{ {
switch( ctx->padding ) switch( ctx->padding )
{ {
@ -1269,6 +1276,7 @@ int rsa_pkcs1_verify( rsa_context *ctx,
return( POLARSSL_ERR_RSA_INVALID_PADDING ); return( POLARSSL_ERR_RSA_INVALID_PADDING );
} }
} }
#endif
/* /*
* Free the components of an RSA key * Free the components of an RSA key