-/* ====================================================================
- * Copyright (c) 2015 The OpenSSL Project. All rights reserved.
+/*
+ * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
*
- * Rights for redistribution and usage in source and binary
- * forms are granted according to the OpenSSL license.
+ * Licensed under the OpenSSL license (the "License"). You may not use
+ * this file except in compliance with the License. You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
*/
#include <stdlib.h>
#include <string.h>
+#include <openssl/crypto.h>
#include "internal/poly1305.h"
poly1305_emit(ctx->opaque, mac, ctx->nonce);
/* zero out the state */
- memset(ctx, 0, sizeof(*ctx));
+ OPENSSL_cleanse(ctx, sizeof(*ctx));
}
#ifdef SELFTEST
static unsigned char hex_digit(char h)
{
- if (h >= '0' && h <= '9')
- return h - '0';
- else if (h >= 'a' && h <= 'f')
- return h - 'a' + 10;
- else if (h >= 'A' && h <= 'F')
- return h - 'A' + 10;
- else
+ int i = OPENSSL_hexchar2int(h);
+
+ if (i < 0)
abort();
+ return i;
}
static void hex_decode(unsigned char *out, const char *hex)