Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1556405 > unrolled thread
| Started by | Stephan Müller <smueller@chronox.de> |
|---|---|
| First post | 2017-01-11 12:20 +0100 |
| Last post | 2017-01-12 12:30 +0100 |
| Articles | 3 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v4 2/3] drivers: crypto: Add the Virtual Function driver for CPT Stephan Müller <smueller@chronox.de> - 2017-01-11 12:20 +0100
Re: [PATCH v4 2/3] drivers: crypto: Add the Virtual Function driver for CPT Stephan Müller <smueller@chronox.de> - 2017-01-11 13:40 +0100
Re: [PATCH v4 2/3] drivers: crypto: Add the Virtual Function driver for CPT Stephan Müller <smueller@chronox.de> - 2017-01-12 12:30 +0100
| From | Stephan Müller <smueller@chronox.de> |
|---|---|
| Date | 2017-01-11 12:20 +0100 |
| Subject | Re: [PATCH v4 2/3] drivers: crypto: Add the Virtual Function driver for CPT |
| Message-ID | <sYp6G-6cY-29@gated-at.bofh.it> |
Am Mittwoch, 11. Januar 2017, 10:56:50 CET schrieb George Cherian:
Hi George,
> +int cvm_enc_dec_setkey(struct crypto_ablkcipher *cipher, const u8 *key,
> + u32 keylen)
> +{
> + struct crypto_tfm *tfm = crypto_ablkcipher_tfm(cipher);
> + struct cvm_enc_ctx *ctx = crypto_tfm_ctx(tfm);
> +
> + if ((keylen == 16) || (keylen == 24) || (keylen == 32)) {
> + ctx->key_len = keylen;
> + memcpy(ctx->enc_key, key, keylen);
> + return 0;
> + }
> + crypto_ablkcipher_set_flags(cipher, CRYPTO_TFM_RES_BAD_KEY_LEN);
> +
> + return -EINVAL;
> +}
...
> +
> +struct crypto_alg algs[] = { {
> + .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
> + .cra_blocksize = AES_BLOCK_SIZE,
> + .cra_ctxsize = sizeof(struct cvm_enc_ctx),
> + .cra_alignmask = 7,
> + .cra_priority = 4001,
> + .cra_name = "xts(aes)",
> + .cra_driver_name = "cavium-xts-aes",
> + .cra_type = &crypto_ablkcipher_type,
> + .cra_u = {
> + .ablkcipher = {
> + .ivsize = AES_BLOCK_SIZE,
> + .min_keysize = AES_MIN_KEY_SIZE,
> + .max_keysize = AES_MAX_KEY_SIZE,
> + .setkey = cvm_enc_dec_setkey,
May I ask how the setkey for XTS is intended to work? The XTS keys are double
in size than "normal" keys.
> + .encrypt = cvm_aes_encrypt_xts,
> + .decrypt = cvm_aes_decrypt_xts,
> + },
Ciao
Stephan
[toc] | [next] | [standalone]
| From | Stephan Müller <smueller@chronox.de> |
|---|---|
| Date | 2017-01-11 13:40 +0100 |
| Message-ID | <sYqm6-6WF-11@gated-at.bofh.it> |
| In reply to | #1556405 |
Am Mittwoch, 11. Januar 2017, 16:58:17 CET schrieb George Cherian:
Hi George,
> I will add a seperate function for xts setkey and make changes as following.
> > ...
> >
> >> +
> >> +struct crypto_alg algs[] = { {
> >> + .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
> >> + .cra_blocksize = AES_BLOCK_SIZE,
> >> + .cra_ctxsize = sizeof(struct cvm_enc_ctx),
> >> + .cra_alignmask = 7,
> >> + .cra_priority = 4001,
> >> + .cra_name = "xts(aes)",
> >> + .cra_driver_name = "cavium-xts-aes",
> >> + .cra_type = &crypto_ablkcipher_type,
> >> + .cra_u = {
> >> + .ablkcipher = {
> >> + .ivsize = AES_BLOCK_SIZE,
> >> + .min_keysize = AES_MIN_KEY_SIZE,
> >> + .max_keysize = AES_MAX_KEY_SIZE,
> >> + .setkey = cvm_enc_dec_setkey,
> >
> > May I ask how the setkey for XTS is intended to work? The XTS keys are
> > double in size than "normal" keys.
>
> .ablkcipher = {
> .ivsize = AES_BLOCK_SIZE,
> .min_keysize = 2 * AES_MIN_KEY_SIZE,
> .max_keysize = 2 * AES_MAX_KEY_SIZE,
> .setkey = cvm_xts_setkey,
>
> Hope this is fine?
>
Sure, please do not forget to invoke xts_verify_key.
Ciao
Stephan
[toc] | [prev] | [next] | [standalone]
| From | Stephan Müller <smueller@chronox.de> |
|---|---|
| Date | 2017-01-12 12:30 +0100 |
| Message-ID | <sYLJU-3mz-19@gated-at.bofh.it> |
| In reply to | #1556449 |
Am Donnerstag, 12. Januar 2017, 16:40:32 CET schrieb George Cherian: Hi George, > > > > Sure, please do not forget to invoke xts_verify_key. > > Should I be using xts_check_key or xts_verify_key? Both are identical except for the input parameter -- the one requires crypto_skcipher, the other crypto_tfm. Depending what pointer you have handy in your setkey function, you would use the most appropriate one. Ciao Stephan
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web