* @brief Sets the non-standard context properties. Can only be called on an
* initialized context.
*
+ * @remarks The @a value has to be of type appropriate for given property. See #yaca_property_e
+ * for details on corresponding types.
+ *
* @since_tizen 3.0
*
* @param[in,out] ctx Previously initialized crypto context
*
* @remarks The @a value should be freed using yaca_free()
*
+ * @remarks The @a value has to be of type appropriate for given property. See #yaca_property_e
+ * for details on corresponding types.
+ *
+ * @remarks @a value_len can be NULL if returned @a value is a single object (i.e. not an array/buffer)
+ *
* @param[in] ctx Previously initialized crypto context
* @param[in] property Property to be read
* @param[out] value Copy of the property value
* @brief Enumeration of YACA non-standard properties for algorithms.
*
* @since_tizen 3.0
+ *
+ * @see #yaca_padding_e
*/
typedef enum {
- /** Padding */
+ /** Padding. Property type is #yaca_padding_e. */
YACA_PROPERTY_PADDING,
- /** GCM Additional Authentication Data */
+ /** GCM Additional Authentication Data. Property type is a buffer (e.g. char*) */
YACA_PROPERTY_GCM_AAD,
- /** GCM Tag bits */
+ /** GCM Tag. Property type is a buffer (e.g. char*) */
YACA_PROPERTY_GCM_TAG,
- /** GCM Tag length */
+ /** GCM Tag length. Property type is size_t. */
YACA_PROPERTY_GCM_TAG_LEN,
- /** CCM Additional Authentication Data */
+ /** CCM Additional Authentication Data. Property type is a buffer (e.g. char*) */
YACA_PROPERTY_CCM_AAD,
- /** CCM Tag bits */
+ /** CCM Tag. Property type is a buffer (e.g. char*) */
YACA_PROPERTY_CCM_TAG,
- /** CCM Tag length */
+ /** CCM Tag length. Property type is size_t. */
YACA_PROPERTY_CCM_TAG_LEN
} yaca_property_e;
{
struct yaca_encrypt_context_s *c = get_encrypt_context(ctx);
- if (c == NULL || value == NULL || value_len == NULL)
+ if (c == NULL || value == NULL)
return YACA_ERROR_INVALID_PARAMETER;
assert(c->cipher_ctx != NULL);
switch (property) {
case YACA_PROPERTY_GCM_TAG:
- if (c->tag_len == 0)
+ if (c->tag_len == 0 || value_len == 0)
return YACA_ERROR_INVALID_PARAMETER;
if (EVP_CIPHER_CTX_ctrl(c->cipher_ctx,
*value_len = c->tag_len;
break;
case YACA_PROPERTY_CCM_TAG:
- if (c->tag_len == 0)
+ if (c->tag_len == 0 || value_len == 0)
return YACA_ERROR_INVALID_PARAMETER;
if (EVP_CIPHER_CTX_ctrl(c->cipher_ctx,
int pad;
yaca_padding_e padding;
- if (c == NULL || value == NULL || value_len == NULL)
+ if (c == NULL || value == NULL)
return YACA_ERROR_INVALID_PARAMETER;
assert(c->mdctx != NULL);
return ret;
memcpy(*value, &padding, sizeof(yaca_padding_e));
- *value_len = sizeof(yaca_padding_e);
+ if (value_len != NULL)
+ *value_len = sizeof(yaca_padding_e);
return YACA_ERROR_NONE;
}