Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <openssl/engine.h>
- #include <openssl/sha.h>
- #include <openssl/aes.h>
- #include <openssl/rsa.h>
- #include <openssl/evp.h>
- #include <openssl/async.h>
- #include <openssl/bn.h>
- #include <openssl/crypto.h>
- #include <openssl/ssl.h>
- #include <openssl/modes.h>
- /* Engine Id and Name */
- static const char *engine_dasync_id = "dasync";
- static const char *engine_dasync_name = "Dummy Async engine support";
- static int dasync_pub_enc(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding) {
- printf("dasync_pub_enc\n");
- return 0;
- }
- static int dasync_pub_dec(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding) {
- printf("dasync_pub_dec\n");
- return 0;
- }
- static int dasync_rsa_priv_enc(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding){
- printf("dasync_rsa_priv_enc\n");
- return 0;
- }
- static int dasync_rsa_priv_dec(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding){
- printf("dasync_rsa_priv_dec\n");
- return 0;
- }
- static RSA_METHOD *dasync_rsa_method = NULL;
- static int bind_dasync(ENGINE *e){
- /* Setup RSA_METHOD */
- if ((dasync_rsa_method = RSA_meth_new("Dummy Async RSA method", 0)) == NULL
- || RSA_meth_set_pub_enc(dasync_rsa_method, dasync_pub_enc) == 0
- || RSA_meth_set_pub_dec(dasync_rsa_method, dasync_pub_dec) == 0
- || RSA_meth_set_priv_enc(dasync_rsa_method, dasync_rsa_priv_enc) == 0
- || RSA_meth_set_priv_dec(dasync_rsa_method, dasync_rsa_priv_dec) == 0
- ) {
- return 0;
- }
- if (!ENGINE_set_id(e, engine_dasync_id)
- || !ENGINE_set_name(e, engine_dasync_name)
- || !ENGINE_set_RSA(e, dasync_rsa_method)
- ) {
- return 0;
- }
- return 1;
- }
- static int bind_helper(ENGINE *e, const char *id){
- if (!bind_dasync(e)){
- printf("2_Error: Inside Bind helper\n");
- return 0;
- }
- return 1;
- }
- IMPLEMENT_DYNAMIC_BIND_FN(bind_helper)
- IMPLEMENT_DYNAMIC_CHECK_FN()
Advertisement
Add Comment
Please, Sign In to add comment