if ((kctx = EVP_KDF_CTX_new(kdf)) == NULL)
goto err;
*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,
- (char *)mdname, strlen(mdname) + 1);
+ (char *)mdname, 0);
*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY,
(unsigned char *)Z, Zlen);
if (ukm != NULL)
*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_UKM,
(unsigned char *)ukm, ukmlen);
*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_CEK_ALG,
- (char *)oid_sn, strlen(oid_sn) + 1);
+ (char *)oid_sn, 0);
*p = OSSL_PARAM_construct_end();
ret = EVP_KDF_CTX_set_params(kctx, params) > 0
&& EVP_KDF_derive(kctx, out, outlen) > 0;
if ((kctx = EVP_KDF_CTX_new(kdf)) != NULL) {
*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,
- (char *)mdname,
- strlen(mdname) + 1);
+ (char *)mdname, 0);
*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY,
(void *)Z, Zlen);
*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO,
(unsigned char *)salt, saltlen);
*p++ = OSSL_PARAM_construct_int(OSSL_KDF_PARAM_ITER, &iter);
*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,
- (char *)mdname, strlen(mdname) + 1);
+ (char *)mdname, 0);
*p = OSSL_PARAM_construct_end();
if (EVP_KDF_CTX_set_params(kctx, params) != 1
|| EVP_KDF_derive(kctx, out, keylen) != 1)
case T_DIGEST:
mdname = EVP_MD_name((const EVP_MD *)p2);
- params[0] = OSSL_PARAM_construct_utf8_string(name, (char *)mdname,
- strlen(mdname) + 1);
+ params[0] = OSSL_PARAM_construct_utf8_string(name, (char *)mdname, 0);
break;
/*
* Cast away the const. This is read
* only so should be safe
*/
- (char *)name,
- strlen(name) + 1);
+ (char *)name, 0);
*p++ = OSSL_PARAM_construct_end();
return EVP_PKEY_CTX_set_params(ctx, sig_md_params);
* Cast away the const. This is read
* only so should be safe
*/
- (char *)mdname,
- strlen(mdname) + 1);
+ (char *)mdname, 0);
if (mdprops != NULL) {
*p++ = OSSL_PARAM_construct_utf8_string(
OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST_PROPS,
* Cast away the const. This is read
* only so should be safe
*/
- (char *)mdprops,
- strlen(mdprops) + 1);
+ (char *)mdprops, 0);
}
*p++ = OSSL_PARAM_construct_end();
* Cast away the const. This is read
* only so should be safe
*/
- (char *)mdname,
- strlen(mdname) + 1);
+ (char *)mdname, 0);
if (mdprops != NULL) {
*p++ = OSSL_PARAM_construct_utf8_string(
OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST_PROPS,
* Cast away the const. This is read
* only so should be safe
*/
- (char *)mdprops,
- strlen(mdprops) + 1);
+ (char *)mdprops, 0);
}
*p++ = OSSL_PARAM_construct_end();
OSSL_PARAM_construct_utf8_string() is a function that constructs a UTF8
string OSSL_PARAM structure.
A parameter with name B<key>, storage B<buf> and size B<bsize> is created.
-If B<bsize> is zero, the string length is determined using strlen(3).
+If B<bsize> is zero, the string length is determined using strlen(3) + 1 for the
+null termination byte.
+Generally pass zero for B<bsize> instead of calling strlen(3) yourself.
OSSL_PARAM_construct_octet_string() is a function that constructs an OCTET
string OSSL_PARAM structure.
goto err;
mdname = EVP_MD_name(md);
*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,
- (char *)mdname, strlen(mdname) + 1);
+ (char *)mdname, 0);
*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SECRET,
(unsigned char *)sec,
(size_t)slen);
*p++ = OSSL_PARAM_construct_int(OSSL_KDF_PARAM_MODE, &mode);
*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,
- (char *)mdname, strlen(mdname) + 1);
+ (char *)mdname, 0);
*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY,
(unsigned char *)secret, hashlen);
*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO,
*p++ = OSSL_PARAM_construct_int(OSSL_KDF_PARAM_MODE, &mode);
*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,
- (char *)mdname, strlen(mdname) + 1);
+ (char *)mdname, 0);
*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY,
(unsigned char *)insecret,
insecretlen);