aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/aes
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/aes/aes.h11
-rw-r--r--include/aes/algorithm.h11
-rw-r--r--include/aes/all.h14
-rw-r--r--include/aes/box.h11
-rw-r--r--include/aes/box_aes.h11
-rw-r--r--include/aes/box_data.h11
-rw-r--r--include/aes/data.h11
-rw-r--r--include/aes/error.h106
-rw-r--r--include/aes/mode.h11
-rw-r--r--include/aes/padding.h11
10 files changed, 45 insertions, 163 deletions
diff --git a/include/aes/aes.h b/include/aes/aes.h
index 62a301b..431c10b 100644
--- a/include/aes/aes.h
+++ b/include/aes/aes.h
@@ -1,10 +1,7 @@
-/**
- * \file
- * \author Egor Tensin <Egor.Tensin@gmail.com>
- * \date 2015
- * \copyright This file is licensed under the terms of the MIT License.
- * See LICENSE.txt for details.
- */
+// Copyright (c) 2015 Egor Tensin <Egor.Tensin@gmail.com>
+// This file is part of the "AES tools" project.
+// For details, see https://github.com/egor-tensin/aes-tools.
+// Distributed under the MIT License.
#pragma once
diff --git a/include/aes/algorithm.h b/include/aes/algorithm.h
index 61b211d..d88cf59 100644
--- a/include/aes/algorithm.h
+++ b/include/aes/algorithm.h
@@ -1,10 +1,7 @@
-/**
- * \file
- * \author Egor Tensin <Egor.Tensin@gmail.com>
- * \date 2015
- * \copyright This file is licensed under the terms of the MIT License.
- * See LICENSE.txt for details.
- */
+// Copyright (c) 2015 Egor Tensin <Egor.Tensin@gmail.com>
+// This file is part of the "AES tools" project.
+// For details, see https://github.com/egor-tensin/aes-tools.
+// Distributed under the MIT License.
#pragma once
diff --git a/include/aes/all.h b/include/aes/all.h
index 363a9a8..959e10c 100644
--- a/include/aes/all.h
+++ b/include/aes/all.h
@@ -1,13 +1,7 @@
-/**
- * \file
- * \author Egor Tensin <Egor.Tensin@gmail.com>
- * \date 2015
- * \copyright This file is licensed under the terms of the MIT License.
- * See LICENSE.txt for details.
- *
- * \brief Include this file to use the library. Includes all the other header
- * files.
- */
+// Copyright (c) 2015 Egor Tensin <Egor.Tensin@gmail.com>
+// This file is part of the "AES tools" project.
+// For details, see https://github.com/egor-tensin/aes-tools.
+// Distributed under the MIT License.
#pragma once
diff --git a/include/aes/box.h b/include/aes/box.h
index dc5bc50..2051d3d 100644
--- a/include/aes/box.h
+++ b/include/aes/box.h
@@ -1,10 +1,7 @@
-/**
- * \file
- * \author Egor Tensin <Egor.Tensin@gmail.com>
- * \date 2015
- * \copyright This file is licensed under the terms of the MIT License.
- * See LICENSE.txt for details.
- */
+// Copyright (c) 2015 Egor Tensin <Egor.Tensin@gmail.com>
+// This file is part of the "AES tools" project.
+// For details, see https://github.com/egor-tensin/aes-tools.
+// Distributed under the MIT License.
#pragma once
diff --git a/include/aes/box_aes.h b/include/aes/box_aes.h
index e13b39a..c92d883 100644
--- a/include/aes/box_aes.h
+++ b/include/aes/box_aes.h
@@ -1,10 +1,7 @@
-/**
- * \file
- * \author Egor Tensin <Egor.Tensin@gmail.com>
- * \date 2015
- * \copyright This file is licensed under the terms of the MIT License.
- * See LICENSE.txt for details.
- */
+// Copyright (c) 2015 Egor Tensin <Egor.Tensin@gmail.com>
+// This file is part of the "AES tools" project.
+// For details, see https://github.com/egor-tensin/aes-tools.
+// Distributed under the MIT License.
#pragma once
diff --git a/include/aes/box_data.h b/include/aes/box_data.h
index bd970eb..e2315eb 100644
--- a/include/aes/box_data.h
+++ b/include/aes/box_data.h
@@ -1,10 +1,7 @@
-/**
- * \file
- * \author Egor Tensin <Egor.Tensin@gmail.com>
- * \date 2015
- * \copyright This file is licensed under the terms of the MIT License.
- * See LICENSE.txt for details.
- */
+// Copyright (c) 2015 Egor Tensin <Egor.Tensin@gmail.com>
+// This file is part of the "AES tools" project.
+// For details, see https://github.com/egor-tensin/aes-tools.
+// Distributed under the MIT License.
#pragma once
diff --git a/include/aes/data.h b/include/aes/data.h
index e8391cc..a441939 100644
--- a/include/aes/data.h
+++ b/include/aes/data.h
@@ -1,10 +1,7 @@
-/**
- * \file
- * \author Egor Tensin <Egor.Tensin@gmail.com>
- * \date 2015
- * \copyright This file is licensed under the terms of the MIT License.
- * See LICENSE.txt for details.
- */
+// Copyright (c) 2015 Egor Tensin <Egor.Tensin@gmail.com>
+// This file is part of the "AES tools" project.
+// For details, see https://github.com/egor-tensin/aes-tools.
+// Distributed under the MIT License.
#pragma once
diff --git a/include/aes/error.h b/include/aes/error.h
index a92f17b..532edeb 100644
--- a/include/aes/error.h
+++ b/include/aes/error.h
@@ -1,35 +1,10 @@
-/**
- * \file
- * \author Egor Tensin <Egor.Tensin@gmail.com>
- * \date 2015
- * \copyright This file is licensed under the terms of the MIT License.
- * See LICENSE.txt for details.
- */
+// Copyright (c) 2015 Egor Tensin <Egor.Tensin@gmail.com>
+// This file is part of the "AES tools" project.
+// For details, see https://github.com/egor-tensin/aes-tools.
+// Distributed under the MIT License.
#pragma once
-/**
- * \defgroup aes_error_handling Error handling
- * \ingroup aes
- * \brief Error data structures and formatting functions.
- *
- * Some library functions cannot fail, which is simple.
- * Other functions return an error code.
- * You can check if a function exited with an error by passing the returned
- * error code to aes_is_error().
- *
- * Some possibly-may-fail functions accept a pointer to an "error details"
- * structure.
- * This pointer can always be `NULL`.
- * In this case, simply an error code is returned.
- * Otherwise, the error details structure is filled with appropriate info about
- * the error, possibly including a few details like invalid arguments names,
- * etc.
- *
- * You can format an error details structure using the formatting functions.
- * \{
- */
-
#include <stdlib.h>
#ifdef __cplusplus
@@ -37,16 +12,13 @@ extern "C"
{
#endif
-/**
- * \brief API status codes.
- */
typedef enum
{
- AES_SUCCESS, ///< Everything went fine
- AES_NULL_ARGUMENT_ERROR, ///< Invalid argument value NULL
- AES_PARSE_ERROR, ///< Couldn't parse
- AES_INVALID_PKCS7_PADDING_ERROR, ///< Invalid PKCS7 padding while decrypting
- AES_NOT_IMPLEMENTED_ERROR, ///< Not implemented
+ AES_SUCCESS,
+ AES_NULL_ARGUMENT_ERROR,
+ AES_PARSE_ERROR,
+ AES_INVALID_PKCS7_PADDING_ERROR,
+ AES_NOT_IMPLEMENTED_ERROR,
AES_MISSING_PADDING_ERROR,
AES_MEMORY_ALLOCATION_ERROR,
}
@@ -57,28 +29,10 @@ static __inline int aes_is_error(AES_StatusCode ec)
return ec != AES_SUCCESS;
}
-/**
- * \brief Retrieves a simple error message for an error code.
- *
- * For example,
- * \code{.c}
- * printf("%s\n", aes_strerror(AES_NULL_ARGUMENT_ERROR));
- * \endcode
- * would print
- * \code
- * Invalid argument value NULL
- * \endcode
- *
- * \param[in] ec The error code.
- * \return A pointer to a statically-allocated C string.
- */
const char* aes_strerror(AES_StatusCode ec);
#define AES_MAX_CALL_STACK_LENGTH 32
-/**
- * \brief Stores error details: error code & possibly a few parameters.
- */
typedef struct
{
AES_StatusCode ec; ///< Error code
@@ -101,67 +55,29 @@ typedef struct
}
AES_ErrorDetails;
-/**
- * \brief Extracts an error code from error details.
- *
- * \param[in] err_details The error details structure. Must not be `NULL`.
- * \return The error code stored in the error details.
- */
static __inline AES_StatusCode aes_get_error_code(
const AES_ErrorDetails* err_details)
{
return err_details->ec;
}
-/**
- * \brief Formats a pretty error message, including error parameters.
- *
- * \param[in] err_details The pointer to error details. Must not be `NULL`.
- * \param[out] dest The pointer to the destination string buffer.
- * \param[in] dest_size The size of the destination buffer, in bytes.
- * \return If `dest` is NULL, the number of bytes required to store the full
- * error message, and the number of characters written (excluding the
- * terminating '\0' character) otherwise.
- */
size_t aes_format_error(
const AES_ErrorDetails* err_details,
char* dest,
size_t dest_size);
-/**
- * \brief Initializes an error details structure.
- *
- * \param[out] err_details The error details structure to fill.
- */
AES_StatusCode aes_success(
AES_ErrorDetails* err_details);
-/**
- * \brief Builds error details from a `NULL` argument error.
- *
- * \param[out] err_details The error details structure to fill.
- * \param[in] param_name The parameter name. Must not be `NULL`.
- */
AES_StatusCode aes_error_null_argument(
AES_ErrorDetails* err_details,
const char* param_name);
-/**
- * \brief Builds error details from a parse error.
- *
- * \param[out] err_details The error details structure to fill.
- * \param[in] src The string that failed to be parsed.
- */
AES_StatusCode aes_error_parse(
AES_ErrorDetails* err_details,
const char* src,
const char* what);
-/**
- * \brief Builds error details from an invalid PKCS7 padding error.
- *
- * \param[out] err_details The error details structure to fill.
- */
AES_StatusCode aes_error_invalid_pkcs7_padding(
AES_ErrorDetails* err_details);
@@ -178,7 +94,3 @@ AES_StatusCode aes_error_memory_allocation(
#ifdef __cplusplus
}
#endif
-
-/**
- * \}
- */
diff --git a/include/aes/mode.h b/include/aes/mode.h
index dccfc43..090628b 100644
--- a/include/aes/mode.h
+++ b/include/aes/mode.h
@@ -1,10 +1,7 @@
-/**
- * \file
- * \author Egor Tensin <Egor.Tensin@gmail.com>
- * \date 2015
- * \copyright This file is licensed under the terms of the MIT License.
- * See LICENSE.txt for details.
- */
+// Copyright (c) 2015 Egor Tensin <Egor.Tensin@gmail.com>
+// This file is part of the "AES tools" project.
+// For details, see https://github.com/egor-tensin/aes-tools.
+// Distributed under the MIT License.
#pragma once
diff --git a/include/aes/padding.h b/include/aes/padding.h
index 7f0db65..ba316f5 100644
--- a/include/aes/padding.h
+++ b/include/aes/padding.h
@@ -1,10 +1,7 @@
-/**
- * \file
- * \author Egor Tensin <Egor.Tensin@gmail.com>
- * \date 2015
- * \copyright This file is licensed under the terms of the MIT License.
- * See LICENSE.txt for details.
- */
+// Copyright (c) 2015 Egor Tensin <Egor.Tensin@gmail.com>
+// This file is part of the "AES tools" project.
+// For details, see https://github.com/egor-tensin/aes-tools.
+// Distributed under the MIT License.
#pragma once