**********/
CryptoLib::SigBuf CryptoLib::esignSig(byte* dataBuf,
const unsigned int dataLen,
- CryptoLib::esignPriv privKey) {
+ const CryptoLib::esignPriv& privKey) {
// a linear congruential random num gen
LC_RNG rng(time(NULL));
SecByteBlock signature(privKey.SignatureLength());
* and the public key
**********/
bool CryptoLib::esignVer(byte* dataBuf, const unsigned int dataLen,
- SigBuf signature, CryptoLib::esignPub pubKey) {
+ SigBuf signature, const CryptoLib::esignPub& pubKey) {
if (pubKey.VerifyMessage(dataBuf, dataLen, signature, signature.size())) {
return true;
}
// asymmetric signature functions
- SigBuf esignSig(byte*, const unsigned int,
- esignPriv);
- bool esignVer(byte*, const unsigned int, SigBuf, esignPub);
+ SigBuf esignSig(byte*, const unsigned int, const esignPriv&);
+ bool esignVer(byte*, const unsigned int, SigBuf, const esignPub&);
SigBuf rsaSig(byte*, const unsigned int, rsaPriv);
bool rsaVer(byte*, const unsigned int, SigBuf, rsaPub);
return sizeof(data);
}
- void sign_extcap(esignPriv privKey) {
+ void sign_extcap(const esignPriv& privKey) {
//byte capArray[sizeof(data)];
//memcpy(capArray, &data, sizeof(data));
SigBuf signature;
}
- bool verif_extcap (esignPub pubKey) {
+ bool verif_extcap (const esignPub& pubKey) {
//byte capArray[sizeof(data)];
//memcpy(capArray, &data, sizeof(data));
int shutdown_start();
int shutdown_final();
- esignPub getPubKey() { return myPubKey; }
- esignPriv getPrvKey() { return myPrivKey; }
+ esignPub& getPubKey() { return myPubKey; }
+ esignPriv& getPrvKey() { return myPrivKey; }
int hash_dentry(inodeno_t ino, const string& s) {
return 0; // fixme
//const string get_str_key() {
//return pub_str_key;
//}
- const esignPub get_key() {
- if (!keyConvert)
+ const esignPub& get_key() {
+ if (!keyConvert) {
pub_key = _fromStr_esignPubKey(string(pub_str_key, sizeof(pub_str_key)));
+ keyConvert = true;
+ }
return pub_key;
}
+ void prepare_mon_key() {
+ pub_key = _fromStr_esignPubKey(string(pub_str_key, sizeof(pub_str_key)));
+ keyConvert = true;
+ }
+
void encode(bufferlist& blist) {
blist.append((char*)&epoch, sizeof(epoch));
blist.append((char*)&num_mon, sizeof(num_mon));
whoami = id;
messenger = m;
monmap = mm;
+ monmap->prepare_mon_key();
osdmap = 0;
boot_epoch = 0;
// have i already verified this cap?
if (!cap_cache->prev_verified(cap->get_id())) {
- //cout << "Verifying an unseen capability" << endl;
+
// actually verify
utime_t justver_time_start = g_clock.now();
if (cap->verif_extcap(monmap->get_key())) {
//<< " in " << *pg
<< endl;
- utime_t read_time_start = g_clock.now();
+ //utime_t read_time_start = g_clock.now();
+ utime_t read_time_start;
+ if (outstanding_updates.count(op->get_reqid()) != 0)
+ read_time_start = outstanding_updates[op->get_reqid()];
+ else
+ read_time_start = g_clock.now();
utime_t sec_time_start = g_clock.now();
if (g_conf.secure_io) {
// do we have group cached? if not, update group
// we will lose execution control here! re-gain on reply
if (user_groups.count(my_hash) == 0) {
+ outstanding_updates[op->get_reqid()] = read_time_start;
update_group(op->get_client_inst(), my_hash, op);
return;
}
const char *opname = MOSDOp::get_opname(op->get_op());
- utime_t write_time_start = g_clock.now();
+ utime_t write_time_start;
+ if (outstanding_updates.count(op->get_reqid()) != 0) {
+ write_time_start = outstanding_updates[op->get_reqid()];
+ cout << "Using stored time " << write_time_start << " for request " <<
+ op->get_reqid() << endl;
+ }
+ else
+ write_time_start = g_clock.now();
// are any peers missing this?
for (unsigned i=1; i<pg->acting.size(); i++) {
// do we have group cached? if not, update group
// we will lose execution control here! re-gain on reply
if (user_groups.count(my_hash) == 0) {
+ cout << "Setting the time " << write_time_start <<
+ " for request " << op->get_reqid() << endl;
+ outstanding_updates[op->get_reqid()] = write_time_start;
update_group(op->get_client_inst(), my_hash, op);
return;
}
utime_t write_time_end = g_clock.now();
if (op->get_op() == OSD_OP_WRITE &&
op->get_source().is_client())
- cout << "Write time " << write_time_end - write_time_start << endl;
+ cout << "Write time " << write_time_end - write_time_start << endl <<
+ "with write_time_end " << write_time_end << endl;
}
map<hash_t, CapGroup> user_groups;
map<hash_t, list<Message*> >update_waiter_op;
void handle_osd_update_reply(MOSDUpdateReply *m);
+ // requests that are had their hashs updated
+ map<reqid_t, utime_t> outstanding_updates;
// per-pg locking (serializing)
hash_set<pg_t> pg_lock;