"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/crypto_backend/crypto_nss.c" between
cryptsetup-2.3.6.tar.xz and cryptsetup-2.4.0.tar.xz

About: cryptsetup is a utility used to conveniently setup disk encryption based on the dm-crypt kernel module. These include plain dm-crypt volumes, LUKS volumes, loop-AES and TrueCrypt compatible format.

crypto_nss.c  (cryptsetup-2.3.6.tar.xz):crypto_nss.c  (cryptsetup-2.4.0.tar.xz)
skipping to change at line 227 skipping to change at line 227
noParams.data = 0; noParams.data = 0;
noParams.len = 0; noParams.len = 0;
h = malloc(sizeof(*h)); h = malloc(sizeof(*h));
if (!h) if (!h)
return -ENOMEM; return -ENOMEM;
memset(ctx, 0, sizeof(*ctx)); memset(ctx, 0, sizeof(*ctx));
h->hash = _get_alg(name); h->hash = _get_alg(name);
if (!h->hash) if (!h->hash)
goto bad; goto err;
h->slot = PK11_GetInternalKeySlot(); h->slot = PK11_GetInternalKeySlot();
if (!h->slot) if (!h->slot)
goto bad; goto err;
h->key = PK11_ImportSymKey(h->slot, h->hash->ck_type, PK11_OriginUnwrap, h->key = PK11_ImportSymKey(h->slot, h->hash->ck_type, PK11_OriginUnwrap,
CKA_SIGN, &keyItem, NULL); CKA_SIGN, &keyItem, NULL);
if (!h->key) if (!h->key)
goto bad; goto err;
h->md = PK11_CreateContextBySymKey(h->hash->ck_type, CKA_SIGN, h->key, h->md = PK11_CreateContextBySymKey(h->hash->ck_type, CKA_SIGN, h->key,
&noParams); &noParams);
if (!h->md) if (!h->md)
goto bad; goto err;
if (PK11_DigestBegin(h->md) != SECSuccess) if (PK11_DigestBegin(h->md) != SECSuccess)
goto bad; goto err;
*ctx = h; *ctx = h;
return 0; return 0;
bad: err:
crypt_hmac_destroy(h); crypt_hmac_destroy(h);
return -EINVAL; return -EINVAL;
} }
static int crypt_hmac_restart(struct crypt_hmac *ctx) static int crypt_hmac_restart(struct crypt_hmac *ctx)
{ {
if (PK11_DigestBegin(ctx->md) != SECSuccess) if (PK11_DigestBegin(ctx->md) != SECSuccess)
return -EINVAL; return -EINVAL;
return 0; return 0;
skipping to change at line 305 skipping to change at line 305
PK11_FreeSymKey(ctx->key); PK11_FreeSymKey(ctx->key);
if (ctx->slot) if (ctx->slot)
PK11_FreeSlot(ctx->slot); PK11_FreeSlot(ctx->slot);
if (ctx->md) if (ctx->md)
PK11_DestroyContext(ctx->md, PR_TRUE); PK11_DestroyContext(ctx->md, PR_TRUE);
memset(ctx, 0, sizeof(*ctx)); memset(ctx, 0, sizeof(*ctx));
free(ctx); free(ctx);
} }
/* RNG */ /* RNG */
int crypt_backend_rng(char *buffer, size_t length, int quality, int fips) int crypt_backend_rng(char *buffer, size_t length, int quality __attribute__((un used)), int fips)
{ {
if (fips) if (fips)
return -EINVAL; return -EINVAL;
if (PK11_GenerateRandom((unsigned char *)buffer, length) != SECSuccess) if (PK11_GenerateRandom((unsigned char *)buffer, length) != SECSuccess)
return -EINVAL; return -EINVAL;
return 0; return 0;
} }
skipping to change at line 384 skipping to change at line 384
return crypt_cipher_encrypt_kernel(&ctx->ck, in, out, length, iv, iv_leng th); return crypt_cipher_encrypt_kernel(&ctx->ck, in, out, length, iv, iv_leng th);
} }
int crypt_cipher_decrypt(struct crypt_cipher *ctx, int crypt_cipher_decrypt(struct crypt_cipher *ctx,
const char *in, char *out, size_t length, const char *in, char *out, size_t length,
const char *iv, size_t iv_length) const char *iv, size_t iv_length)
{ {
return crypt_cipher_decrypt_kernel(&ctx->ck, in, out, length, iv, iv_leng th); return crypt_cipher_decrypt_kernel(&ctx->ck, in, out, length, iv, iv_leng th);
} }
bool crypt_cipher_kernel_only(struct crypt_cipher *ctx) bool crypt_cipher_kernel_only(struct crypt_cipher *ctx __attribute__((unused)))
{ {
return true; return true;
} }
int crypt_bitlk_decrypt_key(const void *key, size_t key_length, int crypt_bitlk_decrypt_key(const void *key, size_t key_length,
const char *in, char *out, size_t length, const char *in, char *out, size_t length,
const char *iv, size_t iv_length, const char *iv, size_t iv_length,
const char *tag, size_t tag_length) const char *tag, size_t tag_length)
{ {
return crypt_bitlk_decrypt_key_kernel(key, key_length, in, out, length, return crypt_bitlk_decrypt_key_kernel(key, key_length, in, out, length,
 End of changes. 8 change blocks. 
8 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)