Skip to content

Feature request: RFC 5649 padded AES key wrap (AES_wrap_key_padded / AES_unwrap_key_padded) #10589

Description

@MarkAtwood

wolfSSL provides AES_wrap_key / AES_unwrap_key for RFC 3394 (standard integer key wrap) but does not implement RFC 5649 (padded key wrap, supporting non-block-multiple plaintext lengths).

The existing AES_unwrap_key cannot serve as a building block for RFC 5649 because wolfSSL validates the recovered A register against a caller-supplied IV before returning. RFC 5649 requires recovering the AIV — which encodes the plaintext length — and then validating it. wolfSSL's early validation rejects the RFC 5649 AIV format, so the entire RFC 3394 unwrap loop has to be reimplemented from AES-ECB primitives to support RFC 5649.

RFC 5649 is required for interoperability with JOSE (JSON Web Keys / RFC 7517), CMS (RFC 5652), and other systems that use padded key wrap for arbitrary-length key material.

Workaround in use: Full RFC 5649 wrap and unwrap implemented on top of wolfSSL's AES-ECB primitives. Single-block case uses wolfSSL_AES_ecb_encrypt directly; multi-block wrap uses wolfSSL_AES_wrap_key with a custom IV; multi-block unwrap reimplements the RFC 3394 loop with AES-ECB to recover the AIV before validation.

Requested fix: Add native wolfSSL_AES_wrap_key_padded / wolfSSL_AES_unwrap_key_padded per RFC 5649. OpenSSL exposes this as EVP_aes_128_wrap_pad (and 192/256 variants).

Migrated from internal tracking (ZD-21736).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions