-/* $OpenBSD: camellia.c,v 1.13 2024/03/29 07:26:21 jsing Exp $ */
+/* $OpenBSD: camellia.c,v 1.14 2024/03/30 04:58:12 joshua Exp $ */
/* ====================================================================
* Copyright 2006 NTT (Nippon Telegraph and Telephone Corporation) .
* ALL RIGHTS RESERVED.
key->grand_rounds = Camellia_Ekeygen(bits, userKey, key->u.rd_key);
return 0;
}
+LCRYPTO_ALIAS(Camellia_set_key);
void
Camellia_encrypt(const unsigned char *in, unsigned char *out,
{
Camellia_EncryptBlock_Rounds(key->grand_rounds, in, key->u.rd_key, out);
}
+LCRYPTO_ALIAS(Camellia_encrypt);
void
Camellia_decrypt(const unsigned char *in, unsigned char *out,
{
Camellia_DecryptBlock_Rounds(key->grand_rounds, in, key->u.rd_key, out);
}
+LCRYPTO_ALIAS(Camellia_decrypt);
void
Camellia_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len,
CRYPTO_cbc128_decrypt(in, out, len, key, ivec,
(block128_f)Camellia_decrypt);
}
+LCRYPTO_ALIAS(Camellia_cbc_encrypt);
/*
* The input and output encrypted as though 128bit cfb mode is being
CRYPTO_cfb128_encrypt(in, out, length, key, ivec, num, enc,
(block128_f)Camellia_encrypt);
}
+LCRYPTO_ALIAS(Camellia_cfb128_encrypt);
/* N.B. This expects the input to be packed, MS bit first */
void
CRYPTO_cfb128_1_encrypt(in, out, length, key, ivec, num, enc,
(block128_f)Camellia_encrypt);
}
+LCRYPTO_ALIAS(Camellia_cfb1_encrypt);
void
Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out,
CRYPTO_cfb128_8_encrypt(in, out, length, key, ivec, num, enc,
(block128_f)Camellia_encrypt);
}
+LCRYPTO_ALIAS(Camellia_cfb8_encrypt);
void
Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out,
CRYPTO_ctr128_encrypt(in, out, length, key, ivec, ecount_buf, num,
(block128_f)Camellia_encrypt);
}
+LCRYPTO_ALIAS(Camellia_ctr128_encrypt);
void
Camellia_ecb_encrypt(const unsigned char *in, unsigned char *out,
else
Camellia_decrypt(in, out, key);
}
+LCRYPTO_ALIAS(Camellia_ecb_encrypt);
/*
* The input and output encrypted as though 128bit ofb mode is being
CRYPTO_ofb128_encrypt(in, out, length, key, ivec, num,
(block128_f)Camellia_encrypt);
}
+LCRYPTO_ALIAS(Camellia_ofb128_encrypt);
--- /dev/null
+/* $OpenBSD: camellia.h,v 1.1 2024/03/30 04:58:12 joshua Exp $ */
+/*
+ * Copyright (c) 2024 Joshua Sing <joshua@joshuasing.dev>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _LIBCRYPTO_CAMELLIA_H
+#define _LIBCRYPTO_CAMELLIA_H
+
+#ifndef _MSC_VER
+#include_next <openssl/camellia.h>
+#else
+#include "../include/openssl/camellia.h"
+#endif
+#include "crypto_namespace.h"
+
+LCRYPTO_USED(Camellia_set_key);
+LCRYPTO_USED(Camellia_encrypt);
+LCRYPTO_USED(Camellia_decrypt);
+LCRYPTO_USED(Camellia_ecb_encrypt);
+LCRYPTO_USED(Camellia_cbc_encrypt);
+LCRYPTO_USED(Camellia_cfb128_encrypt);
+LCRYPTO_USED(Camellia_cfb1_encrypt);
+LCRYPTO_USED(Camellia_cfb8_encrypt);
+LCRYPTO_USED(Camellia_ofb128_encrypt);
+LCRYPTO_USED(Camellia_ctr128_encrypt);
+
+#endif /* _LIBCRYPTO_CAMELLIA_H */