DO NOT constify RSA* in RSA_sign() and RSA_verify(), since there are function
[openssl.git] / crypto / rsa / rsa.h
index b2e25e4e7c714a73449f437a107a002ab983c941..12689fc22dd5b2fac339cabaf72f9fe27809119e 100644 (file)
@@ -114,7 +114,11 @@ typedef struct rsa_meth_st
        int (*rsa_verify)(int dtype,
                const unsigned char *m, unsigned int m_length,
                unsigned char *sigbuf, unsigned int siglen, const RSA *rsa);
-
+/* If this callback is NULL, the builtin software RSA key-gen will be used. This
+ * is for behavioural compatibility whilst the code gets rewired, but one day
+ * it would be nice to assume there are no such things as "builtin software"
+ * implementations. */
+       int (*rsa_keygen)(RSA *rsa, int bits, unsigned long e, BN_GENCB *cb);
        } RSA_METHOD;
 
 struct rsa_st
@@ -170,6 +174,12 @@ struct rsa_st
  */
 #define RSA_FLAG_SIGN_VER              0x40
 
+#define RSA_FLAG_NO_BLINDING           0x80 /* new with 0.9.6j and 0.9.7b; the built-in
+                                              * RSA implementation now uses blinding by
+                                              * default (ignoring RSA_FLAG_BLINDING),
+                                              * but other engines might not need it
+                                              */
+
 #define RSA_PKCS1_PADDING      1
 #define RSA_SSLV23_PADDING     2
 #define RSA_NO_PADDING         3
@@ -183,8 +193,16 @@ struct rsa_st
 RSA *  RSA_new(void);
 RSA *  RSA_new_method(ENGINE *engine);
 int    RSA_size(const RSA *);
+
+/* Deprecated version */
+#ifndef OPENSSL_NO_DEPRECATED
 RSA *  RSA_generate_key(int bits, unsigned long e,void
                (*callback)(int,int,void *),void *cb_arg);
+#endif /* !defined(OPENSSL_NO_DEPRECATED) */
+
+/* New version */
+int    RSA_generate_key_ex(RSA *rsa, int bits, unsigned long e, BN_GENCB *cb);
+
 int    RSA_check_key(const RSA *);
        /* next 4 return -1 on error */
 int    RSA_public_encrypt(int flen, const unsigned char *from,