Path: blob/main/sys/crypto/openssl/ossl_poly1305.h
39483 views
/*1* Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.2*3* Licensed under the OpenSSL license (the "License"). You may not use4* this file except in compliance with the License. You can obtain a copy5* in the file LICENSE in the source distribution or at6* https://www.openssl.org/source/license.html7*/89/* From include/crypto/poly1305.h */1011#define POLY1305_BLOCK_SIZE 161213typedef struct poly1305_context POLY1305;1415/* From crypto/poly1305/poly1305_local.h */1617typedef void (*poly1305_blocks_f) (void *ctx, const unsigned char *inp,18size_t len, unsigned int padbit);19typedef void (*poly1305_emit_f) (void *ctx, unsigned char mac[16],20const unsigned int nonce[4]);2122struct poly1305_context {23double opaque[24]; /* large enough to hold internal state, declared24* 'double' to ensure at least 64-bit invariant25* alignment across all platforms and26* configurations */27unsigned int nonce[4];28unsigned char data[POLY1305_BLOCK_SIZE];29size_t num;30struct {31poly1305_blocks_f blocks;32poly1305_emit_f emit;33} func;34};3536int ossl_poly1305_update(void *vctx, const void *buf, u_int len);37void Poly1305_Init(POLY1305 *ctx, const unsigned char key[32]);38void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len);39void Poly1305_Final(POLY1305 *ctx, unsigned char mac[16]);404142