#ifndef APTPKG_SHA2_H
#define APTPKG_SHA2_H
-#include <string>
#include <cstring>
-#include <algorithm>
-#include <stdint.h>
#include "sha2_internal.h"
#include "hashsum_template.h"
+#ifndef APT_10_CLEANER_HEADERS
+#include <string>
+#include <algorithm>
+#include <stdint.h>
+#endif
+
+
typedef HashSumValue<512> SHA512SumValue;
typedef HashSumValue<256> SHA256SumValue;
protected:
bool Done;
public:
- bool Add(const unsigned char *inbuf, unsigned long long len) = 0;
+ bool Add(const unsigned char *inbuf, unsigned long long len) APT_OVERRIDE APT_NONNULL(2) = 0;
void Result();
};
unsigned char Sum[32];
public:
- bool Add(const unsigned char *inbuf, unsigned long long len)
+ bool Add(const unsigned char *inbuf, unsigned long long len) APT_OVERRIDE APT_NONNULL(2)
{
if (Done)
return false;
res.Set(Sum);
return res;
};
- SHA256Summation()
+ SHA256Summation()
{
SHA256_Init(&ctx);
Done = false;
+ memset(&Sum, 0, sizeof(Sum));
};
};
unsigned char Sum[64];
public:
- bool Add(const unsigned char *inbuf, unsigned long long len)
+ bool Add(const unsigned char *inbuf, unsigned long long len) APT_OVERRIDE APT_NONNULL(2)
{
if (Done)
return false;
{
SHA512_Init(&ctx);
Done = false;
+ memset(&Sum, 0, sizeof(Sum));
};
};