]> www.average.org Git - pam_pcsc_cr.git/blob - authobj.h
clean up pam module
[pam_pcsc_cr.git] / authobj.h
1 /*
2 Copyright (c) 2013 Eugene Crosser
3
4 This software is provided 'as-is', without any express or implied
5 warranty. In no event will the authors be held liable for any damages
6 arising from the use of this software.
7
8 Permission is granted to anyone to use this software for any purpose,
9 including commercial applications, and to alter it and redistribute it
10 freely, subject to the following restrictions:
11
12     1. The origin of this software must not be misrepresented; you must
13     not claim that you wrote the original software. If you use this
14     software in a product, an acknowledgment in the product documentation
15     would be appreciated but is not required.
16
17     2. Altered source versions must be plainly marked as such, and must
18     not be misrepresented as being the original software.
19
20     3. This notice may not be removed or altered from any source
21     distribution.
22 */
23
24 #ifndef _AUTHOBJ_H
25 #define _AUTHOBJ_H
26
27 #define AUTHCHUNKSIZE 20
28
29 struct _auth_chunk {
30         const char *err;
31         unsigned char data[AUTHCHUNKSIZE];
32 };
33
34 struct _auth_obj {
35         unsigned char *buffer;  /* to be free()'d if not NULL */
36         const char *err;        /* non-NULL if failed */
37         unsigned char *data;
38         int datasize;
39         unsigned char *payload;
40         int paylsize;
41 };
42
43 /* Construct new or repack old authobj, return payload */
44 struct _auth_obj authobj(const char *userid, const char *password,
45                 const char *oldnonce, const char *newnonce,
46                 const unsigned char *secret, const int secsize,
47                 const unsigned char *payload, const int paysize,
48                 const unsigned char *ablob, const int blobsize,
49                 struct _auth_chunk (*fetch_key)(const unsigned char *chal,
50                                                 const int csize));
51
52 #endif