blob: 9d866ac728f4eba5022f95ce834b2c00ef041ffc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
*
* Copyright (C) 2010-2011 Dreamhost
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software
* Foundation. See file COPYING.
*
*/
#include <pthread.h>
#include <stdlib.h>
#include "common/config.h"
#include "common/ceph_context.h"
#include "auth/Crypto.h"
#include "ceph_crypto.h"
void ceph::crypto::shutdown();
#ifdef USE_CRYPTOPP
void ceph::crypto::init(CephContext *cct)
{
}
void ceph::crypto::shutdown()
{
}
// nothing
ceph::crypto::HMACSHA1::~HMACSHA1()
{
}
#elif USE_NSS
void ceph::crypto::init(CephContext *cct)
{
SECStatus s;
if (cct->_conf->nss_db_path.empty()) {
s = NSS_NoDB_Init(NULL);
} else {
s = NSS_Init(cct->_conf->nss_db_path.c_str());
}
assert(s == SECSuccess);
}
void ceph::crypto::shutdown()
{
SECStatus s;
s = NSS_Shutdown();
assert(s == SECSuccess);
}
ceph::crypto::HMACSHA1::~HMACSHA1()
{
PK11_DestroyContext(ctx, PR_TRUE);
PK11_FreeSymKey(symkey);
PK11_FreeSlot(slot);
}
#else
# error "No supported crypto implementation found."
#endif
|