Path: blob/main/crypto/krb5/src/plugins/preauth/otp/otp_state.h
34907 views
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */1/* plugins/preauth/otp/otp_state.h - Internal declarations for OTP module */2/*3* Copyright 2013 Red Hat, Inc. All rights reserved.4*5* Redistribution and use in source and binary forms, with or without6* modification, are permitted provided that the following conditions are met:7*8* 1. Redistributions of source code must retain the above copyright9* notice, this list of conditions and the following disclaimer.10*11* 2. Redistributions in binary form must reproduce the above copyright12* notice, this list of conditions and the following disclaimer in13* the documentation and/or other materials provided with the14* distribution.15*16* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS17* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED18* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A19* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER20* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,21* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,22* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR23* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF24* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING25* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS26* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.27*/2829#ifndef OTP_H_30#define OTP_H_3132#include <k5-int.h>33#include <verto.h>3435#include <com_err.h>3637typedef enum otp_response {38otp_response_fail = 0,39otp_response_success40/* Other values reserved for responses like next token or new pin. */41} otp_response;4243typedef struct otp_state_st otp_state;44typedef void45(*otp_cb)(void *data, krb5_error_code retval, otp_response response,46char *const *indicators);4748krb5_error_code49otp_state_new(krb5_context ctx, otp_state **self);5051void52otp_state_free(otp_state *self);5354void55otp_state_verify(otp_state *state, verto_ctx *ctx, krb5_const_principal princ,56const char *config, const krb5_pa_otp_req *request,57otp_cb cb, void *data);5859#endif /* OTP_H_ */606162