anastasis

Credential backup and recovery protocol and service
Log | Files | Refs | Submodules | README | LICENSE

validation.h (2340B)


      1 /*
      2   This file is part of Anastasis
      3   Copyright (C) 2026 Anastasis SARL
      4 
      5   Anastasis is free software; you can redistribute it and/or modify it under the
      6   terms of the GNU Lesser General Public License as published by the Free Software
      7   Foundation; either version 3, or (at your option) any later version.
      8 
      9   Anastasis is distributed in the hope that it will be useful, but WITHOUT ANY
     10   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     11   A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
     12 
     13   You should have received a copy of the GNU Lesser General Public License along with
     14   Anastasis; see the file COPYING.LGPL.  If not, see <http://www.gnu.org/licenses/>
     15 */
     16 /**
     17  * @file reducer/validation.h
     18  * @brief lookup of the national identity number validation functions
     19  * @author Christian Grothoff
     20  *
     21  * The `validation-logic` name of an attribute comes from the reducer state,
     22  * which is attacker-influenceable.  It must therefore never be used to look up
     23  * a symbol at run time; the name is resolved against the fixed table in
     24  * validation.c instead, and an unknown name is a validation failure.
     25  */
     26 #ifndef ANASTASIS_VALIDATION_H
     27 #define ANASTASIS_VALIDATION_H
     28 
     29 #include <stdbool.h>
     30 
     31 /**
     32  * Signature of the per-country identity number check functions.
     33  *
     34  * @param number the identity number entered by the user
     35  * @return true if @a number is well-formed
     36  */
     37 typedef bool
     38 (*ANASTASIS_ValidationLogic)(const char *number);
     39 
     40 
     41 /**
     42  * Resolve @a name to the validation function implementing it.
     43  *
     44  * @param name value of the "validation-logic" field, must not be NULL
     45  * @return NULL if @a name is not a known validation function
     46  */
     47 ANASTASIS_ValidationLogic
     48 ANASTASIS_REDUX_validation_lookup_ (const char *name);
     49 
     50 
     51 bool
     52 BE_NRN_check (const char *nrn_number);
     53 
     54 bool
     55 CH_AHV_check (const char *ahv_number);
     56 
     57 bool
     58 CZ_BN_check (const char *b_number);
     59 
     60 bool
     61 DE_SVN_check (const char *ssn_number);
     62 
     63 bool
     64 DE_TIN_check (const char *tin_number);
     65 
     66 bool
     67 ES_DNI_check (const char *dni_number);
     68 
     69 bool
     70 FR_INSEE_check (const char *insee_number);
     71 
     72 bool
     73 IN_AADHAR_check (const char *aadhar_number);
     74 
     75 bool
     76 IT_CF_check (const char *cf_number);
     77 
     78 bool
     79 NL_BSN_check (const char *bsn_number);
     80 
     81 bool
     82 XX_SQUARE_check (const char *sq_number);
     83 
     84 bool
     85 XY_PRIME_check (const char *pr_number);
     86 
     87 #endif