Skip to content

Commit

Permalink
trivial: fix up headers; add missing copyright to aes
Browse files Browse the repository at this point in the history
  • Loading branch information
xanimo committed Jul 26, 2022
1 parent 4dc7649 commit 7b8a2ca
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 18 deletions.
1 change: 0 additions & 1 deletion include/dogecoin/address.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <stdbool.h>

#include <dogecoin/dogecoin.h>
#include <dogecoin/tool.h>

LIBDOGECOIN_BEGIN_DECL

Expand Down
6 changes: 6 additions & 0 deletions include/dogecoin/byteswap.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
#ifndef __LIBDOGECOIN_BYTESWAP_H__
#define __LIBDOGECOIN_BYTESWAP_H__

#include <dogecoin/dogecoin.h>

LIBDOGECOIN_BEGIN_DECL

#if defined(HAVE_BYTESWAP_H)
#include <byteswap.h>
#endif
Expand Down Expand Up @@ -66,4 +70,6 @@ LIBDOGECOIN_API inline uint64_t bswap_64(uint64_t x)

#endif // defined(__APPLE__)

LIBDOGECOIN_END_DECL

#endif // __LIBDOGECOIN_BYTESWAP_H__
9 changes: 6 additions & 3 deletions include/dogecoin/ctaes.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
**********************************************************************/

#ifndef __LIBDOGECOIN_CTAES_H__
#define __LIBDOGECOIN_CTAES_H__ 1
#define __LIBDOGECOIN_CTAES_H__

#include <stdint.h>
#include <stdlib.h>
#include <dogecoin/dogecoin.h>

LIBDOGECOIN_BEGIN_DECL

typedef struct {
uint16_t slice[8];
Expand Down Expand Up @@ -38,4 +39,6 @@ void AES256_init(AES256_ctx* ctx, const unsigned char* key32);
void AES256_encrypt(const AES256_ctx* ctx, size_t blocks, unsigned char* cipher16, const unsigned char* plain16);
void AES256_decrypt(const AES256_ctx* ctx, size_t blocks, unsigned char* plain16, const unsigned char* cipher16);

LIBDOGECOIN_END_DECL

#endif /* __LIBDOGECOIN_CTAES_H__ */
2 changes: 1 addition & 1 deletion include/dogecoin/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
#ifndef __LIBDOGECOIN_HASH_H__
#define __LIBDOGECOIN_HASH_H__

#include <dogecoin/sha2.h>
#include <dogecoin/cstr.h>
#include <dogecoin/dogecoin.h>
#include <dogecoin/mem.h>
#include <dogecoin/sha2.h>
#include <dogecoin/vector.h>

LIBDOGECOIN_BEGIN_DECL
Expand Down
7 changes: 2 additions & 5 deletions include/dogecoin/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,12 @@
#ifndef __LIBDOGECOIN_NET_H__
#define __LIBDOGECOIN_NET_H__

#include <dogecoin/dogecoin.h>

#include <event2/event.h>
#include <event2/buffer.h>
#include <event2/bufferevent.h>
#include <stdarg.h>

#include <dogecoin/buffer.h>
#include <dogecoin/chainparams.h>
#include <dogecoin/cstr.h>
#include <dogecoin/dogecoin.h>
#include <dogecoin/protocol.h>
#include <dogecoin/vector.h>

Expand Down
5 changes: 5 additions & 0 deletions include/dogecoin/portable_endian.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
#include <stdint.h>

#include <dogecoin/byteswap.h>
#include <dogecoin/dogecoin.h>

LIBDOGECOIN_BEGIN_DECL

#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__)

Expand Down Expand Up @@ -122,4 +125,6 @@

#endif

LIBDOGECOIN_END_DECL

#endif // __LIBDOGECOIN_PORTABLE_ENDIAN_H__
2 changes: 1 addition & 1 deletion include/dogecoin/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
#ifndef __LIBDOGECOIN_PROTOCOL_H__
#define __LIBDOGECOIN_PROTOCOL_H__

#include <dogecoin/dogecoin.h>
#include <dogecoin/buffer.h>
#include <dogecoin/cstr.h>
#include <dogecoin/dogecoin.h>
#include <dogecoin/vector.h>

LIBDOGECOIN_BEGIN_DECL
Expand Down
2 changes: 1 addition & 1 deletion include/dogecoin/script.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
#ifndef __LIBDOGECOIN_SCRIPT_H__
#define __LIBDOGECOIN_SCRIPT_H__

#include <dogecoin/key.h>
#include <dogecoin/cstr.h>
#include <dogecoin/dogecoin.h>
#include <dogecoin/key.h>
#include <dogecoin/vector.h>

LIBDOGECOIN_BEGIN_DECL
Expand Down
3 changes: 2 additions & 1 deletion include/dogecoin/serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@
#include <stdio.h>

#include <dogecoin/buffer.h>
#include <dogecoin/portable_endian.h>
#include <dogecoin/dogecoin.h>
#include <dogecoin/cstr.h>
#include <dogecoin/portable_endian.h>

LIBDOGECOIN_BEGIN_DECL

Expand Down
5 changes: 3 additions & 2 deletions include/dogecoin/transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@
#include <stddef.h> /* offsetof */
#include <stdio.h> /* printf */
#include <string.h> /* memset */
#include "uthash/uthash.h"
#include <uthash/uthash.h>

#include <dogecoin/dogecoin.h>
#include <dogecoin/tool.h>
#include <dogecoin/tx.h>

LIBDOGECOIN_BEGIN_DECL

Expand Down
2 changes: 1 addition & 1 deletion include/dogecoin/tx.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@

#include <dogecoin/buffer.h>
#include <dogecoin/chainparams.h>
#include <dogecoin/hash.h>
#include <dogecoin/cstr.h>
#include <dogecoin/dogecoin.h>
#include <dogecoin/hash.h>
#include <dogecoin/script.h>
#include <dogecoin/vector.h>

Expand Down
23 changes: 21 additions & 2 deletions src/aes.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
/*
The MIT License (MIT)
Copyright (c) 2022 bluezr
Copyright (c) 2022 The Dogecoin Foundation
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/

#include <string.h>

#include <dogecoin/aes.h>
#include <dogecoin/ctaes.h>
#include <dogecoin/mem.h>

#include <string.h>

int aes256_cbc_encrypt(const unsigned char aes_key[32], const unsigned char iv[AES_BLOCK_SIZE], const unsigned char* data, int size, int pad, unsigned char* out)
{
int written = 0;
Expand Down

0 comments on commit 7b8a2ca

Please sign in to comment.