keyItem.type = siBuffer;
keyItem.data = (unsigned char*)secret.c_str();
keyItem.len = secret.length();
- key = PK11_ImportSymKey(slot, mechanism, PK11_OriginUnwrap, CKA_ENCRYPT,
- &keyItem, NULL);
+ using ceph::crypto::PK11_ImportSymKey_FIPS;
+ key = PK11_ImportSymKey_FIPS(slot, mechanism, PK11_OriginUnwrap, CKA_ENCRYPT,
+ &keyItem, NULL);
if (!key) {
err << "cannot convert AES key for NSS: " << PR_GetError();
return -1;
keyItem.type = siBuffer;
keyItem.data = (unsigned char*)key;
keyItem.len = length;
- symkey = PK11_ImportSymKey(slot, cktype, PK11_OriginUnwrap,
- CKA_SIGN, &keyItem, NULL);
+ symkey = PK11_ImportSymKey_FIPS(slot, cktype, PK11_OriginUnwrap,
+ CKA_SIGN, &keyItem, NULL);
assert(symkey);
SECItem param;
param.type = siBuffer;
#define dout_subsys ceph_subsys_rgw
using namespace rgw;
+using ceph::crypto::PK11_ImportSymKey_FIPS;
/**
* Encryption in CTR mode. offset is used as IV for each block.
keyItem.data = key;
keyItem.len = AES_256_KEYSIZE;
- symkey = PK11_ImportSymKey(slot, CKM_AES_CTR, PK11_OriginUnwrap, CKA_UNWRAP, &keyItem, NULL);
+ symkey = PK11_ImportSymKey_FIPS(slot, CKM_AES_CTR, PK11_OriginUnwrap, CKA_UNWRAP, &keyItem, NULL);
if (symkey) {
static_assert(sizeof(ctr_params.cb) >= AES_256_IVSIZE, "Must fit counter");
ctr_params.ulCounterBits = 128;
keyItem.type = siBuffer;
keyItem.data = const_cast<unsigned char*>(&key[0]);
keyItem.len = AES_256_KEYSIZE;
- symkey = PK11_ImportSymKey(slot, CKM_AES_CBC, PK11_OriginUnwrap, CKA_UNWRAP, &keyItem, NULL);
+ symkey = PK11_ImportSymKey_FIPS(slot, CKM_AES_CBC, PK11_OriginUnwrap, CKA_UNWRAP, &keyItem, NULL);
if (symkey) {
memcpy(ctr_params.iv, iv, AES_256_IVSIZE);
ivItem.type = siBuffer;
param = PK11_ParamFromIV(CKM_AES_ECB, NULL);
if (param) {
- symkey = PK11_ImportSymKey(slot, CKM_AES_ECB, PK11_OriginUnwrap, CKA_UNWRAP, &keyItem, NULL);
+ symkey = PK11_ImportSymKey_FIPS(slot, CKM_AES_ECB, PK11_OriginUnwrap, CKA_UNWRAP, &keyItem, NULL);
if (symkey) {
ectx = PK11_CreateContextBySymKey(CKM_AES_ECB, CKA_ENCRYPT, symkey, param);
if (ectx) {