/* Copyright (c) 2016, Google Inc. * * Permission to use, copy, modify, and/or 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. */ #include <openssl/base.h> #include <assert.h> #include <string.h> #include "internal.h" #include "../../internal.h" // byte_reverse reverses the order of the bytes in |b->c|. static void byte_reverse(uint8_t b[16]) { … } // reverse_and_mulX_ghash interprets |b| as a reversed element of the GHASH // field, multiplies that by 'x' and serialises the result back into |b|, but // with GHASH's backwards bit ordering. static void reverse_and_mulX_ghash(uint8_t b[16]) { … } // POLYVAL(H, X_1, ..., X_n) = // ByteReverse(GHASH(mulX_GHASH(ByteReverse(H)), ByteReverse(X_1), ..., // ByteReverse(X_n))). // // See https://www.rfc-editor.org/rfc/rfc8452.html#appendix-A. void CRYPTO_POLYVAL_init(struct polyval_ctx *ctx, const uint8_t key[16]) { … } void CRYPTO_POLYVAL_update_blocks(struct polyval_ctx *ctx, const uint8_t *in, size_t in_len) { … } void CRYPTO_POLYVAL_finish(const struct polyval_ctx *ctx, uint8_t out[16]) { … }