#include <sys/socket.h>
#include <linux/if_alg.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
int main() {
    int fd = socket(AF_ALG, SOCK_SEQPACKET, 0);
    if (fd < 0) { perror("socket AF_ALG"); return 1; }
    printf("AF_ALG socket OK: %d\n", fd);
    struct sockaddr_alg sa;
    memset(&sa, 0, sizeof(sa));
    sa.salg_family = AF_ALG;
    strncpy((char*)sa.salg_type, "aead", sizeof(sa.salg_type)-1);
    strncpy((char*)sa.salg_name, "authencesn(hmac(sha256),cbc(aes))", sizeof(sa.salg_name)-1);
    int r = bind(fd, (struct sockaddr*)&sa, sizeof(sa));
    if (r < 0) { perror("bind aead"); close(fd); return 1; }
    printf("AEAD bind OK\n");
    close(fd);
    return 0;
}
