--- gvpe/src/util.h 2011/03/08 17:34:26 1.30 +++ gvpe/src/util.h 2013/07/16 16:44:37 1.31 @@ -2,7 +2,7 @@ util.h -- process management and other utility functions Copyright (C) 1998-2002 Ivo Timmermans 2000-2002 Guus Sliepen - 2003-2011 Marc Lehmann + 2003-2013 Marc Lehmann This file is part of GVPE. @@ -44,6 +44,7 @@ #include "slog.h" #include "ev_cpp.h" #include "callback.h" +#include "global.h" typedef ev_tstamp tstamp; @@ -132,28 +133,6 @@ /*****************************************************************************/ -typedef u8 rsaclear[RSA_KEYLEN - RSA_OVERHEAD]; // challenge data; -typedef u8 rsacrypt[RSA_KEYLEN]; // encrypted challenge - -static inline void -rsa_encrypt (RSA *key, const rsaclear &chg, rsacrypt &encr) -{ - if (RSA_public_encrypt (sizeof chg, - (unsigned char *)&chg, (unsigned char *)&encr, - key, RSA_PKCS1_OAEP_PADDING) < 0) - fatal ("RSA_public_encrypt error"); -} - -static inline bool -rsa_decrypt (RSA *key, const rsacrypt &encr, rsaclear &chg) -{ - return RSA_private_decrypt (sizeof encr, - (unsigned char *)&encr, (unsigned char *)&chg, - key, RSA_PKCS1_OAEP_PADDING) > 0; -} - -/*****************************************************************************/ - // run work_cb in another thread, call done_cb in main thread when finished // only one work_cb will execute at any one time. void async (callback work_cb, callback done_cb);