// File: /workspace/github_c_makefile_star2_O3/OpenKMIP[P]libkmip/tests/tests.c
// Function: test_encode_attribute_cryptographic_parameters
int
test_encode_attribute_cryptographic_parameters(TestTracker *tracker)
{
    TRACK_TEST(tracker);

    /* This encoding matches the following values:
    *  Attribute
    *      Attribute Name - Cryptographic Parameters
    *      Attribute Value
    *          Block Cipher Mode - CBC
    *          Padding Method - PKCS5
    *          Hashing Algorithm - SHA-1
    */
    uint8 expected[96] = {
        0x42, 0x00, 0x08, 0x01, 0x00, 0x00, 0x00, 0x58,
        0x42, 0x00, 0x0A, 0x07, 0x00, 0x00, 0x00, 0x18,
        0x43, 0x72, 0x79, 0x70, 0x74, 0x6F, 0x67, 0x72,
        0x61, 0x70, 0x68, 0x69, 0x63, 0x20, 0x50, 0x61,
        0x72, 0x61, 0x6D, 0x65, 0x74, 0x65, 0x72, 0x73,
        0x42, 0x00, 0x0B, 0x01, 0x00, 0x00, 0x00, 0x30,
        0x42, 0x00, 0x11, 0x05, 0x00, 0x00, 0x00, 0x04,
        0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
        0x42, 0x00, 0x5F, 0x05, 0x00, 0x00, 0x00, 0x04,
        0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
        0x42, 0x00, 0x38, 0x05, 0x00, 0x00, 0x00, 0x04,
        0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00
    };

    uint8 observed[96] = {0};
    KMIP ctx = {0};
    kmip_init(&ctx, observed, ARRAY_LENGTH(observed), KMIP_1_0);

    CryptographicParameters value = {0};
    kmip_init_cryptographic_parameters(&value);
    value.block_cipher_mode = KMIP_BLOCK_CBC;
    value.padding_method = KMIP_PAD_PKCS5;
    value.hashing_algorithm = KMIP_HASH_SHA1;

    Attribute attr = {0};
    kmip_init_attribute(&attr);

    attr.type = KMIP_ATTR_CRYPTOGRAPHIC_PARAMETERS;
    attr.value = &value;

    int result = kmip_encode_attribute(&ctx, &attr);
    result = report_encoding_test_result(
        tracker,
        &ctx,
        expected,
        observed,
        result,
        __func__
    );
    kmip_destroy(&ctx);
    return(result);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x960, %rsp            # imm = 0x960
movq %rdi, %rbx
incw (%rdi)
xorps %xmm0, %xmm0
leaq 0x60(%rsp), %r14
movaps %xmm0, 0x50(%r14)
movaps %xmm0, 0x40(%r14)
movaps %xmm0, 0x30(%r14)
movaps %xmm0, 0x20(%r14)
movaps %xmm0, 0x10(%r14)
movaps %xmm0, (%r14)
leaq 0xc8(%rsp), %r15
movl $0x898, %edx            # imm = 0x898
movq %r15, %rdi
xorl %esi, %esi
callq 0x10c0
movl $0x60, %edx
movq %r15, %rdi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x13177
leaq 0x10(%rsp), %r12
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%r12)
movaps %xmm0, 0x30(%r12)
movaps %xmm0, 0x20(%r12)
movaps %xmm0, 0x10(%r12)
movaps %xmm0, (%r12)
movq %r12, %rdi
callq 0x138a6
movabsq $0x300000001, %rax      # imm = 0x300000001
movq %rax, (%r12)
movl $0x4, 0x8(%r12)
movq %rsp, %r13
xorps %xmm0, %xmm0
movaps %xmm0, (%r13)
movq %r13, %rdi
callq 0x1388b
movl $0xe, (%r13)
movq %r12, 0x8(%r13)
movq %r15, %rdi
movq %r13, %rsi
callq 0x18d26
leaq 0x287f3(%rip), %rdx     # 0x2ff00
leaq 0x26653(%rip), %r9      # 0x2dd67
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rcx
movl %eax, %r8d
callq 0x123c
movl %eax, %ebx
movq %r15, %rdi
callq 0x13455
movl %ebx, %eax
addq $0x960, %rsp            # imm = 0x960
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq