components/openssl/openssl-1.0.1-fips-140/engines/pkcs11/e_pk11_pub.c
changeset 1665 9e945128be3b
parent 1604 b6e3e1ed52a5
child 1692 dce38b815f7d
equal deleted inserted replaced
1664:128a1af2859e 1665:9e945128be3b
     1 /*
     1 /*
     2  * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
     3  *
     3  *
     4  */
     4  */
     5 
     5 
     6 /* crypto/engine/e_pk11_pub.c */
     6 /* crypto/engine/e_pk11_pub.c */
     7 /*
     7 /*
   125 static int pk11_RSA_init(RSA *rsa);
   125 static int pk11_RSA_init(RSA *rsa);
   126 static int pk11_RSA_finish(RSA *rsa);
   126 static int pk11_RSA_finish(RSA *rsa);
   127 static int pk11_RSA_sign(int type, const unsigned char *m, unsigned int m_len,
   127 static int pk11_RSA_sign(int type, const unsigned char *m, unsigned int m_len,
   128 	unsigned char *sigret, unsigned int *siglen, const RSA *rsa);
   128 	unsigned char *sigret, unsigned int *siglen, const RSA *rsa);
   129 static int pk11_RSA_verify(int dtype, const unsigned char *m,
   129 static int pk11_RSA_verify(int dtype, const unsigned char *m,
   130 	unsigned int m_len, unsigned char *sigbuf, unsigned int siglen,
   130 	unsigned int m_len, const unsigned char *sigbuf, unsigned int siglen,
   131 	const RSA *rsa);
   131 	const RSA *rsa);
   132 EVP_PKEY *pk11_load_privkey(ENGINE*, const char *privkey_id,
   132 EVP_PKEY *pk11_load_privkey(ENGINE*, const char *privkey_id,
   133 	UI_METHOD *ui_method, void *callback_data);
   133 	UI_METHOD *ui_method, void *callback_data);
   134 EVP_PKEY *pk11_load_pubkey(ENGINE*, const char *pubkey_id,
   134 EVP_PKEY *pk11_load_pubkey(ENGINE*, const char *pubkey_id,
   135 	UI_METHOD *ui_method, void *callback_data);
   135 	UI_METHOD *ui_method, void *callback_data);
  1101 	pk11_return_session(sp, OP_RSA);
  1101 	pk11_return_session(sp, OP_RSA);
  1102 	return (ret);
  1102 	return (ret);
  1103 	}
  1103 	}
  1104 
  1104 
  1105 static int pk11_RSA_verify(int type, const unsigned char *m,
  1105 static int pk11_RSA_verify(int type, const unsigned char *m,
  1106 	unsigned int m_len, unsigned char *sigbuf, unsigned int siglen,
  1106 	unsigned int m_len, const unsigned char *sigbuf, unsigned int siglen,
  1107 	const RSA *rsa)
  1107 	const RSA *rsa)
  1108 	{
  1108 	{
  1109 	X509_SIG sig;
  1109 	X509_SIG sig;
  1110 	ASN1_TYPE parameter;
  1110 	ASN1_TYPE parameter;
  1111 	int i, j;
  1111 	int i, j;
  1195 			{
  1195 			{
  1196 			PK11err_add_data(PK11_F_RSA_VERIFY, PK11_R_VERIFYINIT,
  1196 			PK11err_add_data(PK11_F_RSA_VERIFY, PK11_R_VERIFYINIT,
  1197 			    rv);
  1197 			    rv);
  1198 			goto err;
  1198 			goto err;
  1199 			}
  1199 			}
  1200 		rv = pFuncList->C_Verify(sp->session, s, i, sigbuf,
  1200 		rv = pFuncList->C_Verify(sp->session, s, i,
  1201 			(CK_ULONG)siglen);
  1201 			(CK_BYTE_PTR)sigbuf, (CK_ULONG)siglen);
  1202 
  1202 
  1203 		if (rv != CKR_OK)
  1203 		if (rv != CKR_OK)
  1204 			{
  1204 			{
  1205 			PK11err_add_data(PK11_F_RSA_VERIFY, PK11_R_VERIFY, rv);
  1205 			PK11err_add_data(PK11_F_RSA_VERIFY, PK11_R_VERIFY, rv);
  1206 			goto err;
  1206 			goto err;