Skip to content

Commit

Permalink
Initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquesg committed May 4, 2020
1 parent 4f93dda commit be0d802
Show file tree
Hide file tree
Showing 51 changed files with 3,377 additions and 153 deletions.
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Revision history for FIDO-Raw

{{$NEXT}}

- Initial version
48 changes: 48 additions & 0 deletions MANIFEST.SKIP
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Raw.bs
Raw.c
Raw.o
Raw.def
MYMETA.json.lock
dll.base
dll.exp
const-c-constant.inc
const-xs-constant.inc
.*\.o
.*\.a
.*\.pc$
cover_db/
.*\.gcda
.*\.gcno
deps/libcbor/clang-format.sh
deps/libcbor/refresh_templates.sh
deps/libcbor/release.sh
deps/libcbor/appveyor.yml
deps/libcbor/CMake*
deps/libcbor/CNAME
deps/libcbor/CHANGELOG.md
deps/libcbor/Doxyfile
deps/libcbor/examples
deps/libcbor/doc
deps/libcbor/demo
deps/libcbor/misc
deps/libcbor/oss-fuzz
deps/libcbor/test
deps/libcbor/src/allocators.c
deps/libcbor/src/CMakeLists.txt
deps/libcbor/src/libcbor.pc.in
deps/libfido2/CMakeLists.txt
deps/libfido2/examples
deps/libfido2/fuzz
deps/libfido2/man
deps/libfido2/regress
deps/libfido2/tools
deps/libfido2/windows
deps/libfido2/udev
deps/libfido2/src/CMakeLists.txt
deps/libfido2/src/export.gnu
deps/libfido2/src/export.llvm
deps/libfido2/src/export.msvc
deps/libfido2/src/diff_exports.sh
deps/libfido2/src/libfido2.pc.in
deps/libfido2/openbsd-compat/diff.sh
deps/libfido2/NEWS
1 change: 1 addition & 0 deletions README.pod
82 changes: 24 additions & 58 deletions Raw.xs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@

#include "ppport.h"

#undef warn

#include <fido.h>
#include <fido/es256.h>
#include <fido/rs256.h>
#include <fido/eddsa.h>

#ifndef MUTABLE_AV
#define MUTABLE_AV(p) ((AV *)MUTABLE_PTR(p))
#endif
Expand All @@ -24,71 +31,30 @@
#pragma warning (disable : 4244 4267 )
#endif

#include "constants.h"

STATIC MGVTBL null_mg_vtbl = {
NULL, /* get */
NULL, /* set */
NULL, /* len */
NULL, /* clear */
NULL, /* free */
#if MGf_COPY
NULL, /* copy */
#endif /* MGf_COPY */
#if MGf_DUP
NULL, /* dup */
#endif /* MGf_DUP */
#if MGf_LOCAL
NULL, /* local */
#endif /* MGf_LOCAL */
};

STATIC void xs_object_magic_attach_struct (pTHX_ SV *sv, void *ptr)
{
sv_magicext (sv, NULL, PERL_MAGIC_ext, &null_mg_vtbl, ptr, 0);
}

STATIC void *xs_object_magic_get_struct (pTHX_ SV *sv)
{
MAGIC *mg = NULL;

if (SvTYPE (sv) >= SVt_PVMG)
{
MAGIC *tmp;

for (tmp = SvMAGIC(sv); tmp;
tmp = tmp -> mg_moremagic) {
if ((tmp -> mg_type == PERL_MAGIC_ext) &&
(tmp -> mg_virtual == &null_mg_vtbl))
mg = tmp;
}
}

return (mg) ? mg -> mg_ptr : NULL;
}

#define FIDO_SV_TO_MAGIC(SV) \
xs_object_magic_get_struct(aTHX_ SvRV(SV))
typedef fido_assert_t *Assert;
typedef fido_cred_t *Cred;
typedef es256_pk_t *PublicKey_ES256;
typedef rs256_pk_t *PublicKey_RS256;
typedef eddsa_pk_t *PublicKey_EDDSA;

#define FIDO_NEW_OBJ(rv, class, sv) \
STMT_START { \
(rv) = sv_setref_pv(newSV(0), class, sv); \
} STMT_END

#define FIDO_NEW_OBJ_WITH_MAGIC(rv, class, sv, magic) \
STMT_START { \
(rv) = sv_setref_pv(newSV(0), class, sv); \
\
xs_object_magic_attach_struct( \
aTHX_ SvRV(rv), SvREFCNT_inc_NN(magic) \
); \
} STMT_END

#define FIDO_OBJ_SET_MAGIC(sv, magic) \
STMT_START { \
xs_object_magic_attach_struct( \
aTHX_ SvRV(sv), SvREFCNT_inc_NN(magic) \
); \
} STMT_END
MODULE = FIDO::Raw PACKAGE = FIDO::Raw

