Feature #8667 » ossl_set_iv_length.patch
ossl_cipher.c (working copy) | ||
---|---|---|
return key_length;
|
||
}
|
||
/*
|
||
* call-seq:
|
||
* cipher.iv_len = integer -> integer
|
||
*
|
||
* Sets the iv length of the cipher.
|
||
*
|
||
* See EVP_CTRL_GCM_SET_IVLEN for further information.
|
||
*/
|
||
static VALUE
|
||
ossl_cipher_set_gcm_iv_length(VALUE self, VALUE iv_length)
|
||
{
|
||
int ivlen = NUM2INT(iv_length);
|
||
EVP_CIPHER_CTX *ctx;
|
||
GetCipher(self, ctx);
|
||
if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN, ivlen, NULL) != 1)
|
||
ossl_raise(eCipherError, NULL);
|
||
return iv_length;
|
||
}
|
||
#if defined(HAVE_EVP_CIPHER_CTX_SET_PADDING)
|
||
/*
|
||
* call-seq:
|
||
... | ... | |
rb_define_method(cCipher, "key_len=", ossl_cipher_set_key_length, 1);
|
||
rb_define_method(cCipher, "key_len", ossl_cipher_key_length, 0);
|
||
rb_define_method(cCipher, "iv=", ossl_cipher_set_iv, 1);
|
||
rb_define_method(cCipher, "iv_len=", ossl_cipher_set_gcm_iv_length, 1);
|
||
rb_define_method(cCipher, "iv_len", ossl_cipher_iv_length, 0);
|
||
rb_define_method(cCipher, "block_size", ossl_cipher_block_size, 0);
|
||
rb_define_method(cCipher, "padding=", ossl_cipher_set_padding, 1);
|