1/*-
2 * Copyright (C) 2001-2003 by NBMK Encryption Technologies.
3 * All rights reserved.
4 *
5 * NBMK Encryption Technologies provides no support of any kind for
6 * this software.  Questions or concerns about it may be addressed to
7 * the members of the relevant open-source community at
8 * <tech-crypto@netbsd.org>.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are
12 * met:
13 *
14 * 1. Redistributions of source code must retain the above copyright
15 *    notice, this list of conditions and the following disclaimer.
16 *
17 * 2. Redistributions in binary form must reproduce the above
18 *    copyright notice, this list of conditions and the following
19 *    disclaimer in the documentation and/or other materials provided
20 *    with the distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/*****************************************************************************
36 * @(#) n8_cb_dsa.h 1.14@(#)
37 *****************************************************************************/
38
39/*****************************************************************************/
40/** @file n8_cb_dsa.h
41 *  @brief DSA Command Blocks
42 *
43 * Command Block Generation for DSA
44 *
45 *****************************************************************************/
46
47/*****************************************************************************
48 * Revision history:
49 * 10/31/01 bac   Corrected N8_CB_DSA_SIGN_NUMCMDS(__KP) for SKS support.
50 * 08/24/01 bac   Added *_NUMCMDS macros for all command generators.
51 * 06/28/01 bac   Minor typo corrections.
52 * 06/26/01 bac   Even more on conversion to use physical memory.
53 * 06/25/01 bac   More on conversion to use physical memory.
54 * 05/22/01 mel   Initial Version
55 ****************************************************************************/
56
57#ifndef N8_CB_DSA_H
58#define N8_CB_DSA_H
59
60#include "n8_dsa.h"
61#include "n8_enqueue_common.h"
62
63/* defines indicating the number of command blocks for each computation */
64#define N8_CB_COMPUTE_GRMODX_NUMCMDS     5
65#define N8_CB_DSA_SIGN_NUMCMDS(__KP)     cb_DSASignOperations((__KP))
66#define N8_CB_DSA_VERIFY_NUMCMDS         19
67
68/*  function prototypes */
69N8_Status_t cb_computeGRmodX(API_Request_t                   *req_p,
70                             const int                        modulusDigits,
71                             const uint32_t                   g_a,
72                             const uint32_t                   X_a,
73                             const uint32_t                   res_a,
74                             PK_CMD_BLOCK_t                  *buf_p,
75                             PK_CMD_BLOCK_t                  **next_cmdBuf_p);
76
77N8_Status_t cb_dsaSign(API_Request_t *req_p,
78                       const N8_DSAKeyObject_t *key,
79                       uint32_t n_a,
80                       uint32_t paramBlock_a,
81                       uint32_t msgHash_a,
82                       uint32_t rValue_a,
83                       uint32_t sValue_a,
84                       PK_CMD_BLOCK_t *buf_p);
85
86N8_Status_t cb_dsaVerify(API_Request_t *req_p,
87                         const N8_DSAKeyObject_t *key,
88                         uint32_t q_a,
89                         uint32_t cp_a,
90                         uint32_t gR_mod_p_a,
91                         uint32_t p_a,
92                         uint32_t publicKey_a,
93                         uint32_t mh_a,
94                         uint32_t r_a,
95                         uint32_t s_a,
96                         uint32_t res_a,
97                         PK_CMD_BLOCK_t *cmdBuf_p);
98
99unsigned int cb_DSASignOperations(const N8_DSAKeyObject_t *key_p);
100
101#endif /* N8_CB_DSA_H */
102
103