BOOT:
fido_init (0);

INCLUDE: const-xs-constant.inc

INCLUDE: xs/Assert.xs
INCLUDE: xs/Cred.xs
INCLUDE: xs/PublicKey/ES256.xs
INCLUDE: xs/PublicKey/EDDSA.xs
INCLUDE: xs/PublicKey/RS256.xs

MODULE = FIDO::Raw PACKAGE = FIDO::Raw
111 changes: 111 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml

strategy:
matrix:
windows-perl530:
PERL_VERSION: '5.30.2.1'
PERL_MAKE: 'gmake'
IMAGE: 'windows-latest'
linux-perl530:
PERL_VERSION: '5.30.2'
IMAGE: 'ubuntu-latest'
linux-perl528:
PERL_VERSION: '5.28.2'
IMAGE: 'ubuntu-latest'
linux-perl526:
PERL_VERSION: '5.26.3'
IMAGE: 'ubuntu-latest'
linux-perl524:
PERL_VERSION: '5.24.4'
IMAGE: 'ubuntu-latest'
linux-perl522:
PERL_VERSION: '5.22.4'
IMAGE: 'ubuntu-latest'
macos-perl530:
PERL_VERSION: '5.30.2'
IMAGE: 'macos-latest'
macos-perl528:
PERL_VERSION: '5.28.2'
IMAGE: 'macos-latest'
macos-perl526:
PERL_VERSION: '5.26.3'
IMAGE: 'macos-latest'
macos-perl524:
PERL_VERSION: '5.24.4'
IMAGE: 'macos-latest'
macos-perl522:
PERL_VERSION: '5.22.4'
IMAGE: 'macos-latest'

pool:
vmImage: $(IMAGE)

steps:
- script: |
sudo apt-get -qq install libssl-dev libudev-dev
condition: startsWith(variables['IMAGE'], 'ubuntu')
displayName: 'Install dependencies (Ubuntu)'

- script: |
PATH=~/perl5/bin:~/perl5/perlbrew/bin:~/perl5/perlbrew/perls/perl-$(PERL_VERSION)/bin:$PATH
echo "##vso[task.setvariable variable=PATH]$PATH"
wget -O - https://install.perlbrew.pl | bash
perlbrew install --notest perl-$(PERL_VERSION)
perl -V
curl -L https://cpanmin.us | perl - App::cpanminus
condition: or(startsWith(variables['IMAGE'], 'ubuntu'), startsWith(variables['IMAGE'], 'macos'))
displayName: 'Install perl (Unix)'

- script: |
choco uninstall strawberryperl
choco install strawberryperl -y --version=$(PERL_VERSION)
perl -V
condition: startsWith(variables['IMAGE'], 'windows')
displayName: 'Install perl (Windows)'

- script: |
call cpanm --quiet --notest Dist::Zilla Dist::Zilla::PluginBundle::Author::JACQUESG App::Ack
call dzil authordeps --missing | ack -v "inc::" | cpanm --quiet --notest
call dzil listdeps --missing | cpanm --quiet --notest
condition: startsWith(variables['IMAGE'], 'windows')
displayName: 'Install CPAN dependencies (Windows)'

- script: |
cpanm --quiet --notest Dist::Zilla Dist::Zilla::PluginBundle::Author::JACQUESG App::Ack
dzil authordeps --missing | ack -v "inc::" | cpanm --quiet --notest
dzil listdeps --missing | cpanm --quiet --notest
condition: or(startsWith(variables['IMAGE'], 'ubuntu'), startsWith(variables['IMAGE'], 'macos'))
displayName: 'Install CPAN dependencies (Unix)'

- script: |
dzil cover -ignore_re ^deps -ignore_re CORE -ignore_re ^const -ignore_re usr -test -report coveralls
condition: startsWith(variables['IMAGE'], 'ubuntu')
env:
COVERALLS_REPO_TOKEN: $(COVERALLS_REPO_TOKEN)
RELEASE_TESTING: 1
AUTOMATED_TESTING: 1
displayName: 'Build/Test (Linux)'

- script: |
dzil test
condition: startsWith(variables['IMAGE'], 'macos')
env:
RELEASE_TESTING: 1
AUTOMATED_TESTING: 1
displayName: 'Build/Test (macOS)'

- script: |
call dzil build --in FIDO-Raw
cd FIDO-Raw
set PATH=C:\Strawberry\perl\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\c\bin
perl Makefile.PL
$(PERL_MAKE) test
condition: startsWith(variables['IMAGE'], 'windows')
env:
RELEASE_TESTING: 1
AUTOMATED_TESTING: 1
displayName: 'Build/Test (Windows)'

Loading

0 comments on commit be0d802

Please sign in to comment.