struct ll_crypto_hash *tfm;
struct capa_hmac_alg *alg;
int keylen;
- struct scatterlist sl = {
- .page = virt_to_page(capa),
- .offset = (unsigned long)(capa) % CFS_PAGE_SIZE,
- .length = offsetof(struct lustre_capa, lc_hmac),
- };
+ struct scatterlist sl;
if (capa_alg(capa) != CAPA_HMAC_ALG_SHA1) {
CERROR("unknown capability hmac algorithm!\n");
}
keylen = alg->ha_keylen;
+ sg_set_page(&sl, virt_to_page(capa),
+ offsetof(struct lustre_capa, lc_hmac),
+ (unsigned long)(capa) % CFS_PAGE_SIZE);
+
ll_crypto_hmac(tfm, key, &keylen, &sl, sl.length, hmac);
ll_crypto_free_hash(tfm);
int capa_encrypt_id(__u32 *d, __u32 *s, __u8 *key, int keylen)
{
struct ll_crypto_cipher *tfm;
- struct scatterlist sd = {
- .page = virt_to_page(d),
- .offset = (unsigned long)(d) % CFS_PAGE_SIZE,
- .length = 16,
- };
- struct scatterlist ss = {
- .page = virt_to_page(s),
- .offset = (unsigned long)(s) % CFS_PAGE_SIZE,
- .length = 16,
- };
+ struct scatterlist sd;
+ struct scatterlist ss;
struct blkcipher_desc desc;
unsigned int min;
int rc;
+ char alg[CRYPTO_MAX_ALG_NAME+1] = "aes";
ENTRY;
- tfm = ll_crypto_alloc_blkcipher("aes", 0, 0 );
+ /* passing "aes" in a variable instead of a constant string keeps gcc
+ * 4.3.2 happy */
+ tfm = ll_crypto_alloc_blkcipher(alg, 0, 0 );
if (tfm == NULL) {
CERROR("failed to load transform for aes\n");
RETURN(-EFAULT);
GOTO(out, rc);
}
+ sg_set_page(&sd, virt_to_page(d), 16,
+ (unsigned long)(d) % CFS_PAGE_SIZE);
+
+ sg_set_page(&ss, virt_to_page(s), 16,
+ (unsigned long)(s) % CFS_PAGE_SIZE);
desc.tfm = tfm;
desc.info = NULL;
desc.flags = 0;
int capa_decrypt_id(__u32 *d, __u32 *s, __u8 *key, int keylen)
{
struct ll_crypto_cipher *tfm;
- struct scatterlist sd = {
- .page = virt_to_page(d),
- .offset = (unsigned long)(d) % CFS_PAGE_SIZE,
- .length = 16,
- };
- struct scatterlist ss = {
- .page = virt_to_page(s),
- .offset = (unsigned long)(s) % CFS_PAGE_SIZE,
- .length = 16,
- };
+ struct scatterlist sd;
+ struct scatterlist ss;
struct blkcipher_desc desc;
unsigned int min;
int rc;
+ char alg[CRYPTO_MAX_ALG_NAME+1] = "aes";
ENTRY;
- tfm = ll_crypto_alloc_blkcipher("aes", 0, 0 );
+ /* passing "aes" in a variable instead of a constant string keeps gcc
+ * 4.3.2 happy */
+ tfm = ll_crypto_alloc_blkcipher(alg, 0, 0 );
if (tfm == NULL) {
CERROR("failed to load transform for aes\n");
RETURN(-EFAULT);
GOTO(out, rc);
}
+ sg_set_page(&sd, virt_to_page(d), 16,
+ (unsigned long)(d) % CFS_PAGE_SIZE);
+
+ sg_set_page(&ss, virt_to_page(s), 16,
+ (unsigned long)(s) % CFS_PAGE_SIZE);
+
desc.tfm = tfm;
desc.info = NULL;
desc.flags = 0;